本文整理汇总了C++中Identifier::setIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::setIdentifier方法的具体用法?C++ Identifier::setIdentifier怎么用?C++ Identifier::setIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::setIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: typeIdentifierFromTemplateArgument
IndexedTypeIdentifier typeIdentifierFromTemplateArgument(ParseSession* session, TemplateArgumentAST *node)
{
IndexedTypeIdentifier id;
if(node->expression) {
id = IndexedTypeIdentifier(session->stringForNode(node), true);
}else if(node->type_id) {
//Parse the pointer operators
TypeCompiler tc(session);
tc.run(node->type_id->type_specifier);
id = IndexedTypeIdentifier(tc.identifier());
//node->type_id->type_specifier->cv
if(node->type_id->type_specifier)
id.setIsConstant(parseConstVolatile(session, node->type_id->type_specifier->cv) & AbstractType::ConstModifier);
if(node->type_id->declarator && node->type_id->declarator->ptr_ops)
{
const ListNode<PtrOperatorAST*> *it = node->type_id->declarator->ptr_ops->toFront();
const ListNode<PtrOperatorAST*> *end = it; ///@todo check ordering, eventually walk the list in reversed order
do
{
if(it->element && it->element->op) { ///@todo What about ptr-to-member?
int kind = session->token_stream->kind(it->element->op);
if(kind == '&') {
//We're handling a 'reference'
id.setIsReference(true);
} else if(kind == Token_and) {
//We're handling an rvalue-reference
id.setIsReference(true);
id.setIsRValue(true);
} else {
//We're handling a real pointer
id.setPointerDepth(id.pointerDepth()+1);
if(it->element->cv) {
id.setIsConstPointer(id.pointerDepth()-1, parseConstVolatile(session, it->element->cv) & AbstractType::ConstModifier);
}
}
}
it = it->next;
}
while (it != end);
} else if (node->type_id->declarator && node->type_id->declarator->array_dimensions) {
///FIXME: find a way to put this information into the identifier
/// e.g.: id.setArrayDepth(id.arrayDepth() + 1) ?
const ListNode< ExpressionAST* >* it = node->type_id->declarator->array_dimensions->toFront();
const ListNode< ExpressionAST* >* end = node->type_id->declarator->array_dimensions-> toBack();
do {
QualifiedIdentifier qid = id.identifier();
Identifier last = qid.last();
qid.pop();
last.setIdentifier(last.toString() + "[]");
qid.push(last);
id.setIdentifier(IndexedQualifiedIdentifier( qid ));
it = it->next;
} while (it != end);
}
}
return id;
}