本文整理汇总了C++中BaseClass::setVisibility方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseClass::setVisibility方法的具体用法?C++ BaseClass::setVisibility怎么用?C++ BaseClass::setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseClass
的用法示例。
在下文中一共展示了BaseClass::setVisibility方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
bool CheckSpecifier::visit(ClassSpecifierAST *ast)
{
unsigned sourceLocation = ast->firstToken();
if (ast->name)
sourceLocation = ast->name->firstToken();
const Name *className = semantic()->check(ast->name, _scope);
Class *klass = control()->newClass(sourceLocation, className);
klass->setStartOffset(tokenAt(ast->firstToken()).offset);
klass->setEndOffset(tokenAt(ast->lastToken()).offset);
ast->symbol = klass;
unsigned classKey = tokenKind(ast->classkey_token);
if (classKey == T_CLASS)
klass->setClassKey(Class::ClassKey);
else if (classKey == T_STRUCT)
klass->setClassKey(Class::StructKey);
else if (classKey == T_UNION)
klass->setClassKey(Class::UnionKey);
klass->setVisibility(semantic()->currentVisibility());
_scope->enterSymbol(klass);
_fullySpecifiedType.setType(klass);
for (BaseSpecifierListAST *it = ast->base_clause_list; it; it = it->next) {
BaseSpecifierAST *base = it->value;
const Name *baseClassName = semantic()->check(base->name, _scope);
BaseClass *baseClass = control()->newBaseClass(ast->firstToken(), baseClassName);
base->symbol = baseClass;
if (base->virtual_token)
baseClass->setVirtual(true);
if (base->access_specifier_token) {
int accessSpecifier = tokenKind(base->access_specifier_token);
int visibility = semantic()->visibilityForAccessSpecifier(accessSpecifier);
baseClass->setVisibility(visibility);
}
klass->addBaseClass(baseClass);
}
int visibility = semantic()->visibilityForClassKey(classKey);
int previousVisibility = semantic()->switchVisibility(visibility);
int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
DeclarationAST *previousDeclaration = 0;
for (DeclarationListAST *it = ast->member_specifier_list; it; it = it->next) {
DeclarationAST *declaration = it->value;
semantic()->check(declaration, klass->members());
if (previousDeclaration && declaration &&
declaration->asEmptyDeclaration() != 0 &&
previousDeclaration->asFunctionDefinition() != 0)
translationUnit()->warning(declaration->firstToken(), "unnecessary semicolon after function body");
previousDeclaration = declaration;
}
(void) semantic()->switchMethodKey(previousMethodKey);
(void) semantic()->switchVisibility(previousVisibility);
return false;
}