当前位置: 首页>>代码示例>>C++>>正文


C++ QualifiedName::shiftLastComponentToName方法代码示例

本文整理汇总了C++中QualifiedName::shiftLastComponentToName方法的典型用法代码示例。如果您正苦于以下问题:C++ QualifiedName::shiftLastComponentToName方法的具体用法?C++ QualifiedName::shiftLastComponentToName怎么用?C++ QualifiedName::shiftLastComponentToName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QualifiedName的用法示例。


在下文中一共展示了QualifiedName::shiftLastComponentToName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseQualifiedName

    QualifiedName TypeParser::parseQualifiedName(bool adjustForIdentifier) {
        QualifiedName name;

        for (;;) {
            // have to start with an identifier
            if (_helper->peek().type() != Token::Type::Identifier) {
                assert(0 && "Message: Invalid multi-part identifier");
            }

            name.appendComponent(_helper->nextStr());

            // need two successive colons to continue
            if (_helper->peek().type() != Token::Type::PunctuationColon) {
                break;
            }

            if (_helper->peek(2).type() != Token::Type::PunctuationColon) {
                break;
            }

            // check for and handle the case of empty specifiers
            if (_helper->peek(3).type() != Token::Type::Identifier) {
                break;
            }

            _helper->next();
            _helper->next();
        }

        if (adjustForIdentifier) {
            // do an adjustment to seperate the name from the namspace parts
            name.shiftLastComponentToName();
        }

        return name;
    }
开发者ID:mattmassicotte,项目名称:three,代码行数:36,代码来源:TypeParser.cpp

示例2: peekQualifiedName

    bool TypeParser::peekQualifiedName(uint32_t* peekDepth, QualifiedName& peekedName) {
        assert(peekDepth);

        for (;;) {
            // We have to lead with an identifier
            if (_helper->peek(*peekDepth).type() != Token::Type::Identifier) {
                return false;
            }

            peekedName.appendComponent(_helper->peek(*peekDepth).str());
            *peekDepth += 1;

            // check for "::"
            if (_helper->peek(*peekDepth).type() != Token::Type::PunctuationColon) {
                break;
            }

            if (_helper->peek(*peekDepth + 1).type() != Token::Type::PunctuationColon) {
                break;
            }

            // Check for the empty specifier case of "Int::4"
            if (_helper->peek(*peekDepth + 2).type() != Token::Type::Identifier) {
                break;
            }

            // move past the "::", and check for the next identifier part
            *peekDepth += 2;
        }

        // We've treated every identifier as a namespace, because its convenient. But,
        // the last component is really the identifier itself (ie the name).
        peekedName.shiftLastComponentToName();

        return true;
    }
开发者ID:mattmassicotte,项目名称:three,代码行数:36,代码来源:TypeParser.cpp


注:本文中的QualifiedName::shiftLastComponentToName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。