本文整理汇总了C++中zstring::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ zstring::empty方法的具体用法?C++ zstring::empty怎么用?C++ zstring::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zstring
的用法示例。
在下文中一共展示了zstring::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_primary
static void parse_primary( zstring const &picture_str,
zstring::const_iterator *i, picture *pic,
QueryLoc const &loc ) {
if ( picture_str.empty() ) {
//
// XQuery 3.0 F&O 4.6.1: The primary format token is always present and
// must not be zero-length.
//
empty_format:
throw XQUERY_EXCEPTION(
err::FODF1310,
ERROR_PARAMS( ZED( FODF1310_EmptyFormat ) ),
ERROR_LOC( loc )
);
}
//
// Because of:
//
// Ibid: If the string contains one or more semicolons then everything
// that precedes the last semicolon is taken as the primary format token
// and everything that follows is taken as the format modifier.
//
// we have to count the number of semicolons in order to know when we've
// reached the last one.
//
int semicolon_counter = 0;
FOR_EACH( zstring, c, picture_str )
if ( *c == ';' )
++semicolon_counter;
int const semicolons = semicolon_counter;
if ( semicolons == 1 && picture_str[0] == ';' ) {
//
// This also means that the primary format token is zero-length.
//
goto empty_format;
}
unicode::code_point cp;
utf8_string<zstring const> const u_picture_str( picture_str );
utf8_string<zstring const>::const_iterator u;
//
// Determine whether the primary format token is a decimal-digit-pattern:
//
// Ibid: If the primary format token contains at least one Unicode digit
// then it is taken as a decimal digit pattern.
//
// and whether all digits are from the same digit family:
//
// Ibid: All mandatory-digit-signs within the format token must be from
// the same digit family, where a digit family is a sequence of ten
// consecutive characters in Unicode category Nd, having digit values 0
// through 9.
//
bool is_decimal_digit_pattern = false;
unicode::code_point zero[] = { '0', '0' };
semicolon_counter = semicolons;
for ( u = u_picture_str.begin(); u != u_picture_str.end(); ++u ) {
cp = *u;
if ( cp == ';' && !--semicolon_counter )
break;
if ( unicode::is_Nd( cp, &zero[ is_decimal_digit_pattern ] ) ) {
if ( is_decimal_digit_pattern && zero[1] != zero[0] ) {
throw XQUERY_EXCEPTION(
err::FODF1310,
ERROR_PARAMS(
picture_str,
ZED( FODF1310_DigitNotSameFamily_34 ),
unicode::printable_cp( cp ),
unicode::printable_cp( zero[0] )
),
ERROR_LOC( loc )
);
}
is_decimal_digit_pattern = true;
++pic->primary.mandatory_digits;
}
}
u = u_picture_str.begin();
cp = *u;
if ( is_decimal_digit_pattern ) {
if ( cp != '#' && unicode::is_grouping_separator( cp ) ) {
//
// Ibid 4.6.1: A grouping-separator-sign must not appear at the start ...
// of the decimal-digit-pattern ....
//
throw XQUERY_EXCEPTION(
err::FODF1310,
ERROR_PARAMS(
picture_str,
ZED( FODF1310_NoGroupSepAtStart_3 ),
unicode::printable_cp( cp )
),
ERROR_LOC( loc )
);
}
//.........这里部分代码省略.........