Logo Search packages:      
Sourcecode: icu version File versions  Download package

UBool UnicodeSet::resemblesPropertyPattern ( RuleCharacterIterator chars,
int32_t  iterOpts 
) [static, private]

Return true if the given iterator appears to point at a property pattern. Regardless of the result, return with the iterator unchanged.

chars iterator over the pattern characters. Upon return it will be unchanged.
iterOpts RuleCharacterIterator options

Definition at line 1222 of file uniset_props.cpp.

References FALSE, RuleCharacterIterator::getPos(), RuleCharacterIterator::next(), RuleCharacterIterator::setPos(), U_SUCCESS, and U_ZERO_ERROR.

    // NOTE: literal will always be FALSE, because we don't parse escapes.
    UBool result = FALSE, literal;
    UErrorCode ec = U_ZERO_ERROR;
    iterOpts &= ~RuleCharacterIterator::PARSE_ESCAPES;
    RuleCharacterIterator::Pos pos;
    UChar32 c = chars.next(iterOpts, literal, ec);
    if (c == 0x5B /*'['*/ || c == 0x5C /*'\\'*/) {
        UChar32 d = chars.next(iterOpts & ~RuleCharacterIterator::SKIP_WHITESPACE,
                               literal, ec);
        result = (c == 0x5B /*'['*/) ? (d == 0x3A /*':'*/) :
                 (d == 0x4E /*'N'*/ || d == 0x70 /*'p'*/ || d == 0x50 /*'P'*/);
    return result && U_SUCCESS(ec);

Generated by  Doxygen 1.6.0   Back to index