本文整理汇总了C++中VTTScanner::scanPercentage方法的典型用法代码示例。如果您正苦于以下问题:C++ VTTScanner::scanPercentage方法的具体用法?C++ VTTScanner::scanPercentage怎么用?C++ VTTScanner::scanPercentage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTTScanner
的用法示例。
在下文中一共展示了VTTScanner::scanPercentage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scanPercentage
static bool scanPercentage(VTTScanner& input, float& number)
{
// http://dev.w3.org/html5/webvtt/#dfn-parse-a-percentage-string
// 1. Let input be the string being parsed.
// 2. If input contains any characters other than U+0025 PERCENT SIGN
// characters (%), U+002E DOT characters (.) and ASCII digits, then
// fail.
// 3. If input does not contain at least one ASCII digit, then fail.
// 4. If input contains more than one U+002E DOT character (.), then fail.
// 5. If any character in input other than the last character is a U+0025
// PERCENT SIGN character (%), then fail.
// 6. If the last character in input is not a U+0025 PERCENT SIGN character
// (%), then fail.
// 7. Ignoring the trailing percent sign, interpret input as a real
// number. Let that number be the percentage.
// 8. If percentage is outside the range 0..100, then fail.
// 9. Return percentage.
return input.scanPercentage(number) && !isInvalidPercentage(number);
}