Doxygen
SymbolResolver类 参考

Helper class to find a class definition or check if A symbol is accessible in a given scope. 更多...

#include <symbolresolver.h>

struct  Private
 

Public 成员函数

 SymbolResolver (const FileDef *fileScope=0)
 
 ~SymbolResolver ()
 
const ClassDefresolveClass (const Definition *scope, const QCString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
 Find the class definition matching name within the scope set. 更多...
 
ClassDefMutableresolveClassMutable (const Definition *scope, const QCString &name, bool mayBeUnlinkable=false, bool mayBeHidden=false)
 Wrapper around resolveClass that returns a mutable interface to the class object or a nullptr if the symbol is immutable. 更多...
 
int isAccessibleFrom (const Definition *scope, const Definition *item)
 Checks if symbol item is accessible from within scope. 更多...
 
int isAccessibleFromWithExpScope (const Definition *scope, const Definition *item, const QCString &explicitScopePart)
 Check if symbol item is accessible from within scope, where it has to match the explicitScopePart. 更多...
 
void setFileScope (const FileDef *fd)
 Sets or updates the file scope using when resolving symbols. 更多...
 
const MemberDefgetTypedef () const
 In case a call to resolveClass() resolves to a type member (e.g. 更多...
 
QCString getTemplateSpec () const
 In case a call to resolveClass() points to a template specialization, the template part is return via this method. 更多...
 
QCString getResolvedType () const
 In case a call to resolveClass() points to a typedef or using declaration. 更多...
 

Private 属性

std::unique_ptr< Privatep
 

详细描述

Helper class to find a class definition or check if A symbol is accessible in a given scope.

在文件 symbolresolver.h30 行定义.

构造及析构函数说明

◆ SymbolResolver()

SymbolResolver::SymbolResolver ( const FileDef fileScope = 0)
explicit

在文件 symbolresolver.cpp1023 行定义.

1024  : p(std::make_unique<Private>(fileScope))
1025 {
1026 }

◆ ~SymbolResolver()

SymbolResolver::~SymbolResolver ( )

在文件 symbolresolver.cpp1028 行定义.

1029 {
1030 }

成员函数说明

◆ getResolvedType()

QCString SymbolResolver::getResolvedType ( ) const

In case a call to resolveClass() points to a typedef or using declaration.

The type name it resolved to is returned via this method.

在文件 symbolresolver.cpp1113 行定义.

1114 {
1115  return p->resolvedType;
1116 }

引用了 p.

被这些函数引用 getCanonicalTypeForIdentifier().

◆ getTemplateSpec()

QCString SymbolResolver::getTemplateSpec ( ) const

In case a call to resolveClass() points to a template specialization, the template part is return via this method.

在文件 symbolresolver.cpp1108 行定义.

1109 {
1110  return p->templateSpec;
1111 }

引用了 p.

被这些函数引用 findClassRelation() , 以及 getCanonicalTypeForIdentifier().

◆ getTypedef()

const MemberDef * SymbolResolver::getTypedef ( ) const

In case a call to resolveClass() resolves to a type member (e.g.

an enum) this method will return it.

在文件 symbolresolver.cpp1103 行定义.

1104 {
1105  return p->typeDef;
1106 }

引用了 p.

被这些函数引用 findClassRelation(), getCanonicalTypeForIdentifier(), getDefs() , 以及 linkifyText().

◆ isAccessibleFrom()

int SymbolResolver::isAccessibleFrom ( const Definition scope,
const Definition item 
)

Checks if symbol item is accessible from within scope.

返回
-1 if item is not accessible or a number indicating how many scope levels up the nearest match was found.

在文件 symbolresolver.cpp1082 行定义.

1083 {
1084  p->reset();
1085  AccessStack accessStack;
1086  return p->isAccessibleFrom(accessStack,scope,item);
1087 }

引用了 p.

被这些函数引用 SymbolResolver::Private::isAccessibleFrom(), SymbolResolver::Private::isAccessibleFromWithExpScope() , 以及 resolveTypeDef().

◆ isAccessibleFromWithExpScope()

int SymbolResolver::isAccessibleFromWithExpScope ( const Definition scope,
const Definition item,
const QCString explicitScopePart 
)

Check if symbol item is accessible from within scope, where it has to match the explicitScopePart.

返回
-1 if item is not accessible or a number indicating how many scope levels up the nearest match was found.

在文件 symbolresolver.cpp1089 行定义.

1091 {
1092  p->reset();
1093  VisitedNamespaces visitedNamespaces;
1094  AccessStack accessStack;
1095  return p->isAccessibleFromWithExpScope(visitedNamespaces,accessStack,scope,item,explicitScopePart);
1096 }

引用了 p.

被这些函数引用 getMemberFromSymbol(), SymbolResolver::Private::getResolvedSymbol(), SymbolResolver::Private::isAccessibleFromWithExpScope() , 以及 SymbolResolver::Private::substTypedef().

◆ resolveClass()

const ClassDef * SymbolResolver::resolveClass ( const Definition scope,
const QCString name,
bool  maybeUnlinkable = false,
bool  mayBeHidden = false 
)

Find the class definition matching name within the scope set.

参数
scopeThe scope to search from.
nameThe name of the symbol.
maybeUnlinkableinclude unlinkable symbols in the search.
mayBeHiddeninclude hidden symbols in the search.
注解
As a result of this call the getters getTypedef(), getTemplateSpec(), and getResolvedType() are set as well.

在文件 symbolresolver.cpp1033 行定义.

1037 {
1038  p->reset();
1039 
1040  if (scope==0 ||
1043  ) ||
1044  (scope->getLanguage()==SrcLangExt_Java && QCString(name).find("::")!=-1)
1045  )
1046  {
1047  scope=Doxygen::globalScope;
1048  }
1049  //fprintf(stderr,"------------ resolveClass(scope=%s,name=%s,mayUnlinkable=%d)\n",
1050  // scope?qPrint(scope->name()):"<global>",
1051  // name,
1052  // mayBeUnlinkable
1053  // );
1054  const ClassDef *result;
1055  if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
1056  {
1057  result = getClass(name);
1058  }
1059  else
1060  {
1061  result = p->getResolvedClassRec(scope,name,&p->typeDef,&p->templateSpec,&p->resolvedType);
1062  if (result==0) // for nested classes imported via tag files, the scope may not
1063  // present, so we check the class name directly as well.
1064  // See also bug701314
1065  {
1066  result = getClass(name);
1067  }
1068  }
1069  if (!mayBeUnlinkable && result && !result->isLinkable())
1070  {
1071  if (!mayBeHidden || !result->isHidden())
1072  {
1073  //printf("result was %s\n",result?qPrint(result->name()):"<none>");
1074  result=0; // don't link to artificial/hidden classes unless explicitly allowed
1075  }
1076  }
1077  //fprintf(stderr,"ResolvedClass(%s,%s)=%s\n",scope?qPrint(scope->name()):"<global>",
1078  // name,result?qPrint(result->name()):"<none>");
1079  return result;
1080 }

引用了 Config_getBool, Definition::definitionType(), getClass(), Definition::getLanguage(), Doxygen::globalScope, Definition::isHidden(), ClassDef::isLinkable(), p, SrcLangExt_Java, Definition::TypeClass , 以及 Definition::TypeNamespace.

被这些函数引用 findClassDefinition(), findClassWithinClassContext(), findUsingDeclImports(), getCanonicalTypeForIdentifier(), getDefs(), isVarWithConstructor(), linkifyText(), normalizeNonTemplateArgumentsInString() , 以及 resolveClassMutable().

◆ resolveClassMutable()

ClassDefMutable* SymbolResolver::resolveClassMutable ( const Definition scope,
const QCString name,
bool  mayBeUnlinkable = false,
bool  mayBeHidden = false 
)
inline

Wrapper around resolveClass that returns a mutable interface to the class object or a nullptr if the symbol is immutable.

在文件 symbolresolver.h55 行定义.

59  {
60  return toClassDefMutable(resolveClass(scope,name,mayBeUnlinkable,mayBeHidden));
61  }

引用了 resolveClass() , 以及 toClassDefMutable().

被这些函数引用 ClassDefImpl::addTypeConstraint(), findClassRelation(), findUsedClassesForClass() , 以及 findUsingDeclarations().

◆ setFileScope()

void SymbolResolver::setFileScope ( const FileDef fd)

Sets or updates the file scope using when resolving symbols.

在文件 symbolresolver.cpp1098 行定义.

1099 {
1100  p->setFileScope(fileScope);
1101 }

引用了 p.

类成员变量说明

◆ p

std::unique_ptr<Private> SymbolResolver::p
private

该类的文档由以下文件生成:
AccessStack
Helper class representing the stack of items considered while resolving the scope.
Definition: symbolresolver.cpp:35
Rtf_Style_Default::name
const char * name
Definition: rtfstyle.h:40
Doxygen::globalScope
static NamespaceDefMutable * globalScope
Definition: doxygen.h:102
Definition::isHidden
virtual bool isHidden() const =0
SrcLangExt_Java
@ SrcLangExt_Java
Definition: types.h:45
VisitedNamespaces
std::unordered_map< std::string, const Definition * > VisitedNamespaces
Definition: symbolresolver.cpp:82
getClass
ClassDef * getClass(const QCString &n)
Definition: classdef.cpp:4974
Definition::getLanguage
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
Definition::TypeNamespace
@ TypeNamespace
Definition: definition.h:89
ClassDef
A abstract class representing of a compound symbol.
Definition: classdef.h:103
SymbolResolver::p
std::unique_ptr< Private > p
Definition: symbolresolver.h:101
Definition::TypeClass
@ TypeClass
Definition: definition.h:87
Definition::definitionType
virtual DefType definitionType() const =0
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
toClassDefMutable
ClassDefMutable * toClassDefMutable(Definition *d)
Definition: classdef.cpp:4944
SymbolResolver::resolveClass
const ClassDef * resolveClass(const Definition *scope, const QCString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
Find the class definition matching name within the scope set.
Definition: symbolresolver.cpp:1033
ClassDef::isLinkable
virtual bool isLinkable() const =0
return TRUE iff a link to this class is possible (either within this project, or as a cross-reference...
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108