本文整理汇总了C++中QualifiedName::appendComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ QualifiedName::appendComponent方法的具体用法?C++ QualifiedName::appendComponent怎么用?C++ QualifiedName::appendComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualifiedName
的用法示例。
在下文中一共展示了QualifiedName::appendComponent方法的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;
}
示例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;
}