Doxygen
Loading...
Searching...
No Matches
doxygen.cpp File Reference
#include "doxygen.h"
#include <algorithm>
#include <cerrno>
#include <chrono>
#include <cinttypes>
#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <locale>
#include <memory>
#include <sys/stat.h>
#include <unordered_map>
#include "aliases.h"
#include "arguments.h"
#include "cite.h"
#include "clangparser.h"
#include "classlist.h"
#include "cmdmapper.h"
#include "code.h"
#include "commentcnv.h"
#include "conceptdef.h"
#include "config.h"
#include "debug.h"
#include "declinfo.h"
#include "defargs.h"
#include "defgen.h"
#include "dir.h"
#include "dirdef.h"
#include "docbookgen.h"
#include "docparser.h"
#include "docsets.h"
#include "dot.h"
#include "eclipsehelp.h"
#include "emoji.h"
#include "entry.h"
#include "fileinfo.h"
#include "filename.h"
#include "fileparser.h"
#include "formula.h"
#include "fortrancode.h"
#include "fortranscanner.h"
#include "ftvhelp.h"
#include "groupdef.h"
#include "htags.h"
#include "htmlgen.h"
#include "htmlhelp.h"
#include "index.h"
#include "indexlist.h"
#include "language.h"
#include "latexgen.h"
#include "layout.h"
#include "lexcode.h"
#include "lexscanner.h"
#include "mangen.h"
#include "markdown.h"
#include "membergroup.h"
#include "memberlist.h"
#include "membername.h"
#include "mermaid.h"
#include "message.h"
#include "moduledef.h"
#include "msc.h"
#include "namespacedef.h"
#include "outputlist.h"
#include "pagedef.h"
#include "parserintf.h"
#include "perlmodgen.h"
#include "plantuml.h"
#include "portable.h"
#include "pre.h"
#include "pycode.h"
#include "pyscanner.h"
#include "qhp.h"
#include "reflist.h"
#include "regex.h"
#include "requirement.h"
#include "rtfgen.h"
#include "scanner.h"
#include "searchindex_js.h"
#include "settings.h"
#include "singlecomment.h"
#include "sitemap.h"
#include "sqlcode.h"
#include "sqlite3gen.h"
#include "stlsupport.h"
#include "stringutil.h"
#include "symbolresolver.h"
#include "tagreader.h"
#include "threadpool.h"
#include "trace.h"
#include "util.h"
#include "version.h"
#include "vhdlcode.h"
#include "vhdldocgen.h"
#include "vhdljjparser.h"
#include "xmlcode.h"
#include "xmlgen.h"
#include <sqlite3.h>
#include <signal.h>
Include dependency graph for doxygen.cpp:

Go to the source code of this file.

Classes

class  Statistics
struct  Statistics::stat
class  NullOutlineParser
 /dev/null outline parser More...

Macros

#define HAS_SIGNALS

Enumerations

enum  FindBaseClassRelation_Mode { TemplateInstances , DocumentedOnly , Undocumented }

Functions

void initResources ()
void clearAll ()
static void addMemberDocs (const Entry *root, MemberDefMutable *md, const DString &funcDecl, const ArgumentList *al, bool over_load, TypeSpecifier spec)
static void findMember (const Entry *root, const DString &relates, const DString &type, const DString &args, DString funcDecl, bool overloaded, bool isFunc)
static bool findClassRelation (const Entry *root, Definition *context, ClassDefMutable *cd, const BaseInfo *bi, const TemplateNameMap &templateNames, FindBaseClassRelation_Mode mode, bool isArtificial)
template<class Def>
static void addIncludeFile (Def *def, FileDef *ifd, const Entry *root)
static Definition * findScopeFromQualifiedName (NamespaceDefMutable *startScope, const DString &n, FileDef *fileScope, const TagInfo *tagInfo)
static void resolveTemplateInstanceInType (const Entry *root, const Definition *scope, const MemberDef *md)
static void addPageToContext (PageDef *pd, Entry *root)
static void addRelatedPage (Entry *root)
static void buildGroupListFiltered (const Entry *root, bool additional, bool includeExternal)
static void buildGroupList (const Entry *root)
static void findGroupScope (const Entry *root)
static void organizeSubGroupsFiltered (const Entry *root, bool additional)
static void organizeSubGroups (const Entry *root)
static void buildFileList (const Entry *root)
DString stripTemplateSpecifiers (const DString &s)
static Definition * buildScopeFromQualifiedName (const DString &name_, SrcLangExt lang, const TagInfo *tagInfo)
std::unique_ptr< ArgumentList > getTemplateArgumentsFromName (const DString &name, const ArgumentLists &tArgLists)
static ClassDef::CompoundType convertToCompoundType (EntryType section, TypeSpecifier specifier)
static void addClassToContext (const Entry *root)
static void buildClassList (const Entry *root)
static void buildClassDocList (const Entry *root)
static void addConceptToContext (const Entry *root)
static void findModuleDocumentation (const Entry *root)
static void buildConceptList (const Entry *root)
static void buildConceptDocList (const Entry *root)
static void distributeConceptGroups ()
static void resolveClassNestingRelations ()
void distributeClassGroupRelations ()
template<typename Container>
static void associateVariableWithAnonymousEnumType (const MemberDef *md, const Container *cd, const MemberDef *enumTypeMember, MemberListType mlFilter)
static ClassDefMutable * createTagLessInstance (const Definition *root, const ClassDef *templ, const DString &fieldName, bool hasNamedVariable)
template<typename Container, typename TagContainer>
static void processTagLessClasses (const Definition *root, const Container *def, const TagContainer *tagParent, MemberListType varFilter, MemberListType typeFilter, const DString &prefix, int count)
 Look through the members of class cd and its public members.
template<typename Container, typename TagContainer>
static void processTagLessClassesForList (const Definition *root, const Container *def, const TagContainer *tagParent, MemberListType varFilter, MemberListType typeFilter, const DString &prefix, int count)
template<typename Container>
static void findTagLessClasses (std::set< const Definition * > &candidates, const Container *cd)
static void findTagLessClasses ()
static void buildNamespaceList (const Entry *root)
static NamespaceDef * findUsedNamespace (const LinkedRefMap< NamespaceDef > &unl, const DString &name)
static void findUsingDirectives (const Entry *root)
static void buildListOfUsingDecls (const Entry *root)
static void findUsingDeclarations (const Entry *root, bool filterPythonPackages)
static void applyMemberOverrideOptions (const Entry *root, MemberDefMutable *md)
static void createUsingMemberImportForClass (const Entry *root, ClassDefMutable *cd, const MemberDef *md, const DString &fileName, const DString &memName)
static void findUsingDeclImports (const Entry *root)
static void findIncludedUsingDirectives ()
static MemberDef * addVariableToClass (const Entry *root, ClassDefMutable *cd, MemberType mtype, const DString &type, const DString &name, const DString &args, Protection prot, Relationship related)
static MemberDef * addVariableToFile (const Entry *root, MemberType mtype, const DString &scope, const DString &type, const DString &name, const DString &args)
static int findFunctionPtr (const std::string &type, SrcLangExt lang, int *pLength=nullptr)
static bool isVarWithConstructor (const Entry *root)
static int findEndOfTemplate (const DString &s, size_t startPos)
static void addVariable (const Entry *root, int isFuncPtr=-1)
static void buildTypedefList (const Entry *root)
static void buildSequenceList (const Entry *root)
static void buildDictionaryList (const Entry *root)
static void buildVarList (const Entry *root)
static void addInterfaceOrServiceToServiceOrSingleton (const Entry *root, ClassDefMutable *cd, DString const &rname)
static void buildInterfaceAndServiceList (const Entry *root)
static void addMethodToClass (const Entry *root, ClassDefMutable *cd, const DString &rtype, const DString &rname, const DString &rargs, bool isFriend, Protection protection, bool stat, Specifier virt, TypeSpecifier spec, const DString &relates)
static void addGlobalFunction (const Entry *root, const DString &rname, const DString &sc)
static void buildFunctionList (const Entry *root)
static void findFriends ()
static void transferFunctionDocumentation ()
static void transferFunctionReferences ()
static void transferRelatedFunctionDocumentation ()
void transferStaticInstanceInitializers ()
static TemplateNameMap getTemplateArgumentsInName (const ArgumentList &templateArguments, const std::string &name)
static ClassDef * findClassWithinClassContext (Definition *context, ClassDef *cd, const DString &name)
static void findUsedClassesForClass (const Entry *root, Definition *context, ClassDefMutable *masterCd, ClassDefMutable *instanceCd, bool isArtificial, const ArgumentList *actualArgs=nullptr, const TemplateNameMap &templateNames=TemplateNameMap())
static void findBaseClassesForClass (const Entry *root, Definition *context, ClassDefMutable *masterCd, ClassDefMutable *instanceCd, FindBaseClassRelation_Mode mode, bool isArtificial, const ArgumentList *actualArgs=nullptr, const TemplateNameMap &templateNames=TemplateNameMap())
static void findTemplateInstanceRelation (const Entry *root, Definition *context, ClassDefMutable *templateClass, const DString &templSpec, const TemplateNameMap &templateNames, bool isArtificial)
static bool isRecursiveBaseClass (const DString &scope, const DString &name)
static int findTemplateSpecializationPosition (const DString &name)
static bool isClassSection (const Entry *root)
static void findClassEntries (const Entry *root)
static DString extractClassName (const Entry *root)
static void findInheritedTemplateInstances ()
static void makeTemplateInstanceRelation (const Entry *root, ClassDefMutable *cd)
static void findUsedTemplateInstances ()
static void warnUndocumentedNamespaces ()
static void computeClassRelations ()
static void computeTemplateClassRelations ()
static void computeMemberReferences ()
template<typename Func>
static void applyToAllDefinitions (Func func)
static void addRequirementReferences ()
static void addListReferences ()
static void generateXRefPages ()
static const ClassDef * findClassDefinition (FileDef *fd, NamespaceDef *nd, const DString &scopeName)
static bool isEntryInGroupOfMember (const Entry *root, const MemberDef *md, bool allowNoGroup=false)
static bool findGlobalMember (const Entry *root, const DString &namespaceName, const DString &type, const DString &name, const DString &tempArg, const DString &, const DString &decl, TypeSpecifier)
static bool isSpecialization (const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists)
static bool scopeIsTemplate (const Definition *d)
static DString substituteTemplatesInString (const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists, const std::string &src)
static void substituteTemplatesInArgList (const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists, const ArgumentList &src, ArgumentList &dst)
static void addLocalObjCMethod (const Entry *root, const DString &scopeName, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &exceptions, const DString &funcDecl, TypeSpecifier spec)
static void addMemberFunction (const Entry *root, MemberName *mn, const DString &scopeName, const DString &namespaceName, const DString &className, const DString &funcTyp, const DString &funcName, const DString &funcArgs, const DString &funcTempList, const DString &exceptions, const DString &type, const DString &args, bool isFriend, TypeSpecifier spec, const DString &relates, const DString &funcDecl, bool overloaded, bool isFunc)
static void addMemberSpecialization (const Entry *root, MemberName *mn, ClassDefMutable *cd, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &funcDecl, const DString &exceptions, TypeSpecifier spec)
static void addOverloaded (const Entry *root, MemberName *mn, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &funcDecl, const DString &exceptions, TypeSpecifier spec)
static void insertMemberAlias (Definition *outerScope, const MemberDef *md)
static void filterMemberDocumentation (const Entry *root, const DString &relates)
static void findMemberDocumentation (const Entry *root)
static void findFieldDocumentation (const Entry *root)
static void findObjCMethodDefinitions (const Entry *root)
static void findEnums (const Entry *root)
static void addEnumValuesToEnums (const Entry *root)
static void addEnumDocs (const Entry *root, MemberDefMutable *md)
static bool tryAddEnumDocsToGroupMember (const Entry *root, const DString &name)
static void findEnumDocumentation (const Entry *root)
static void findDEV (const MemberNameLinkedMap &mnsd)
static void findDocumentedEnumValues ()
static void addMembersToIndex ()
static void addToIndices ()
static void vhdlCorrectMemberProperties ()
static void computeMemberRelationsForBaseClass (const ClassDef *cd, const BaseClassDef *bcd, const ArgumentList *actualArgs)
static void computeMemberRelations ()
static void createTemplateInstanceMembers ()
static void mergeCategories ()
static void buildCompleteMemberLists ()
static void generateFileSources ()
static void generateFileDocs ()
static void addSourceReferences ()
static void buildDefineList ()
static void sortMemberLists ()
static bool isSymbolHidden (const Definition *d)
static void computeTooltipTexts ()
static void setAnonymousEnumType ()
static void countMembers ()
static void generateDocsForClassList (const std::vector< ClassDefMutable * > &classList)
static void addClassAndNestedClasses (std::vector< ClassDefMutable * > &list, ClassDefMutable *cd)
static void generateClassDocs ()
static void generateConceptDocs ()
static void inheritDocumentation ()
static void combineUsingRelations ()
static void addMembersToMemberGroup ()
static void distributeMemberGroupDocumentation ()
static void findSectionsInDocumentation ()
static void flushCachedTemplateRelations ()
static void flushUnresolvedRelations ()
static bool haveEqualFileNames (const Entry *root, const MemberDef *md)
static void addDefineDoc (const Entry *root, MemberDefMutable *md)
static void findDefineDocumentation (Entry *root)
static void findDirDocumentation (const Entry *root)
static void buildRequirementsList (Entry *root)
static void buildPageList (Entry *root)
static void findMainPage (Entry *root)
static void findMainPageTagFiles (Entry *root)
static void computePageRelations (Entry *root)
static void checkPageRelations ()
static void resolveUserReferences ()
static void generatePageDocs ()
static void buildExampleList (Entry *root)
void printNavTree (Entry *root, int indent)
void printSectionsTree ()
static void generateExampleDocs ()
static void generateGroupDocs ()
static void generateNamespaceClassDocs (const ClassLinkedRefMap &classList)
static void generateNamespaceConceptDocs (const ConceptLinkedRefMap &conceptList)
static void generateNamespaceDocs ()
static void runHtmlHelpCompiler ()
static void runQHelpGenerator ()
static void computeVerifiedDotPath ()
static void generateConfigFile (const DString &configFile, bool shortList, bool updateOnly=false)
static void compareDoxyfile (Config::CompareMode diffList)
static void readTagFile (const std::shared_ptr< Entry > &root, const DString &tagLine)
static void copyLatexStyleSheet ()
static void copyStyleSheet ()
static void copyLogo (const DString &outputOption, bool toIndex)
static void copyIcon (const DString &outputOption, bool toIndex)
static void copyExtraFiles (StringVector files, const DString &filesOption, const DString &outputOption, bool toIndex)
static void generateDiskNames ()
static std::unique_ptr< OutlineParserInterface > getParserForFile (const DString &fn)
static std::shared_ptr< Entry > parseFile (OutlineParserInterface &parser, FileDef *fd, const DString &fn, ClangTUParser *clangParser, bool newTU)
static void parseFilesMultiThreading (const std::shared_ptr< Entry > &root)
 parse the list of input files
static void parseFilesSingleThreading (const std::shared_ptr< Entry > &root)
 parse the list of input files
static std::string resolveSymlink (const std::string &path)
static StringUnorderedSet g_pathsVisited (1009)
static void readDir (FileInfo *fi, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, const StringVector *patList, const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool errorIfNotExist, bool recursive, StringUnorderedSet *killSet, StringUnorderedSet *paths)
void readFileOrDirectory (const DString &s, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, const StringVector *patList, const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool recursive, bool errorIfNotExist, StringUnorderedSet *killSet, StringUnorderedSet *paths)
static void dumpSymbol (TextStream &t, Definition *d)
static void dumpSymbolMap ()
static void devUsage ()
static void version (const bool extended)
static void usage (const DString &name, const DString &versionString)
static const char * getArg (int argc, char **argv, int &optInd)
template<class T>
std::function< std::unique_ptr< T >() > make_parser_factory ()
void initDoxygen ()
void cleanUpDoxygen ()
void readConfiguration (int argc, char **argv)
void checkConfiguration ()
 check and resolve config options
void adjustConfiguration ()
 adjust globals that depend on configuration settings.
static void stopDoxygen (int)
static void writeTagFile ()
static void exitDoxygen () noexcept
static DString createOutputDirectory (const DString &baseDirName, const DString &formatDirName, const char *defaultDirName)
void searchInputFiles ()
static void checkMarkdownMainfile ()
void parseInput ()
void generateOutput ()

Variables

static std::multimap< std::string, const Entry * > g_classEntries
static StringVector g_inputFiles
static OutputList * g_outputList = nullptr
static StringSet g_usingDeclarations
static bool g_successfulRun = false
static bool g_dumpSymbolMap = false
static DString g_commentFileName
static bool g_singleComment =false
static const StringUnorderedSet g_compoundKeywords
class Statistics g_s
static std::unordered_map< std::string, std::vector< ClassDefMutable * > > g_usingClassMap

Macro Definition Documentation

◆ HAS_SIGNALS

#define HAS_SIGNALS

Definition at line 137 of file doxygen.cpp.

Enumeration Type Documentation

◆ FindBaseClassRelation_Mode

Enumerator
TemplateInstances 
DocumentedOnly 
Undocumented 

Definition at line 289 of file doxygen.cpp.

290{
294};
@ Undocumented
Definition doxygen.cpp:293
@ TemplateInstances
Definition doxygen.cpp:291
@ DocumentedOnly
Definition doxygen.cpp:292

Function Documentation

◆ addClassAndNestedClasses()

void addClassAndNestedClasses ( std::vector< ClassDefMutable * > & list,
ClassDefMutable * cd )
static

Definition at line 9612 of file doxygen.cpp.

9613{
9614 list.push_back(cd);
9615 for (const auto &innerCdi : cd->getClasses())
9616 {
9617 ClassDefMutable *innerCd = toClassDefMutable(innerCdi);
9618 if (innerCd)
9619 {
9620 AUTO_TRACE("innerCd={} isLinkable={} isImplicitTemplateInstance={} protectLevelVisible={} embeddedInOuterScope={}",
9621 innerCd->name(),innerCd->isLinkableInProject(),innerCd->isImplicitTemplateInstance(),protectionLevelVisible(innerCd->protection()),
9622 innerCd->isEmbeddedInOuterScope());
9623 }
9624 if (innerCd && innerCd->isLinkableInProject() && !innerCd->isImplicitTemplateInstance() &&
9625 protectionLevelVisible(innerCd->protection()) &&
9626 !innerCd->isEmbeddedInOuterScope()
9627 )
9628 {
9629 list.push_back(innerCd);
9630 addClassAndNestedClasses(list,innerCd);
9631 }
9632 }
9633}
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
virtual bool isEmbeddedInOuterScope() const =0
virtual bool isImplicitTemplateInstance() const =0
virtual ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual const DString & name() const =0
virtual bool isLinkableInProject() const =0
ClassDefMutable * toClassDefMutable(Definition *d)
#define AUTO_TRACE(...)
Definition docnode.cpp:53
static void addClassAndNestedClasses(std::vector< ClassDefMutable * > &list, ClassDefMutable *cd)
Definition doxygen.cpp:9612
bool protectionLevelVisible(Protection prot)
Definition util.cpp:4807

References addClassAndNestedClasses(), AUTO_TRACE, ClassDef::getClasses(), ClassDef::isEmbeddedInOuterScope(), ClassDef::isImplicitTemplateInstance(), Definition::isLinkableInProject(), Definition::name(), ClassDef::protection(), protectionLevelVisible(), and toClassDefMutable().

Referenced by addClassAndNestedClasses(), and generateClassDocs().

◆ addClassToContext()

void addClassToContext ( const Entry * root)
static

Definition at line 954 of file doxygen.cpp.

955{
956 AUTO_TRACE("name={}",root->name);
957 FileDef *fd = root->fileDef();
958
959 DString scName;
960 if (root->parent()->section.isScope())
961 {
962 scName=root->parent()->name;
963 }
964 // name without parent's scope
965 DString fullName = root->name;
966
967 // strip off any template parameters (but not those for specializations)
968 if (size_t idx=fullName.find('>'); idx!=DString::npos && root->lang==SrcLangExt::CSharp) // mangle A<S,T>::N as A-2-g::N
969 {
970 fullName = mangleCSharpGenericName(fullName.left(idx+1))+fullName.mid(idx+1);
971 }
972 fullName=stripTemplateSpecifiersFromScope(fullName);
973
974 // name with scope (if not present already)
975 DString qualifiedName = fullName;
976 if (!scName.empty() && !leftScopeMatch(scName,fullName))
977 {
978 qualifiedName.prepend(scName+"::");
979 }
980
981 // see if we already found the class before
982 ClassDefMutable *cd = getClassMutable(qualifiedName);
983
984 AUTO_TRACE_ADD("Found class with name '{}', qualifiedName '{}'", cd ? cd->name() : root->name, qualifiedName);
985
986 if (cd)
987 {
988 fullName=cd->name();
989 AUTO_TRACE_ADD("Existing class '{}'",cd->name());
990 //if (cd->templateArguments()==0)
991 //{
992 // //printf("existing ClassDef tempArgList=%p specScope=%s\n",root->tArgList,qPrint(root->scopeSpec));
993 // cd->setTemplateArguments(tArgList);
994 //}
995
996 cd->setDocumentation(root->doc,root->docFile,root->docLine);
997 cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
998 root->commandOverrides.apply_collaborationGraph([&](bool b ) { cd->overrideCollaborationGraph(b); });
999 root->commandOverrides.apply_inheritanceGraph ([&](CLASS_GRAPH_t gt) { cd->overrideInheritanceGraph(gt); });
1000
1001 if (!root->spec.isForwardDecl() && cd->isForwardDeclared())
1002 {
1003 cd->setDefFile(root->fileName,root->startLine,root->startColumn);
1004 if (root->bodyLine!=-1)
1005 {
1006 cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
1007 cd->setBodyDef(fd);
1008 }
1009 }
1010
1011 if (cd->templateArguments().empty() || (cd->isForwardDeclared() && !root->spec.isForwardDecl()))
1012 {
1013 // this happens if a template class declared with @class is found
1014 // before the actual definition or if a forward declaration has different template
1015 // parameter names.
1016 std::unique_ptr<ArgumentList> tArgList = getTemplateArgumentsFromName(cd->name(),root->tArgLists);
1017 if (tArgList)
1018 {
1019 cd->setTemplateArguments(*tArgList);
1020 }
1021 }
1022 if (cd->requiresClause().empty() && !root->req.empty())
1023 {
1024 cd->setRequiresClause(root->req);
1025 }
1026
1028
1029 cd->setMetaData(root->metaData);
1030 }
1031 else // new class
1032 {
1034
1035 DString className;
1036 DString namespaceName;
1037 extractNamespaceName(fullName,className,namespaceName);
1038
1039 AUTO_TRACE_ADD("New class: fullname '{}' namespace '{}' name='{}' brief='{}' docs='{}'",
1040 fullName, namespaceName, className, Trace::trunc(root->brief), Trace::trunc(root->doc));
1041
1042 DString tagName;
1043 DString refFileName;
1044 const TagInfo *tagInfo = root->tagInfo();
1045 if (tagInfo)
1046 {
1047 tagName = tagInfo->tagName;
1048 refFileName = tagInfo->fileName;
1049 if (fullName.find("::")!=DString::npos)
1050 // symbols imported via tag files may come without the parent scope,
1051 // so we artificially create it here
1052 {
1053 buildScopeFromQualifiedName(fullName,root->lang,tagInfo);
1054 }
1055 }
1056 std::unique_ptr<ArgumentList> tArgList;
1057 size_t i=0;
1058 if ((root->lang==SrcLangExt::CSharp || root->lang==SrcLangExt::Java) &&
1059 (i=fullName.find('<'))!=DString::npos)
1060 {
1061 // a Java/C# generic class looks like a C++ specialization, so we need to split the
1062 // name and template arguments here
1063 tArgList = stringToArgumentList(root->lang,fullName.mid(i));
1064 if (i!=DString::npos && root->lang==SrcLangExt::CSharp) // in C# A, A<T>, and A<T,S> are different classes, so we need some way to disguish them using this name mangling
1065 // A -> A
1066 // A<T> -> A-1-g
1067 // A<T,S> -> A-2-g
1068 {
1069 fullName=mangleCSharpGenericName(fullName);
1070 }
1071 else
1072 {
1073 fullName=fullName.left(i);
1074 }
1075 }
1076 else
1077 {
1078 tArgList = getTemplateArgumentsFromName(fullName,root->tArgLists);
1079 }
1080 // add class to the list
1081 cd = toClassDefMutable(
1082 Doxygen::classLinkedMap->add(fullName,
1083 createClassDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn,
1084 fullName,sec,tagName,refFileName,true,root->spec.isEnum()) ));
1085 if (cd)
1086 {
1087 AUTO_TRACE_ADD("New class '{}' type={} #tArgLists={} tagInfo={} hidden={} artificial={}",
1088 fullName,cd->compoundTypeString(),root->tArgLists.size(),
1089 fmt::ptr(tagInfo),root->hidden,root->artificial);
1090 cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
1091 cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
1092 cd->setLanguage(root->lang);
1093 cd->setId(root->id);
1094 cd->setHidden(root->hidden);
1095 cd->setArtificial(root->artificial);
1096 cd->setClassSpecifier(root->spec);
1097 if ((root->lang==SrcLangExt::CSharp || root->lang==SrcLangExt::Java) && !root->args.empty())
1098 {
1100 }
1101 cd->addQualifiers(root->qualifiers);
1102 cd->setTypeConstraints(root->typeConstr);
1103 root->commandOverrides.apply_collaborationGraph([&](bool b ) { cd->overrideCollaborationGraph(b); });
1104 root->commandOverrides.apply_inheritanceGraph ([&](CLASS_GRAPH_t gt) { cd->overrideInheritanceGraph(gt); });
1105
1106 if (tArgList)
1107 {
1108 cd->setTemplateArguments(*tArgList);
1109 }
1110 cd->setRequiresClause(root->req);
1111 cd->setProtection(root->protection);
1112 cd->setIsStatic(root->isStatic);
1113
1114 // file definition containing the class cd
1115 cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
1116 cd->setBodyDef(fd);
1117
1118 cd->setMetaData(root->metaData);
1119
1120 cd->insertUsedFile(fd);
1121 }
1122 else
1123 {
1124 AUTO_TRACE_ADD("Class {} not added, already exists as alias", fullName);
1125 }
1126 }
1127
1128 if (cd)
1129 {
1131 if (!root->subGrouping) cd->setSubGrouping(false);
1132 if (!root->spec.isForwardDecl())
1133 {
1134 if (cd->hasDocumentation())
1135 {
1136 addIncludeFile(cd,fd,root);
1137 }
1138 if (fd && root->section.isCompound())
1139 {
1140 AUTO_TRACE_ADD("Inserting class {} in file {} (root->fileName='{}')", cd->name(), fd->name(), root->fileName);
1141 cd->setFileDef(fd);
1142 fd->insertClass(cd);
1143 }
1144 }
1145 addClassToGroups(root,cd);
1147 cd->setRefItems(root->sli);
1148 cd->setRequirementReferences(root->rqli);
1149 }
1150}
bool empty() const
Definition arguments.h:100
virtual DString requiresClause() const =0
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual DString compoundTypeString() const =0
Returns the type of compound as a string.
virtual bool isForwardDeclared() const =0
Returns true if this class represents a forward declaration of a template class.
CompoundType
The various compound types.
Definition classdef.h:105
virtual void overrideCollaborationGraph(bool e)=0
virtual void setPrimaryConstructorParams(const ArgumentList &list)=0
virtual void setFileDef(FileDef *fd)=0
virtual void setTemplateArguments(const ArgumentList &al)=0
virtual void addQualifiers(const StringVector &qualifiers)=0
virtual void setClassSpecifier(TypeSpecifier spec)=0
virtual void insertUsedFile(const FileDef *)=0
virtual void setProtection(Protection p)=0
virtual void setTypeConstraints(const ArgumentList &al)=0
virtual void overrideInheritanceGraph(CLASS_GRAPH_t e)=0
virtual void setCompoundType(CompoundType t)=0
virtual void setMetaData(const DString &md)=0
virtual void setIsStatic(bool b)=0
virtual void setSubGrouping(bool enabled)=0
virtual void setRequiresClause(const DString &req)=0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
DString & prepend(const char *s)
Definition dstring.h:515
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString left(size_t len) const
Definition dstring.h:306
virtual bool hasDocumentation() const =0
virtual void setBodySegment(int defLine, int bls, int ble)=0
virtual void setHidden(bool b)=0
virtual void setDocumentation(const DString &d, const DString &docFile, int docLine, bool stripWhiteSpace=true)=0
virtual void setDefFile(const DString &df, int defLine, size_t defColumn)=0
virtual void addSectionsToDefinition(const std::vector< const SectionInfo * > &anchorList)=0
virtual void setLanguage(SrcLangExt lang)=0
virtual void setArtificial(bool b)=0
virtual void setBriefDescription(const DString &b, const DString &briefFile, int briefLine)=0
virtual void setBodyDef(const FileDef *fd)=0
virtual void setRequirementReferences(const RequirementRefs &rqli)=0
virtual void setId(const DString &name)=0
virtual void setRefItems(const RefItemVector &sli)=0
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:88
bool subGrouping
automatically group class members?
Definition entry.h:195
RequirementRefs rqli
references to requirements
Definition entry.h:236
int docLine
line number at which the documentation was found
Definition entry.h:210
ArgumentList typeConstr
where clause (C#) for type constraints
Definition entry.h:224
int endBodyLine
line number where the definition ends
Definition entry.h:227
const TagInfo * tagInfo() const
Definition entry.h:184
DString fileName
file this entry was extracted from
Definition entry.h:232
ArgumentLists tArgLists
template argument declarations
Definition entry.h:203
DString docFile
file in which the documentation was found
Definition entry.h:211
DString args
member argument string
Definition entry.h:199
SrcLangExt lang
programming language in which this entry was found
Definition entry.h:237
Entry * parent() const
Definition entry.h:141
DString doc
documentation block (partly parsed)
Definition entry.h:208
DString req
C++20 requires clause.
Definition entry.h:244
DString brief
brief description (doc block)
Definition entry.h:212
std::vector< const SectionInfo * > anchors
list of anchors defined in this entry
Definition entry.h:231
CommandOverrides commandOverrides
store info for commands whose default can be overridden
Definition entry.h:197
int startLine
start line of entry in the source
Definition entry.h:233
size_t startColumn
start column of entry in the source
Definition entry.h:234
EntryType section
entry type (see Sections);
Definition entry.h:179
int bodyLine
line number of the body in the source
Definition entry.h:225
DString metaData
Slice metadata.
Definition entry.h:243
std::vector< std::string > qualifiers
qualifiers specified with the qualifier command
Definition entry.h:245
DString name
member name
Definition entry.h:181
RefItemVector sli
special lists (test/todo/bug/deprecated/..) this entry is in
Definition entry.h:235
Protection protection
class protection
Definition entry.h:187
bool artificial
Artificially introduced item.
Definition entry.h:239
bool hidden
does this represent an entity that is hidden from the output
Definition entry.h:238
int briefLine
line number at which the brief desc. was found
Definition entry.h:213
FileDef * fileDef() const
Definition entry.h:176
DString id
libclang id
Definition entry.h:241
bool isStatic
static ?
Definition entry.h:192
TypeSpecifier spec
class/member specifiers
Definition entry.h:189
DString briefFile
file in which the brief desc. was found
Definition entry.h:214
ENTRY_TYPES constexpr bool isCompound() const noexcept
Definition types.h:867
constexpr bool isScope() const noexcept
Definition types.h:868
A model of a file symbol.
Definition filedef.h:97
virtual void insertClass(ClassDef *cd)=0
static ModuleManager & instance()
void addClassToModule(const Entry *root, ClassDef *cd)
This struct is used to capture the tag file information for an Entry.
Definition entry.h:109
DString tagName
Definition entry.h:111
DString fileName
Definition entry.h:112
std::unique_ptr< ClassDef > createClassDef(const DString &fileName, int startLine, size_t startColumn, const DString &name, ClassDef::CompoundType ct, const DString &ref, const DString &fName, bool isSymbol, bool isJavaEnum)
Factory method to create a new ClassDef object.
Definition classdef.cpp:584
ClassDefMutable * getClassMutable(const DString &key)
Definition classdef.h:469
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const DString &argsString, DString *extraTypeChars=nullptr)
Definition defargs.l:822
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:54
static Definition * buildScopeFromQualifiedName(const DString &name_, SrcLangExt lang, const TagInfo *tagInfo)
Definition doxygen.cpp:724
static void addIncludeFile(Def *def, FileDef *ifd, const Entry *root)
Definition doxygen.cpp:311
static ClassDef::CompoundType convertToCompoundType(EntryType section, TypeSpecifier specifier)
Definition doxygen.cpp:908
std::unique_ptr< ArgumentList > getTemplateArgumentsFromName(const DString &name, const ArgumentLists &tArgLists)
Definition doxygen.cpp:878
void addClassToGroups(const Entry *root, ClassDef *cd)
DString trunc(const DString &s, size_t numChars=15)
Definition trace.h:56
bool leftScopeMatch(const DString &scope, const DString &name)
Definition util.cpp:745
void extractNamespaceName(const DString &scopeName, DString &className, DString &namespaceName, bool allowEmptyClass)
Definition util.cpp:3158
DString stripTemplateSpecifiersFromScope(const DString &fullName, bool parentOnly, DString *pLastScopeStripped, DString scopeName, bool allowArtificial)
Definition util.cpp:3818
DString mangleCSharpGenericName(const DString &name)
Definition util.cpp:5477

References addClassToGroups(), ModuleManager::addClassToModule(), addIncludeFile(), ClassDefMutable::addQualifiers(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, Entry::args, Entry::artificial, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, buildScopeFromQualifiedName(), Doxygen::classLinkedMap, Entry::commandOverrides, ClassDef::compoundTypeString(), convertToCompoundType(), createClassDef(), Entry::doc, Entry::docFile, Entry::docLine, ArgumentList::empty(), DString::empty(), Entry::endBodyLine, extractNamespaceName(), Entry::fileDef(), Entry::fileName, TagInfo::fileName, DString::find(), getClassMutable(), getTemplateArgumentsFromName(), Definition::hasDocumentation(), Entry::hidden, Entry::id, FileDef::insertClass(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), EntryType::isCompound(), ClassDef::isForwardDeclared(), EntryType::isScope(), Entry::isStatic, Entry::lang, DString::left(), leftScopeMatch(), mangleCSharpGenericName(), Entry::metaData, DString::mid(), Definition::name(), Entry::name, DString::npos, ClassDefMutable::overrideCollaborationGraph(), ClassDefMutable::overrideInheritanceGraph(), Entry::parent(), DString::prepend(), Entry::protection, Entry::qualifiers, Entry::req, ClassDef::requiresClause(), Entry::rqli, Entry::section, DefinitionMutable::setArtificial(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), ClassDefMutable::setClassSpecifier(), ClassDefMutable::setCompoundType(), DefinitionMutable::setDefFile(), DefinitionMutable::setDocumentation(), ClassDefMutable::setFileDef(), DefinitionMutable::setHidden(), DefinitionMutable::setId(), ClassDefMutable::setIsStatic(), DefinitionMutable::setLanguage(), ClassDefMutable::setMetaData(), ClassDefMutable::setPrimaryConstructorParams(), ClassDefMutable::setProtection(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), ClassDefMutable::setRequiresClause(), ClassDefMutable::setSubGrouping(), ClassDefMutable::setTemplateArguments(), ClassDefMutable::setTypeConstraints(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, stringToArgumentList(), stripTemplateSpecifiersFromScope(), Entry::subGrouping, Entry::tagInfo(), TagInfo::tagName, Entry::tArgLists, ClassDef::templateArguments(), toClassDefMutable(), Trace::trunc(), and Entry::typeConstr.

Referenced by buildClassDocList(), and buildClassList().

◆ addConceptToContext()

void addConceptToContext ( const Entry * root)
static

Definition at line 1179 of file doxygen.cpp.

1180{
1181 AUTO_TRACE();
1182 FileDef *fd = root->fileDef();
1183
1184 DString scName;
1185 if (root->parent()->section.isScope())
1186 {
1187 scName=root->parent()->name;
1188 }
1189
1190 // name with scope (if not present already)
1191 DString qualifiedName = root->name;
1192 if (!scName.empty() && !leftScopeMatch(qualifiedName,scName))
1193 {
1194 qualifiedName.prepend(scName+"::");
1195 }
1196
1197 // see if we already found the concept before
1198 ConceptDefMutable *cd = getConceptMutable(qualifiedName);
1199
1200 AUTO_TRACE_ADD("Found concept with name '{}' (qualifiedName='{}')", cd ? cd->name() : root->name, qualifiedName);
1201
1202 if (cd)
1203 {
1204 qualifiedName=cd->name();
1205 AUTO_TRACE_ADD("Existing concept '{}'",cd->name());
1206
1207 cd->setDocumentation(root->doc,root->docFile,root->docLine);
1208 cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
1209
1210 addIncludeFile(cd,fd,root);
1211 }
1212 else // new concept
1213 {
1214 DString className;
1215 DString namespaceName;
1216 extractNamespaceName(qualifiedName,className,namespaceName);
1217
1218 AUTO_TRACE_ADD("New concept: fullname '{}' namespace '{}' name='{}' brief='{}' docs='{}'",
1219 qualifiedName,namespaceName,className,root->brief,root->doc);
1220
1221 DString tagName;
1222 DString refFileName;
1223 const TagInfo *tagInfo = root->tagInfo();
1224 if (tagInfo)
1225 {
1226 tagName = tagInfo->tagName;
1227 refFileName = tagInfo->fileName;
1228 if (qualifiedName.find("::")!=DString::npos)
1229 // symbols imported via tag files may come without the parent scope,
1230 // so we artificially create it here
1231 {
1232 buildScopeFromQualifiedName(qualifiedName,root->lang,tagInfo);
1233 }
1234 }
1235 std::unique_ptr<ArgumentList> tArgList = getTemplateArgumentsFromName(qualifiedName,root->tArgLists);
1236 // add concept to the list
1238 Doxygen::conceptLinkedMap->add(qualifiedName,
1239 createConceptDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn,
1240 qualifiedName,tagName,refFileName)));
1241 if (cd)
1242 {
1243 AUTO_TRACE_ADD("New concept '{}' #tArgLists={} tagInfo={}",
1244 qualifiedName,root->tArgLists.size(),fmt::ptr(tagInfo));
1245 cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
1246 cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
1247 cd->setLanguage(root->lang);
1248 cd->setId(root->id);
1249 cd->setHidden(root->hidden);
1250 cd->setGroupId(root->mGrpId);
1251 if (tArgList)
1252 {
1253 cd->setTemplateArguments(*tArgList);
1254 }
1255 cd->setInitializer(root->initializer.str());
1256 // file definition containing the class cd
1257 cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
1258 cd->setBodyDef(fd);
1260 cd->setRefItems(root->sli);
1261 cd->setRequirementReferences(root->rqli);
1262 addIncludeFile(cd,fd,root);
1263
1264 // also add namespace to the correct structural context
1265 Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,qualifiedName,nullptr,tagInfo);
1267 {
1269 if (dm)
1270 {
1271 dm->addInnerCompound(cd);
1272 }
1273 cd->setOuterScope(d);
1274 }
1275 for (const auto &ce : root->children())
1276 {
1277 //printf("Concept %s has child %s\n",qPrint(root->name),qPrint(ce->section.to_string()));
1278 if (ce->section.isConceptDocPart())
1279 {
1280 cd->addSectionsToDefinition(ce->anchors);
1281 cd->setRefItems(ce->sli);
1282 cd->setRequirementReferences(ce->rqli);
1283 if (!ce->brief.empty())
1284 {
1285 cd->addDocPart(ce->brief,ce->startLine,ce->startColumn);
1286 //printf(" brief=[[\n%s\n]] line=%d,col=%d\n",qPrint(ce->brief),ce->startLine,ce->startColumn);
1287 }
1288 if (!ce->doc.empty())
1289 {
1290 cd->addDocPart(ce->doc,ce->startLine,ce->startColumn);
1291 //printf(" doc=[[\n%s\n]] line=%d,col=%d\n",qPrint(ce->doc),ce->startLine,ce->startColumn);
1292 }
1293 }
1294 else if (ce->section.isConceptCodePart())
1295 {
1296 cd->addCodePart(ce->initializer.str(),ce->startLine,ce->startColumn);
1297 //printf(" code=[[\n%s\n]] line=%d,col=%d\n",qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
1298 }
1299 }
1300 }
1301 else
1302 {
1303 AUTO_TRACE_ADD("Concept '{}' not added, already exists (as alias)", qualifiedName);
1304 }
1305 }
1306
1307 if (cd)
1308 {
1310 for (const auto &ce : root->children())
1311 {
1312 if (ce->section.isConceptDocPart())
1313 {
1314 cd->addSectionsToDefinition(ce->anchors);
1315 }
1316 }
1317 if (fd)
1318 {
1319 AUTO_TRACE_ADD("Inserting concept '{}' in file '{}' (root->fileName='{}')", cd->name(), fd->name(), root->fileName);
1320 cd->setFileDef(fd);
1321 fd->insertConcept(cd);
1322 }
1323 addConceptToGroups(root,cd);
1325 cd->setRefItems(root->sli);
1326 cd->setRequirementReferences(root->rqli);
1327 }
1328}
virtual void addDocPart(const DString &doc, int lineNr, size_t colNr)=0
virtual void addCodePart(const DString &code, int lineNr, size_t colNr)=0
virtual void setFileDef(FileDef *fd)=0
virtual void setGroupId(int id)=0
virtual void setInitializer(const DString &init)=0
virtual void setTemplateArguments(const ArgumentList &al)=0
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DefType definitionType() const =0
virtual void addInnerCompound(Definition *d)=0
virtual void setOuterScope(Definition *d)=0
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:90
static NamespaceDefMutable * globalScope
Definition doxygen.h:114
TextStream initializer
initial value (for variables)
Definition entry.h:205
const std::vector< std::shared_ptr< Entry > > & children() const
Definition entry.h:146
int mGrpId
member group id
Definition entry.h:228
virtual void insertConcept(ConceptDef *cd)=0
void addConceptToModule(const Entry *root, ConceptDef *cd)
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232
ConceptDefMutable * toConceptDefMutable(Definition *d)
std::unique_ptr< ConceptDef > createConceptDef(const DString &fileName, int startLine, size_t startColumn, const DString &name, const DString &tagRef, const DString &tagFile)
ConceptDefMutable * getConceptMutable(const DString &key)
Definition conceptdef.h:106
DefinitionMutable * toDefinitionMutable(Definition *d)
static Definition * findScopeFromQualifiedName(NamespaceDefMutable *startScope, const DString &n, FileDef *fileScope, const TagInfo *tagInfo)
Definition doxygen.cpp:793
void addConceptToGroups(const Entry *root, ConceptDef *cd)

References ConceptDefMutable::addCodePart(), addConceptToGroups(), ModuleManager::addConceptToModule(), ConceptDefMutable::addDocPart(), addIncludeFile(), DefinitionMutable::addInnerCompound(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, buildScopeFromQualifiedName(), Entry::children(), Doxygen::conceptLinkedMap, createConceptDef(), Definition::definitionType(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, extractNamespaceName(), Entry::fileDef(), Entry::fileName, TagInfo::fileName, DString::find(), findScopeFromQualifiedName(), getConceptMutable(), getTemplateArgumentsFromName(), Doxygen::globalScope, Entry::hidden, Entry::id, Entry::initializer, FileDef::insertConcept(), ModuleManager::instance(), EntryType::isScope(), Entry::lang, leftScopeMatch(), Entry::mGrpId, Definition::name(), Entry::name, DString::npos, Entry::parent(), DString::prepend(), Entry::rqli, Entry::section, DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), ConceptDefMutable::setFileDef(), ConceptDefMutable::setGroupId(), DefinitionMutable::setHidden(), DefinitionMutable::setId(), ConceptDefMutable::setInitializer(), DefinitionMutable::setLanguage(), DefinitionMutable::setOuterScope(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), ConceptDefMutable::setTemplateArguments(), Entry::sli, Entry::startColumn, Entry::startLine, TextStream::str(), Entry::tagInfo(), TagInfo::tagName, Entry::tArgLists, toConceptDefMutable(), toDefinitionMutable(), and Definition::TypeNamespace.

Referenced by buildConceptDocList(), and buildConceptList().

◆ addDefineDoc()

void addDefineDoc ( const Entry * root,
MemberDefMutable * md )
static

Definition at line 9963 of file doxygen.cpp.

9964{
9965 md->setDocumentation(root->doc,root->docFile,root->docLine);
9966 md->setDocsForDefinition(!root->proto);
9967 md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
9968 if (md->inbodyDocumentation().empty())
9969 {
9971 }
9972 if (md->getStartBodyLine()==-1 && root->bodyLine!=-1)
9973 {
9974 md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
9975 md->setBodyDef(root->fileDef());
9976 }
9978 md->setMaxInitLines(root->initLines);
9980 md->setRefItems(root->sli);
9981 md->setRequirementReferences(root->rqli);
9982 md->addQualifiers(root->qualifiers);
9983 if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId);
9984 addMemberToGroups(root,md);
9986}
virtual DString inbodyDocumentation() const =0
virtual int getStartBodyLine() const =0
virtual void setInbodyDocumentation(const DString &d, const DString &docFile, int docLine)=0
bool proto
prototype ?
Definition entry.h:194
int inbodyLine
line number at which the body doc was found
Definition entry.h:216
DString inbodyFile
file in which the body doc was found
Definition entry.h:217
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:215
int initLines
define/variable initializer lines to show
Definition entry.h:191
virtual void setMemberGroupId(int id)=0
virtual void setMaxInitLines(int lines)=0
virtual void setDocsForDefinition(bool b)=0
virtual void addQualifiers(const StringVector &qualifiers)=0
void addMemberToModule(const Entry *root, MemberDef *md)
static void applyMemberOverrideOptions(const Entry *root, MemberDefMutable *md)
Definition doxygen.cpp:2422
void addMemberToGroups(const Entry *root, MemberDef *md)

References addMemberToGroups(), ModuleManager::addMemberToModule(), MemberDefMutable::addQualifiers(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, applyMemberOverrideOptions(), Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::fileDef(), Definition::getStartBodyLine(), Entry::inbodyDocs, Definition::inbodyDocumentation(), Entry::inbodyFile, Entry::inbodyLine, Entry::initLines, ModuleManager::instance(), Entry::mGrpId, Entry::proto, Entry::qualifiers, Entry::rqli, DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setMaxInitLines(), MemberDefMutable::setMemberGroupId(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, and Entry::startLine.

Referenced by findDefineDocumentation().

◆ addEnumDocs()

void addEnumDocs ( const Entry * root,
MemberDefMutable * md )
static

Definition at line 8388 of file doxygen.cpp.

8389{
8390 AUTO_TRACE();
8391 // documentation outside a compound overrides the documentation inside it
8392 {
8393 md->setDocumentation(root->doc,root->docFile,root->docLine);
8394 md->setDocsForDefinition(!root->proto);
8395 }
8396
8397 // brief descriptions inside a compound override the documentation
8398 // outside it
8399 {
8400 md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
8401 }
8402
8403 if (md->inbodyDocumentation().empty() || !root->parent()->name.empty())
8404 {
8406 }
8407
8408 if (root->mGrpId!=-1 && md->getMemberGroupId()==-1)
8409 {
8410 md->setMemberGroupId(root->mGrpId);
8411 }
8412
8414 md->setRefItems(root->sli);
8415 md->setRequirementReferences(root->rqli);
8416
8417 const GroupDef *gd=md->getGroupDef();
8418 if (gd==nullptr && !root->groups.empty()) // member not grouped but out-of-line documentation is
8419 {
8420 addMemberToGroups(root,md);
8421 }
8423}
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:230
A model of a group of symbols.
Definition groupdef.h:48
virtual GroupDef * getGroupDef()=0
virtual int getMemberGroupId() const =0

References addMemberToGroups(), ModuleManager::addMemberToModule(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, AUTO_TRACE, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), MemberDef::getGroupDef(), MemberDef::getMemberGroupId(), Entry::groups, Entry::inbodyDocs, Definition::inbodyDocumentation(), Entry::inbodyFile, Entry::inbodyLine, ModuleManager::instance(), Entry::mGrpId, Entry::name, Entry::parent(), Entry::proto, Entry::rqli, DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setMemberGroupId(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), and Entry::sli.

Referenced by findEnumDocumentation(), and tryAddEnumDocsToGroupMember().

◆ addEnumValuesToEnums()

void addEnumValuesToEnums ( const Entry * root)
static

Definition at line 8140 of file doxygen.cpp.

8141{
8142 if (root->section.isEnum())
8143 // non anonymous enumeration
8144 {
8145 AUTO_TRACE("name={}",root->name);
8146 ClassDefMutable *cd = nullptr;
8147 FileDef *fd = nullptr;
8148 NamespaceDefMutable *nd = nullptr;
8149 MemberNameLinkedMap *mnsd = nullptr;
8150 bool isGlobal = false;
8151 bool isRelated = false;
8152 //printf("Found enum with name '%s' relates=%s\n",qPrint(root->name),qPrint(root->relates));
8153
8154 DString name;
8155 DString scope;
8156
8157 if (size_t i = root->name.rfind("::"); i!=DString::npos) // scope is specified
8158 {
8159 scope=root->name.left(i); // extract scope
8160 if (root->lang==SrcLangExt::CSharp)
8161 {
8162 scope = mangleCSharpGenericName(scope);
8163 }
8164 name=root->name.right(root->name.length()-i-2); // extract name
8165 if ((cd=getClassMutable(scope))==nullptr)
8166 {
8168 }
8169 }
8170 else // no scope, check the scope in which the docs where found
8171 {
8172 if (root->parent()->section.isScope() && !root->parent()->name.empty()) // found enum docs inside a compound
8173 {
8174 scope=root->parent()->name;
8175 if (root->lang==SrcLangExt::CSharp)
8176 {
8177 scope = mangleCSharpGenericName(scope);
8178 }
8179 if ((cd=getClassMutable(scope))==nullptr) nd=getResolvedNamespaceMutable(scope);
8180 }
8181 name=root->name;
8182 }
8183
8184 if (!root->relates.empty())
8185 { // related member, prefix user specified scope
8186 isRelated=true;
8187 if (getClassMutable(root->relates)==nullptr && !scope.empty())
8188 scope=mergeScopes(scope,root->relates);
8189 else
8190 scope=root->relates;
8191 if ((cd=getClassMutable(scope))==nullptr) nd=getResolvedNamespaceMutable(scope);
8192 }
8193
8194 if (cd && !name.empty()) // found a enum inside a compound
8195 {
8196 //printf("Enum in class '%s'::'%s'\n",qPrint(cd->name()),qPrint(name));
8197 fd=nullptr;
8199 isGlobal=false;
8200 }
8201 else if (nd && !nd->isAnonymous()) // found enum inside namespace
8202 {
8203 //printf("Enum in namespace '%s'::'%s'\n",qPrint(nd->name()),qPrint(name));
8205 isGlobal=true;
8206 }
8207 else // found a global enum
8208 {
8209 fd=root->fileDef();
8210 //printf("Enum in file '%s': '%s'\n",qPrint(fd->name()),qPrint(name));
8212 isGlobal=true;
8213 }
8214
8215 if (!name.empty())
8216 {
8217 //printf("** name=%s\n",qPrint(name));
8218 MemberName *mn = mnsd->find(name); // for all members with this name
8219 if (mn)
8220 {
8221 struct EnumValueInfo
8222 {
8223 EnumValueInfo(const DString &n,std::unique_ptr<MemberDef> &&md) :
8224 name(n), member(std::move(md)) {}
8225 DString name;
8226 std::unique_ptr<MemberDef> member;
8227 };
8228 std::vector< EnumValueInfo > extraMembers;
8229 // for each enum in this list
8230 for (const auto &imd : *mn)
8231 {
8232 MemberDefMutable *md = toMemberDefMutable(imd.get());
8233 // use raw pointer in this loop, since we modify mn and can then invalidate mdp.
8234 if (md && md->isEnumerate() && !root->children().empty())
8235 {
8236 AUTO_TRACE_ADD("enum {} with {} children",md->name(),root->children().size());
8237 for (const auto &e : root->children())
8238 {
8239 SrcLangExt sle = root->lang;
8240 bool isJavaLike = sle==SrcLangExt::CSharp || sle==SrcLangExt::Java || sle==SrcLangExt::XML;
8241 if ( isJavaLike || root->spec.isStrong())
8242 {
8243 if (sle == SrcLangExt::Cpp && e->section.isDefine()) continue;
8244 // Unlike classic C/C++ enums, for C++11, C# & Java enum
8245 // values are only visible inside the enum scope, so we must create
8246 // them here and only add them to the enum
8247 //printf("md->qualifiedName()=%s e->name=%s tagInfo=%p name=%s\n",
8248 // qPrint(md->qualifiedName()),qPrint(e->name),(void*)e->tagInfo(),qPrint(e->name));
8249 DString qualifiedName = root->name;
8250 if (size_t i = qualifiedName.rfind("::"); i!=DString::npos && sle==SrcLangExt::CSharp)
8251 {
8252 qualifiedName = mangleCSharpGenericName(qualifiedName.left(i))+qualifiedName.mid(i);
8253 }
8254 if (isJavaLike)
8255 {
8256 qualifiedName=substitute(qualifiedName,"::",".");
8257 }
8258 if (md->qualifiedName()==qualifiedName) // enum value scope matches that of the enum
8259 {
8260 DString fileName = e->fileName;
8261 if (fileName.empty() && e->tagInfo())
8262 {
8263 fileName = e->tagInfo()->tagName;
8264 }
8265 AUTO_TRACE_ADD("strong enum value {}",e->name);
8266 auto fmd = createMemberDef(
8267 fileName,e->startLine,e->startColumn,
8268 e->type,e->name,e->args,DString(),
8269 e->protection, Specifier::Normal,e->isStatic,Relationship::Member,
8270 MemberType::EnumValue,ArgumentList(),ArgumentList(),e->metaData);
8271 auto fmmd = toMemberDefMutable(fmd.get());
8272 NamespaceDef *mnd = md->getNamespaceDef();
8273 if (md->getClassDef())
8274 fmmd->setMemberClass(md->getClassDef());
8275 else if (mnd && (mnd->isLinkable() || mnd->isAnonymous()))
8276 fmmd->setNamespace(mnd);
8277 else if (md->getFileDef())
8278 fmmd->setFileDef(md->getFileDef());
8279 fmmd->setOuterScope(md->getOuterScope());
8280 fmmd->setTagInfo(e->tagInfo());
8281 fmmd->setLanguage(e->lang);
8282 fmmd->setBodySegment(e->startLine,e->bodyLine,e->endBodyLine);
8283 fmmd->setBodyDef(e->fileDef());
8284 fmmd->setId(e->id);
8285 fmmd->setDocumentation(e->doc,e->docFile,e->docLine);
8286 fmmd->setBriefDescription(e->brief,e->briefFile,e->briefLine);
8287 fmmd->addSectionsToDefinition(e->anchors);
8288 fmmd->setInitializer(e->initializer.str());
8289 fmmd->setMaxInitLines(e->initLines);
8290 fmmd->setMemberGroupId(e->mGrpId);
8291 fmmd->setExplicitExternal(e->explicitExternal,fileName,e->startLine,e->startColumn);
8292 fmmd->setRefItems(e->sli);
8293 fmmd->setRequirementReferences(e->rqli);
8294 fmmd->setAnchor();
8295 md->insertEnumField(fmd.get());
8296 fmmd->setEnumScope(md,true);
8297 extraMembers.emplace_back(e->name,std::move(fmd));
8298 }
8299 }
8300 else
8301 {
8302 AUTO_TRACE_ADD("enum value {}",e->name);
8303 //printf("e->name=%s isRelated=%d\n",qPrint(e->name),isRelated);
8304 MemberName *fmn=nullptr;
8305 MemberNameLinkedMap *emnsd = isRelated ? Doxygen::functionNameLinkedMap : mnsd;
8306 if (!e->name.empty() && (fmn=emnsd->find(e->name)))
8307 // get list of members with the same name as the field
8308 {
8309 for (const auto &ifmd : *fmn)
8310 {
8311 MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
8312 if (fmd && fmd->isEnumValue() && fmd->getOuterScope()==md->getOuterScope()) // in same scope
8313 {
8314 //printf("found enum value with same name %s in scope %s\n",
8315 // qPrint(fmd->name()),qPrint(fmd->getOuterScope()->name()));
8316 if (nd && !nd->isAnonymous())
8317 {
8318 if (!fmd->isStrongEnumValue()) // only non strong enum values can be globally added
8319 {
8320 const NamespaceDef *fnd=fmd->getNamespaceDef();
8321 if (fnd==nd) // enum value is inside a namespace
8322 {
8323 md->insertEnumField(fmd);
8324 fmd->setEnumScope(md);
8325 }
8326 }
8327 }
8328 else if (isGlobal)
8329 {
8330 if (!fmd->isStrongEnumValue()) // only non strong enum values can be globally added
8331 {
8332 const FileDef *ffd=fmd->getFileDef();
8333 if (ffd==fd && ffd==md->getFileDef()) // enum value has file scope
8334 {
8335 md->insertEnumField(fmd);
8336 fmd->setEnumScope(md);
8337 }
8338 }
8339 }
8340 else if (isRelated && cd) // reparent enum value to
8341 // match the enum's scope
8342 {
8343 md->insertEnumField(fmd); // add field def to list
8344 fmd->setEnumScope(md); // cross ref with enum name
8345 fmd->setEnumClassScope(cd); // cross ref with enum name
8346 fmd->setOuterScope(cd);
8347 fmd->makeRelated();
8348 cd->insertMember(fmd);
8349 }
8350 else
8351 {
8352 if (!fmd->isStrongEnumValue()) // only non strong enum values can be globally added
8353 {
8354 const ClassDef *fcd=fmd->getClassDef();
8355 if (fcd==cd) // enum value is inside a class
8356 {
8357 //printf("Inserting enum field %s in enum scope %s\n",
8358 // qPrint(fmd->name()),qPrint(md->name()));
8359 md->insertEnumField(fmd); // add field def to list
8360 fmd->setEnumScope(md); // cross ref with enum name
8361 }
8362 }
8363 }
8364 }
8365 }
8366 }
8367 }
8368 }
8369 }
8370 }
8371 // move the newly added members into mn
8372 for (auto &e : extraMembers)
8373 {
8374 MemberName *emn=mnsd->add(e.name);
8375 emn->push_back(std::move(e.member));
8376 }
8377 }
8378 }
8379 }
8380 else
8381 {
8382 for (const auto &e : root->children()) addEnumValuesToEnums(e.get());
8383 }
8384}
This class represents an function or template argument list.
Definition arguments.h:66
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual void insertMember(MemberDef *)=0
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString right(size_t len) const
Definition dstring.h:311
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
virtual bool isLinkable() const =0
virtual bool isAnonymous() const =0
virtual DString qualifiedName() const =0
virtual Definition * getOuterScope() const =0
static MemberNameLinkedMap * functionNameLinkedMap
Definition doxygen.h:105
static MemberNameLinkedMap * memberNameLinkedMap
Definition doxygen.h:104
DString relates
related class (doc block)
Definition entry.h:218
T * add(const char *k, Args &&... args)
Definition linkedmap.h:90
const T * find(const std::string &key) const
Definition linkedmap.h:47
virtual const ClassDef * getClassDef() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isStrongEnumValue() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual bool isEnumerate() const =0
virtual bool isEnumValue() const =0
virtual void setEnumScope(MemberDef *md, bool livesInsideEnum=false)=0
virtual void setEnumClassScope(ClassDef *cd)=0
virtual void insertEnumField(MemberDef *md)=0
virtual void makeRelated()=0
void push_back(Ptr &&p)
Definition membername.h:52
Ordered dictionary of MemberName objects.
Definition membername.h:61
An abstract interface of a namespace symbol.
static void addEnumValuesToEnums(const Entry *root)
Definition doxygen.cpp:8140
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
std::unique_ptr< MemberDef > createMemberDef(const DString &defFileName, int defLine, size_t defColumn, const DString &type, const DString &name, const DString &args, const DString &excp, Protection prot, Specifier virt, bool stat, Relationship related, MemberType t, const ArgumentList &tal, const ArgumentList &al, const DString &metaData)
Factory method to create a new instance of a MemberDef.
MemberDefMutable * toMemberDefMutable(Definition *d)
const char * name(int level)
Definition latexgen.h:368
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)
NamespaceDefMutable * getResolvedNamespaceMutable(const DString &key)
SrcLangExt
Definition types.h:207
DString mergeScopes(const DString &leftScope, const DString &rightScope)
Definition util.cpp:3885

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addEnumValuesToEnums(), AUTO_TRACE, AUTO_TRACE_ADD, buildScopeFromQualifiedName(), Entry::children(), createMemberDef(), DString::empty(), Entry::fileDef(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, MemberDef::getClassDef(), getClassMutable(), MemberDef::getFileDef(), MemberDef::getNamespaceDef(), Definition::getOuterScope(), getResolvedNamespaceMutable(), MemberDefMutable::insertEnumField(), ClassDefMutable::insertMember(), Definition::isAnonymous(), MemberDef::isEnumerate(), MemberDef::isEnumValue(), Definition::isLinkable(), EntryType::isScope(), MemberDef::isStrongEnumValue(), Entry::lang, DString::left(), DString::length(), MemberDefMutable::makeRelated(), mangleCSharpGenericName(), Doxygen::memberNameLinkedMap, mergeScopes(), DString::mid(), Definition::name(), Entry::name, DString::npos, Entry::parent(), MemberName::push_back(), Definition::qualifiedName(), Entry::relates, DString::rfind(), DString::right(), Entry::section, MemberDefMutable::setEnumClassScope(), MemberDefMutable::setEnumScope(), DefinitionMutable::setOuterScope(), Entry::spec, substitute(), Entry::tagInfo(), toMemberDefMutable(), and toNamespaceDefMutable().

Referenced by addEnumValuesToEnums(), and parseInput().

◆ addGlobalFunction()

void addGlobalFunction ( const Entry * root,
const DString & rname,
const DString & sc )
static

Definition at line 4088 of file doxygen.cpp.

4089{
4090 DString scope = sc;
4091
4092 // new global function
4094 auto md = createMemberDef(
4095 root->fileName,root->startLine,root->startColumn,
4096 root->type,name,root->args,root->exception,
4097 root->protection,root->virt,root->isStatic,Relationship::Member,
4098 MemberType::Function,
4099 !root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(),
4100 root->argList,root->metaData);
4101 auto mmd = toMemberDefMutable(md.get());
4102 mmd->setTagInfo(root->tagInfo());
4103 mmd->setLanguage(root->lang);
4104 mmd->setId(root->id);
4105 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
4106 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
4107 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
4108 mmd->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
4109 mmd->setDocsForDefinition(!root->proto);
4110 mmd->setTypeConstraints(root->typeConstr);
4111 //md->setBody(root->body);
4112 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
4113 FileDef *fd=root->fileDef();
4114 mmd->setBodyDef(fd);
4115 mmd->addSectionsToDefinition(root->anchors);
4116 mmd->setMemberSpecifiers(root->spec);
4117 mmd->setVhdlSpecifiers(root->vhdlSpec);
4118 mmd->setMemberGroupId(root->mGrpId);
4119 mmd->setRequiresClause(root->req);
4120 mmd->setExplicitExternal(root->explicitExternal,root->fileName,root->startLine,root->startColumn);
4121 addIncludeFile(mmd,fd,root);
4122
4123 NamespaceDefMutable *nd = nullptr;
4124 // see if the function is inside a namespace that was not part of
4125 // the name already (in that case nd should be non-zero already)
4126 if (root->parent()->section.isNamespace())
4127 {
4128 //DString nscope=removeAnonymousScopes(root->parent()->name);
4129 DString nscope=root->parent()->name;
4130 if (!nscope.empty())
4131 {
4132 nd = getResolvedNamespaceMutable(nscope);
4133 }
4134 }
4135 else if (root->parent()->section.isGroupDoc() && !scope.empty())
4136 {
4138 }
4139
4140 if (!scope.empty())
4141 {
4143 if (sep!="::")
4144 {
4145 scope = substitute(scope,"::",sep);
4146 }
4147 scope+=sep;
4148 }
4149
4150 if (Config_getBool(HIDE_SCOPE_NAMES) || root->lang==SrcLangExt::Python) scope = "";
4151 DString def;
4152 //DString optArgs = root->argList.empty() ? DString() : root->args;
4153 if (!root->type.empty())
4154 {
4155 def=root->type+" "+scope+name; //+optArgs;
4156 }
4157 else
4158 {
4159 def=scope+name; //+optArgs;
4160 }
4161 AUTO_TRACE("new non-member function type='{}' scope='{}' name='{}' args='{}' proto={} def='{}'",
4162 root->type,scope,rname,root->args,root->proto,def);
4163 mmd->setDefinition(def);
4165 mmd->addQualifiers(root->qualifiers);
4166
4167 mmd->setRefItems(root->sli);
4168 mmd->setRequirementReferences(root->rqli);
4169 if (nd && !nd->name().empty() && nd->name().at(0)!='@')
4170 {
4171 // add member to namespace
4172 mmd->setNamespace(nd);
4173 nd->insertMember(md.get());
4174 }
4175 if (fd)
4176 {
4177 // add member to the file (we do this even if we have already
4178 // inserted it into the namespace)
4179 mmd->setFileDef(fd);
4180 fd->insertMember(md.get());
4181 }
4182
4183 addMemberToGroups(root,md.get());
4185 if (root->relatesType == RelatesType::Simple) // if this is a relatesalso command,
4186 // allow find Member to pick it up
4187 {
4188 root->markAsProcessed(); // Otherwise we have finished with this entry.
4189 }
4190
4191 // add member to the list of file members
4193 mn->push_back(std::move(md));
4194}
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:190
void markAsProcessed() const
Definition entry.h:174
bool explicitExternal
explicitly defined as external?
Definition entry.h:193
RelatesType relatesType
how relates is handled
Definition entry.h:219
ArgumentList argList
member arguments as a list
Definition entry.h:202
DString type
member type
Definition entry.h:180
DString exception
throw specification
Definition entry.h:223
Specifier virt
virtualness of the entry
Definition entry.h:198
virtual void insertMember(MemberDef *md)=0
virtual void insertMember(MemberDef *md)=0
#define Config_getBool(name)
Definition config.h:33
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:427
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition util.cpp:4765

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, Entry::args, DString::at(), AUTO_TRACE, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::exception, Entry::explicitExternal, Entry::fileDef(), Entry::fileName, Doxygen::functionNameLinkedMap, getLanguageSpecificSeparator(), getResolvedNamespaceMutable(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, FileDef::insertMember(), NamespaceDefMutable::insertMember(), ModuleManager::instance(), Entry::isStatic, Entry::lang, Entry::markAsProcessed(), Entry::metaData, Entry::mGrpId, Definition::name(), Entry::name, Entry::parent(), Entry::protection, Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::relatesType, removeRedundantWhiteSpace(), Entry::req, Entry::rqli, Entry::section, DefinitionMutable::setBodyDef(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, substitute(), Entry::tagInfo(), Entry::tArgLists, toMemberDefMutable(), Entry::type, Entry::typeConstr, Entry::vhdlSpec, and Entry::virt.

Referenced by buildFunctionList().

◆ addIncludeFile()

template<class Def>
void addIncludeFile ( Def * def,
FileDef * ifd,
const Entry * root )
static

Definition at line 311 of file doxygen.cpp.

312{
313 AUTO_TRACE();
314 if (
315 (!root->doc.stripWhiteSpace().empty() ||
316 !root->brief.stripWhiteSpace().empty() ||
317 Config_getBool(EXTRACT_ALL)
318 ) && root->protection!=Protection::Private
319 )
320 {
321 AUTO_TRACE_ADD("includefile={}",root->includeFile);
322 //printf(">>>>>> includeFile=%s\n",qPrint(root->includeFile));
323
324 bool local=Config_getBool(FORCE_LOCAL_INCLUDES);
325 DString includeFile = root->includeFile;
326 if (!includeFile.empty() && includeFile.at(0)=='"')
327 {
328 local = true;
329 includeFile=includeFile.mid(1,includeFile.length()-2);
330 }
331 else if (!includeFile.empty() && includeFile.at(0)=='<')
332 {
333 local = false;
334 includeFile=includeFile.mid(1,includeFile.length()-2);
335 }
336
337 bool ambig = false;
338 FileDef *fd=nullptr;
339 // see if we need to include a verbatim copy of the header file
340 //printf("root->includeFile=%s\n",qPrint(root->includeFile));
341 if (!includeFile.empty() &&
342 (fd=Doxygen::inputNameLinkedMap->findFileDef(includeFile,ambig))==nullptr
343 )
344 { // explicit request
345 DString text;
346 text.sprintf("the name '%s' supplied as "
347 "the argument of the \\class, \\struct, \\record, \\union, or \\headerfile command ",
348 qPrint(includeFile)
349 );
350 if (ambig) // name is ambiguous
351 {
352 text+="matches the following input files:\n";
354 text+="\n";
355 text+="Please use a more specific name by "
356 "including a (larger) part of the path!";
357 }
358 else // name is not an input file
359 {
360 text+="is not an input file";
361 }
362 warn(root->fileName,root->startLine, "{}", text);
363 }
364 else if (includeFile.empty() && ifd &&
365 // see if the file extension makes sense
366 EntryType::guessSection(ifd->name()).isHeader())
367 { // implicit assumption
368 fd=ifd;
369 }
370
371 // if a file is found, we mark it as a source file.
372 if (fd)
373 {
374 DString iName = !root->includeName.empty() ?
375 root->includeName : includeFile;
376 if (!iName.empty()) // user specified include file
377 {
378 if (iName.at(0)=='<') local=false; // explicit override
379 else if (iName.at(0)=='"') local=true;
380 if (iName.at(0)=='"' || iName.at(0)=='<')
381 {
382 iName=iName.mid(1,iName.length()-2); // strip quotes or brackets
383 }
384 if (iName.empty())
385 {
386 iName=fd->name();
387 }
388 }
389 else if (!Config_getList(STRIP_FROM_INC_PATH).empty())
390 {
392 }
393 else // use name of the file containing the class definition
394 {
395 iName=fd->name();
396 }
397 AUTO_TRACE_ADD("iName={}",iName);
398 if (fd->generateSourceFile()) // generate code for header
399 {
400 def->setIncludeFile(fd,iName,local,!root->includeName.empty());
401 }
402 else // put #include in the class documentation without link
403 {
404 def->setIncludeFile(nullptr,iName,local,true);
405 }
406 }
407 }
408}
DString & sprintf(const char *format,...)
Definition dstring.cpp:34
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:97
DString includeName
include name (3 arg of \class)
Definition entry.h:207
DString includeFile
include file (2 arg of \class, must be unique)
Definition entry.h:206
static EntryType guessSection(const DString &name)
Definition types.cpp:22
virtual bool generateSourceFile() const =0
virtual DString absFilePath() const =0
DString showFileDefMatches(const DString &n) const
Returns a list of file definitions in fnMap that match the file name n.
Definition filename.cpp:131
FileDef * findFileDef(const DString &n, bool &ambig) const
Returns the file definition in fnMap that matches the file name n.
Definition filename.cpp:38
#define Config_getList(name)
Definition config.h:38
const char * qPrint(const char *s)
Definition dstring.h:783
#define warn(file, line, fmt,...)
Definition message.h:97
DString stripFromIncludePath(const DString &path)
Definition util.cpp:227

References FileDef::absFilePath(), DString::at(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::brief, Config_getBool, Config_getList, Entry::doc, DString::empty(), Entry::fileName, FileNameLinkedMap::findFileDef(), FileDef::generateSourceFile(), EntryType::guessSection(), Entry::includeFile, Entry::includeName, Doxygen::inputNameLinkedMap, DString::length(), DString::mid(), Definition::name(), Entry::protection, qPrint(), FileNameLinkedMap::showFileDefMatches(), DString::sprintf(), Entry::startLine, stripFromIncludePath(), DString::stripWhiteSpace(), and warn.

Referenced by addClassToContext(), addConceptToContext(), addGlobalFunction(), addInterfaceOrServiceToServiceOrSingleton(), addLocalObjCMethod(), addMemberDocs(), addMemberSpecialization(), addMethodToClass(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildFileList(), buildGroupListFiltered(), buildNamespaceList(), findEnums(), and findMember().

◆ addInterfaceOrServiceToServiceOrSingleton()

void addInterfaceOrServiceToServiceOrSingleton ( const Entry * root,
ClassDefMutable * cd,
DString const & rname )
static

Definition at line 3835 of file doxygen.cpp.

3839{
3840 FileDef *fd = root->fileDef();
3841 enum MemberType type = root->section.isExportedInterface() ? MemberType::Interface : MemberType::Service;
3842 DString fileName = root->fileName;
3843 if (fileName.empty() && root->tagInfo())
3844 {
3845 fileName = root->tagInfo()->tagName;
3846 }
3847 auto md = createMemberDef(
3848 fileName, root->startLine, root->startColumn, root->type, rname,
3849 "", "", root->protection, root->virt, root->isStatic, Relationship::Member,
3850 type, ArgumentList(), root->argList, root->metaData);
3851 auto mmd = toMemberDefMutable(md.get());
3852 mmd->setTagInfo(root->tagInfo());
3853 mmd->setMemberClass(cd);
3854 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
3855 mmd->setDocsForDefinition(false);
3856 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
3857 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
3858 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
3859 mmd->setMemberSpecifiers(root->spec);
3860 mmd->setVhdlSpecifiers(root->vhdlSpec);
3861 mmd->setMemberGroupId(root->mGrpId);
3862 mmd->setTypeConstraints(root->typeConstr);
3863 mmd->setLanguage(root->lang);
3864 mmd->setBodyDef(fd);
3865 mmd->setFileDef(fd);
3866 mmd->addSectionsToDefinition(root->anchors);
3867 DString const def = root->type + " " + rname;
3868 mmd->setDefinition(def);
3870 mmd->addQualifiers(root->qualifiers);
3871 addIncludeFile(mmd,fd,root);
3872
3873 AUTO_TRACE("Interface member: fileName='{}' type='{}' name='{}' mtype='{}' prot={} virt={} state={} proto={} def='{}'",
3874 fileName,root->type,rname,type,root->protection,root->virt,root->isStatic,root->proto,def);
3875
3876 // add member to the class cd
3877 cd->insertMember(md.get());
3878 // also add the member as a "base" (to get nicer diagrams)
3879 // "optional" interface/service get Protected which turns into dashed line
3880 BaseInfo base(rname,
3881 root->spec.isOptional() ? Protection::Protected : Protection::Public, Specifier::Normal);
3882 TemplateNameMap templateNames;
3883 findClassRelation(root,cd,cd,&base,templateNames,DocumentedOnly,true) ||
3884 findClassRelation(root,cd,cd,&base,templateNames,Undocumented,true);
3885 // add file to list of used files
3886 cd->insertUsedFile(fd);
3887
3888 addMemberToGroups(root,md.get());
3890 root->markAsProcessed();
3891 mmd->setRefItems(root->sli);
3892 mmd->setRequirementReferences(root->rqli);
3893
3894 // add member to the global list of all members
3896 mn->push_back(std::move(md));
3897}
std::map< std::string, int > TemplateNameMap
Definition classdef.h:89
static bool findClassRelation(const Entry *root, Definition *context, ClassDefMutable *cd, const BaseInfo *bi, const TemplateNameMap &templateNames, FindBaseClassRelation_Mode mode, bool isArtificial)
Definition doxygen.cpp:5158
This class stores information about an inheritance relation.
Definition entry.h:96
MemberType
Definition types.h:571

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, AUTO_TRACE, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DocumentedOnly, DString::empty(), Entry::endBodyLine, Entry::fileDef(), Entry::fileName, findClassRelation(), Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), Entry::isStatic, Entry::lang, Entry::markAsProcessed(), Doxygen::memberNameLinkedMap, Entry::metaData, Entry::mGrpId, Entry::protection, Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::rqli, Entry::section, Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, Entry::tagInfo(), TagInfo::tagName, toMemberDefMutable(), Entry::type, Entry::typeConstr, Undocumented, Entry::vhdlSpec, and Entry::virt.

Referenced by buildInterfaceAndServiceList().

◆ addListReferences()

void addListReferences ( )
static

Definition at line 5821 of file doxygen.cpp.

5822{
5823 AUTO_TRACE();
5824 applyToAllDefinitions([](auto* obj) { obj->addListReferences(); });
5825}
static void applyToAllDefinitions(Func func)
Definition doxygen.cpp:5756

References applyToAllDefinitions(), and AUTO_TRACE.

Referenced by parseInput().

◆ addLocalObjCMethod()

void addLocalObjCMethod ( const Entry * root,
const DString & scopeName,
const DString & funcType,
const DString & funcName,
const DString & funcArgs,
const DString & exceptions,
const DString & funcDecl,
TypeSpecifier spec )
static

Definition at line 6401 of file doxygen.cpp.

6406{
6407 AUTO_TRACE();
6408 //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className));
6409 ClassDefMutable *cd=nullptr;
6410 if (Config_getBool(EXTRACT_LOCAL_METHODS) && (cd=getClassMutable(scopeName)))
6411 {
6412 AUTO_TRACE_ADD("Local objective C method '{}' scopeName='{}'",root->name,scopeName);
6413 auto md = createMemberDef(
6414 root->fileName,root->startLine,root->startColumn,
6415 funcType,funcName,funcArgs,exceptions,
6416 root->protection,root->virt,root->isStatic,Relationship::Member,
6417 MemberType::Function,ArgumentList(),root->argList,root->metaData);
6418 auto mmd = toMemberDefMutable(md.get());
6419 mmd->setTagInfo(root->tagInfo());
6420 mmd->setLanguage(root->lang);
6421 mmd->setId(root->id);
6422 mmd->makeImplementationDetail();
6423 mmd->setMemberClass(cd);
6424 mmd->setDefinition(funcDecl);
6426 mmd->addQualifiers(root->qualifiers);
6427 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
6428 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
6429 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
6430 mmd->setDocsForDefinition(!root->proto);
6431 mmd->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
6432 mmd->addSectionsToDefinition(root->anchors);
6433 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
6434 FileDef *fd=root->fileDef();
6435 mmd->setBodyDef(fd);
6436 mmd->setMemberSpecifiers(spec);
6437 mmd->setVhdlSpecifiers(root->vhdlSpec);
6438 mmd->setMemberGroupId(root->mGrpId);
6439 cd->insertMember(md.get());
6440 cd->insertUsedFile(fd);
6441 mmd->setRefItems(root->sli);
6442 mmd->setRequirementReferences(root->rqli);
6443 addIncludeFile(mmd,fd,root);
6444
6446 mn->push_back(std::move(md));
6447 }
6448 else
6449 {
6450 // local objective C method found for class without interface
6451 }
6452}

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, Entry::endBodyLine, Entry::fileDef(), Entry::fileName, getClassMutable(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), Entry::isStatic, Entry::lang, Doxygen::memberNameLinkedMap, Entry::metaData, Entry::mGrpId, Entry::name, Entry::protection, Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::rqli, DefinitionMutable::setBodyDef(), Entry::sli, Entry::startColumn, Entry::startLine, Entry::tagInfo(), toMemberDefMutable(), Entry::vhdlSpec, and Entry::virt.

Referenced by addMemberFunction(), and findMember().

◆ addMemberDocs()

void addMemberDocs ( const Entry * root,
MemberDefMutable * md,
const DString & funcDecl,
const ArgumentList * al,
bool over_load,
TypeSpecifier spec )
static

Definition at line 5844 of file doxygen.cpp.

5850{
5851 if (md==nullptr) return;
5852 AUTO_TRACE("scope='{}' name='{}' args='{}' funcDecl='{}' mSpec={}",
5853 root->parent()->name,md->name(),md->argsString(),funcDecl,spec);
5854 if (!root->section.isDoc()) // @fn or @var does not need to specify the complete definition, so don't overwrite it
5855 {
5856 DString fDecl=funcDecl;
5857 // strip extern specifier
5858 fDecl.stripPrefix("extern ");
5859 md->setDefinition(fDecl);
5860 }
5862 md->addQualifiers(root->qualifiers);
5864 const NamespaceDef *nd=md->getNamespaceDef();
5865 DString fullName;
5866 if (cd)
5867 fullName = cd->name();
5868 else if (nd)
5869 fullName = nd->name();
5870
5871 if (!fullName.empty()) fullName+="::";
5872 fullName+=md->name();
5873 FileDef *rfd=root->fileDef();
5874
5875 // TODO determine scope based on root not md
5876 Definition *rscope = md->getOuterScope();
5877
5878 const ArgumentList &mdAl = md->argumentList();
5879 if (al)
5880 {
5881 ArgumentList mergedAl = *al;
5882 //printf("merging arguments (1) docs=%d\n",root->doc.empty());
5883 mergeArguments(const_cast<ArgumentList&>(mdAl),mergedAl,!root->doc.empty());
5884 }
5885 else
5886 {
5887 if (
5888 matchArguments2( md->getOuterScope(), md->getFileDef(),md->typeString(),const_cast<ArgumentList*>(&mdAl),
5889 rscope,rfd,root->type,&root->argList,
5890 true, root->lang
5891 )
5892 )
5893 {
5894 //printf("merging arguments (2)\n");
5895 ArgumentList mergedArgList = root->argList;
5896 mergeArguments(const_cast<ArgumentList&>(mdAl),mergedArgList,!root->doc.empty());
5897 }
5898 }
5899 if (over_load) // the \overload keyword was used
5900 {
5902 if (!root->doc.empty())
5903 {
5904 doc+="<p>";
5905 doc+=root->doc;
5906 }
5907 md->setDocumentation(doc,root->docFile,root->docLine);
5909 md->setDocsForDefinition(!root->proto);
5910 }
5911 else
5912 {
5913 //printf("overwrite!\n");
5914 md->setDocumentation(root->doc,root->docFile,root->docLine);
5915 md->setDocsForDefinition(!root->proto);
5916
5917 //printf("overwrite!\n");
5918 md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
5919
5920 if (
5921 (md->inbodyDocumentation().empty() ||
5922 !root->parent()->name.empty()
5923 ) && !root->inbodyDocs.empty()
5924 )
5925 {
5927 }
5928 }
5929
5930 //printf("initializer: '%s'(isEmpty=%d) '%s'(isEmpty=%d)\n",
5931 // qPrint(md->initializer()),md->initializer().empty(),
5932 // qPrint(root->initializer),root->initializer.empty()
5933 // );
5934 std::string rootInit = root->initializer.str();
5935 if (md->initializer().empty() && !rootInit.empty())
5936 {
5937 //printf("setInitializer\n");
5938 md->setInitializer(rootInit);
5939 }
5940 if (md->requiresClause().empty() && !root->req.empty())
5941 {
5942 md->setRequiresClause(root->req);
5943 }
5944
5945 md->setMaxInitLines(root->initLines);
5946
5947 if (rfd)
5948 {
5949 if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1)
5950 )
5951 {
5952 //printf("Setting new body segment [%d,%d]\n",root->bodyLine,root->endBodyLine);
5953 md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
5954 md->setBodyDef(rfd);
5955 }
5956
5957 md->setRefItems(root->sli);
5958 md->setRequirementReferences(root->rqli);
5959 }
5960
5962 md->addQualifiers(root->qualifiers);
5963
5964 md->mergeMemberSpecifiers(spec);
5966 addMemberToGroups(root,md);
5967 addIncludeFile(md,rfd,root);
5969 if (cd) cd->insertUsedFile(rfd);
5970 //printf("root->mGrpId=%d\n",root->mGrpId);
5971 if (root->mGrpId!=-1)
5972 {
5973 if (md->getMemberGroupId()!=-1)
5974 {
5975 if (md->getMemberGroupId()!=root->mGrpId)
5976 {
5977 warn(root->fileName,root->startLine,
5978 "member {} belongs to two different groups. The second one found here will be ignored.",
5979 md->name()
5980 );
5981 }
5982 }
5983 else // set group id
5984 {
5985 //printf("setMemberGroupId=%d md=%s\n",root->mGrpId,qPrint(md->name()));
5986 md->setMemberGroupId(root->mGrpId);
5987 }
5988 }
5989 md->addQualifiers(root->qualifiers);
5990}
bool stripPrefix(const DString &prefix)
Definition dstring.h:290
constexpr bool isDoc() const noexcept
Definition types.h:871
virtual DString requiresClause() const =0
virtual DString argsString() const =0
virtual const DString & initializer() const =0
virtual const ArgumentList & argumentList() const =0
virtual DString typeString() const =0
virtual void setRequiresClause(const DString &req)=0
virtual void setDefinition(const DString &d)=0
virtual ClassDefMutable * getClassDefMutable()=0
virtual void setInitializer(const DString &i)=0
virtual void mergeMemberSpecifiers(TypeSpecifier s)=0
virtual DString trOverloadText()=0
Translator * theTranslator
Definition language.cpp:76
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const DString &srcReturnType, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const DString &dstReturnType, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang, bool allowUnresolved)
Definition util.cpp:1649
void mergeArguments(ArgumentList &srcAl, ArgumentList &dstAl, bool forceNameOverwrite)
Definition util.cpp:1749

References addIncludeFile(), addMemberToGroups(), ModuleManager::addMemberToModule(), MemberDefMutable::addQualifiers(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, MemberDef::argsString(), MemberDef::argumentList(), AUTO_TRACE, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::fileDef(), Entry::fileName, MemberDefMutable::getClassDefMutable(), MemberDef::getFileDef(), MemberDef::getMemberGroupId(), MemberDef::getNamespaceDef(), Definition::getOuterScope(), Definition::getStartBodyLine(), Entry::inbodyDocs, Definition::inbodyDocumentation(), Entry::inbodyFile, Entry::inbodyLine, Entry::initializer, MemberDef::initializer(), Entry::initLines, ClassDefMutable::insertUsedFile(), ModuleManager::instance(), EntryType::isDoc(), Entry::lang, matchArguments2(), mergeArguments(), MemberDefMutable::mergeMemberSpecifiers(), Entry::mGrpId, Definition::name(), Entry::name, Entry::parent(), Entry::proto, Entry::qualifiers, Entry::req, MemberDef::requiresClause(), Entry::rqli, Entry::section, DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDefinition(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setInitializer(), MemberDefMutable::setMaxInitLines(), MemberDefMutable::setMemberGroupId(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), MemberDefMutable::setRequiresClause(), Entry::sli, Entry::startLine, TextStream::str(), DString::stripPrefix(), theTranslator, Translator::trOverloadText(), Entry::type, MemberDef::typeString(), and warn.

Referenced by addMemberFunction(), addVariableToClass(), addVariableToFile(), findGlobalMember(), and findMember().

◆ addMemberFunction()

void addMemberFunction ( const Entry * root,
MemberName * mn,
const DString & scopeName,
const DString & namespaceName,
const DString & className,
const DString & funcTyp,
const DString & funcName,
const DString & funcArgs,
const DString & funcTempList,
const DString & exceptions,
const DString & type,
const DString & args,
bool isFriend,
TypeSpecifier spec,
const DString & relates,
const DString & funcDecl,
bool overloaded,
bool isFunc )
static

Definition at line 6456 of file doxygen.cpp.

6474{
6475 AUTO_TRACE();
6476 DString funcType = funcTyp;
6477 int count=0;
6478 int noMatchCount=0;
6479 bool memFound=false;
6480 for (const auto &imd : *mn)
6481 {
6482 MemberDefMutable *md = toMemberDefMutable(imd.get());
6483 if (md==nullptr) continue;
6485 if (cd==nullptr) continue;
6486 //AUTO_TRACE_ADD("member definition found, scope needed='{}' scope='{}' args='{}' fileName='{}'",
6487 // scopeName, cd->name(), md->argsString(), root->fileName);
6488 FileDef *fd=root->fileDef();
6489 NamespaceDef *nd=nullptr;
6490 if (!namespaceName.empty()) nd=getResolvedNamespace(namespaceName);
6491
6492 //printf("scopeName %s->%s\n",qPrint(scopeName),
6493 // qPrint(stripTemplateSpecifiersFromScope(scopeName,false)));
6494
6495 // if the member we are searching for is an enum value that is part of
6496 // a "strong" enum, we need to look into the fields of the enum for a match
6497 size_t enumNamePos=0;
6498 if (md->isEnumValue() && (enumNamePos=className.rfind("::"))!=DString::npos)
6499 {
6500 DString enumName = className.mid(enumNamePos+2);
6501 DString fullScope = className.left(enumNamePos);
6502 if (!namespaceName.empty()) fullScope.prepend(namespaceName+"::");
6503 if (fullScope==cd->name())
6504 {
6505 MemberName *enumMn=Doxygen::memberNameLinkedMap->find(enumName);
6506 //printf("enumMn(%s)=%p\n",qPrint(className),(void*)enumMn);
6507 if (enumMn)
6508 {
6509 for (const auto &emd : *enumMn)
6510 {
6511 memFound = emd->isStrong() && md->getEnumScope()==emd.get();
6512 if (memFound)
6513 {
6514 addMemberDocs(root,md,funcDecl,nullptr,overloaded,spec);
6515 count++;
6516 }
6517 if (memFound) break;
6518 }
6519 }
6520 }
6521 }
6522 if (memFound) break;
6523
6524 const ClassDef *tcd=findClassDefinition(fd,nd,scopeName);
6525 if (tcd==nullptr && cd && stripAnonymousNamespaceScope(cd->name())==scopeName)
6526 {
6527 // don't be fooled by anonymous scopes
6528 tcd=cd;
6529 }
6530 //printf("Looking for %s inside nd=%s result=%s cd=%s\n",
6531 // qPrint(scopeName),nd?qPrint(nd->name()):"<none>",tcd?qPrint(tcd->name()):"",qPrint(cd->name()));
6532
6533 if (cd && tcd==cd) // member's classes match
6534 {
6535 AUTO_TRACE_ADD("class definition '{}' found",cd->name());
6536
6537 // get the template parameter lists found at the member declaration
6538 ArgumentLists declTemplArgs = cd->getTemplateParameterLists();
6539 const ArgumentList &templAl = md->templateArguments();
6540 if (!templAl.empty())
6541 {
6542 declTemplArgs.push_back(templAl);
6543 }
6544
6545 // get the template parameter lists found at the member definition
6546 const ArgumentLists &defTemplArgs = root->tArgLists;
6547 //printf("defTemplArgs=%p\n",defTemplArgs);
6548
6549 // do we replace the decl argument lists with the def argument lists?
6550 bool substDone=false;
6551 ArgumentList argList;
6552
6553 /* substitute the occurrences of class template names in the
6554 * argument list before matching
6555 */
6556 const ArgumentList &mdAl = md->argumentList();
6557 if (declTemplArgs.size()>0 && declTemplArgs.size()==defTemplArgs.size())
6558 {
6559 /* the function definition has template arguments
6560 * and the class definition also has template arguments, so
6561 * we must substitute the template names of the class by that
6562 * of the function definition before matching.
6563 */
6564 substituteTemplatesInArgList(declTemplArgs,defTemplArgs,mdAl,argList);
6565
6566 substDone=true;
6567 }
6568 else /* no template arguments, compare argument lists directly */
6569 {
6570 argList = mdAl;
6571 }
6572
6573 bool matching=
6574 md->isVariable() || md->isTypedef() || // needed for function pointers
6576 md->getClassDef(),md->getFileDef(),md->typeString(),&argList,
6577 cd,fd,root->type,&root->argList,
6578 true,root->lang);
6579
6580 AUTO_TRACE_ADD("matching '{}'<=>'{}' className='{}' namespaceName='{}' result={}",
6581 argListToString(argList,true),argListToString(root->argList,true),className,namespaceName,matching);
6582
6583 if (md->getLanguage()==SrcLangExt::ObjC && md->isVariable() && root->section.isFunction())
6584 {
6585 matching = false; // don't match methods and attributes with the same name
6586 }
6587
6588 // for template member we also need to check the return type
6589 if (!md->templateArguments().empty() && !root->tArgLists.empty())
6590 {
6591 DString memType = md->typeString();
6592 memType.stripPrefix("static "); // see bug700696
6593 // a member defined outside its namespace may use the namespace-qualified
6594 // name for its return type ("N::C" instead of "C"), while the in-class
6595 // declaration uses the unqualified name, so strip the leading namespace
6596 // before comparing the return types, see issue #12379
6597 funcType=substitute(stripTemplateSpecifiersFromScope(funcType,true),
6598 className+"::",""); // see bug700693 & bug732594
6599 memType=substitute(stripTemplateSpecifiersFromScope(memType,true),
6600 className+"::",""); // see bug758900
6601 if (!namespaceName.empty())
6602 {
6603 funcType.stripPrefix(namespaceName+"::");
6604 memType.stripPrefix(namespaceName+"::");
6605 }
6606 if (memType=="auto" && !argList.trailingReturnType().empty())
6607 {
6608 memType = argList.trailingReturnType();
6609 memType.stripPrefix(" -> ");
6610 }
6611 if (funcType=="auto" && !root->argList.trailingReturnType().empty())
6612 {
6613 funcType = root->argList.trailingReturnType();
6614 funcType.stripPrefix(" -> ");
6616 substDone=true;
6617 }
6618 AUTO_TRACE_ADD("Comparing return types '{}'<->'{}' #args {}<->{}",
6619 memType,funcType,md->templateArguments().size(),root->tArgLists.back().size());
6620 if (md->templateArguments().size()!=root->tArgLists.back().size() || memType!=funcType)
6621 {
6622 //printf(" ---> no matching\n");
6623 matching = false;
6624 }
6625 }
6626 else if (defTemplArgs.size()>declTemplArgs.size())
6627 {
6628 AUTO_TRACE_ADD("Different number of template arguments {} vs {}",defTemplArgs.size(),declTemplArgs.size());
6629 // avoid matching a non-template function in a template class against a
6630 // template function with the same name and parameters, see issue #10184
6631 substDone = false;
6632 matching = false;
6633 }
6634 bool rootIsUserDoc = root->section.isMemberDoc();
6635 bool classIsTemplate = scopeIsTemplate(md->getClassDef());
6636 bool mdIsTemplate = md->templateArguments().hasParameters();
6637 bool classOrMdIsTemplate = mdIsTemplate || classIsTemplate;
6638 bool rootIsTemplate = !root->tArgLists.empty();
6639 //printf("classIsTemplate=%d mdIsTemplate=%d rootIsTemplate=%d\n",classIsTemplate,mdIsTemplate,rootIsTemplate);
6640 if (!rootIsUserDoc && // don't check out-of-line @fn references, see bug722457
6641 (mdIsTemplate || rootIsTemplate) && // either md or root is a template
6642 ((classOrMdIsTemplate && !rootIsTemplate) || (!classOrMdIsTemplate && rootIsTemplate))
6643 )
6644 {
6645 // Method with template return type does not match method without return type
6646 // even if the parameters are the same. See also bug709052
6647 AUTO_TRACE_ADD("Comparing return types: template v.s. non-template");
6648 matching = false;
6649 }
6650
6651 AUTO_TRACE_ADD("Match results of matchArguments2='{}' substDone='{}'",matching,substDone);
6652
6653 if (substDone) // found a new argument list
6654 {
6655 if (matching) // replace member's argument list
6656 {
6658 md->moveArgumentList(std::make_unique<ArgumentList>(argList));
6659 }
6660 else // no match
6661 {
6662 if (!funcTempList.empty() &&
6663 isSpecialization(declTemplArgs,defTemplArgs))
6664 {
6665 // check if we are dealing with a partial template
6666 // specialization. In this case we add it to the class
6667 // even though the member arguments do not match.
6668
6669 addMethodToClass(root,cd,type,md->name(),args,isFriend,
6670 md->protection(),md->isStatic(),md->virtualness(),spec,relates);
6671 return;
6672 }
6673 }
6674 }
6675 if (matching)
6676 {
6677 addMemberDocs(root,md,funcDecl,nullptr,overloaded,spec);
6678 count++;
6679 memFound=true;
6680 }
6681 }
6682 else if (cd && cd!=tcd) // we did find a class with the same name as cd
6683 // but in a different namespace
6684 {
6685 noMatchCount++;
6686 }
6687
6688 if (memFound) break;
6689 }
6690 if (count==0 && root->parent() && root->parent()->section.isObjcImpl())
6691 {
6692 addLocalObjCMethod(root,scopeName,funcType,funcName,funcArgs,exceptions,funcDecl,spec);
6693 return;
6694 }
6695 if (count==0 && !(isFriend && funcType=="class"))
6696 {
6697 int candidates=0;
6698 const ClassDef *ecd = nullptr, *ucd = nullptr;
6699 MemberDef *emd = nullptr, *umd = nullptr;
6700 //printf("Assume template class\n");
6701 for (const auto &md : *mn)
6702 {
6703 MemberDef *cmd=md.get();
6705 ClassDefMutable *ccd=cdmdm ? cdmdm->getClassDefMutable() : nullptr;
6706 //printf("ccd->name()==%s className=%s\n",qPrint(ccd->name()),qPrint(className));
6707 if (ccd!=nullptr && rightScopeMatch(ccd->name(),className))
6708 {
6709 const ArgumentList &templAl = md->templateArguments();
6710 if (!root->tArgLists.empty() && !templAl.empty() &&
6711 root->tArgLists.back().size()<=templAl.size())
6712 {
6713 AUTO_TRACE_ADD("add template specialization");
6714 addMethodToClass(root,ccd,type,md->name(),args,isFriend,
6715 root->protection,root->isStatic,root->virt,spec,relates);
6716 return;
6717 }
6718 if (argListToString(md->argumentList(),false,false) ==
6719 argListToString(root->argList,false,false))
6720 { // exact argument list match -> remember
6721 ucd = ecd = ccd;
6722 umd = emd = cmd;
6723 AUTO_TRACE_ADD("new candidate className='{}' scope='{}' args='{}': exact match",
6724 className,ccd->name(),md->argsString());
6725 }
6726 else // arguments do not match, but member name and scope do -> remember
6727 {
6728 ucd = ccd;
6729 umd = cmd;
6730 AUTO_TRACE_ADD("new candidate className='{}' scope='{}' args='{}': no match",
6731 className,ccd->name(),md->argsString());
6732 }
6733 candidates++;
6734 }
6735 }
6736 bool strictProtoMatching = Config_getBool(STRICT_PROTO_MATCHING);
6737 if (!strictProtoMatching)
6738 {
6739 if (root->lang==SrcLangExt::Cpp && !root->section.isMemberDoc() &&
6740 root->tArgLists.empty() && candidates>1 && !ecd)
6741 {
6742 MemberDefMutable *partialMatch=nullptr;
6743 FileDef *fd=root->fileDef();
6744 NamespaceDef *nd=namespaceName.empty() ? nullptr : getResolvedNamespace(namespaceName);
6745 const ClassDef *targetClass=findClassDefinition(fd,nd,scopeName);
6746 for (const auto &candidate : *mn)
6747 {
6748 MemberDefMutable *md=toMemberDefMutable(candidate.get());
6749 if (!md || !md->getClassDef()) continue;
6750 const ClassDef *candidateClass=md->getClassDef();
6751 if (candidateClass!=targetClass &&
6752 !(targetClass==nullptr && stripAnonymousNamespaceScope(candidateClass->name())==scopeName)) continue;
6753 if (!md->templateArguments().empty() || !candidateClass->getTemplateParameterLists().empty()) continue;
6754 ArgumentList argList=md->argumentList();
6755 if (matchArguments2(candidateClass,md->getFileDef(),md->typeString(),&argList,
6756 candidateClass,fd,root->type,&root->argList,
6757 true,root->lang,true))
6758 {
6759 if (partialMatch)
6760 {
6761 partialMatch=nullptr;
6762 break;
6763 }
6764 partialMatch=md;
6765 }
6766 }
6767 if (partialMatch)
6768 {
6769 addMemberDocs(root,partialMatch,funcDecl,nullptr,overloaded,spec);
6770 return;
6771 }
6772 }
6773 if (candidates==1 && ucd && umd)
6774 {
6775 // we didn't find an actual match on argument lists, but there is only 1 member with this
6776 // name in the same scope, so that has to be the one.
6777 addMemberDocs(root,toMemberDefMutable(umd),funcDecl,nullptr,overloaded,spec);
6778 return;
6779 }
6780 else if (candidates>1 && ecd && emd)
6781 {
6782 // we didn't find a unique match using type resolution,
6783 // but one of the matches has the exact same signature so
6784 // we take that one.
6785 addMemberDocs(root,toMemberDefMutable(emd),funcDecl,nullptr,overloaded,spec);
6786 return;
6787 }
6788 }
6789
6790 DString warnMsg = "no ";
6791 if (noMatchCount>1) warnMsg+="uniquely ";
6792 warnMsg+="matching class member found for \n";
6793
6794 for (const ArgumentList &al : root->tArgLists)
6795 {
6796 warnMsg+=" template ";
6797 warnMsg+=tempArgListToString(al,root->lang);
6798 warnMsg+='\n';
6799 }
6800
6801 DString fullFuncDecl=funcDecl;
6802 if (isFunc) fullFuncDecl+=argListToString(root->argList,true);
6803
6804 warnMsg+=" ";
6805 warnMsg+=fullFuncDecl;
6806
6807 if (candidates>0 || noMatchCount>=1)
6808 {
6809 warnMsg+="\nPossible candidates:";
6810
6811 NamespaceDef *nd=nullptr;
6812 if (!namespaceName.empty()) nd=getResolvedNamespace(namespaceName);
6813 FileDef *fd=root->fileDef();
6814
6815 for (const auto &md : *mn)
6816 {
6817 const ClassDef *cd=md->getClassDef();
6818 const ClassDef *tcd=findClassDefinition(fd,nd,scopeName);
6819 if (tcd==nullptr && cd && stripAnonymousNamespaceScope(cd->name())==scopeName)
6820 {
6821 // don't be fooled by anonymous scopes
6822 tcd=cd;
6823 }
6824 if (cd!=nullptr && (rightScopeMatch(cd->name(),className) || (cd!=tcd)))
6825 {
6826 warnMsg+='\n';
6827 const ArgumentList &templAl = md->templateArguments();
6828 warnMsg+=" '";
6829 if (templAl.hasParameters())
6830 {
6831 warnMsg+="template ";
6832 warnMsg+=tempArgListToString(templAl,root->lang);
6833 warnMsg+='\n';
6834 warnMsg+=" ";
6835 }
6836 if (!md->typeString().empty())
6837 {
6838 warnMsg+=md->typeString();
6839 warnMsg+=' ';
6840 }
6842 if (!qScope.empty())
6843 warnMsg+=qScope+"::"+md->name();
6844 warnMsg+=md->argsString();
6845 warnMsg+="' " + warn_line(md->getDefFileName(),md->getDefLine());
6846 }
6847 }
6848 }
6849 warn(root->fileName,root->startLine,"{}",warnMsg);
6850 }
6851}
bool hasParameters() const
Definition arguments.h:77
DString trailingReturnType() const
Definition arguments.h:115
size_t size() const
Definition arguments.h:101
void setTrailingReturnType(const DString &s)
Definition arguments.cpp:40
virtual ArgumentLists getTemplateParameterLists() const =0
Returns the template parameter lists that form the template declaration of this class.
virtual DString qualifiedNameWithTemplateParameters(const ArgumentLists *actualParams=nullptr, uint32_t *actualParamIndex=nullptr) const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual DString getDefFileName() const =0
virtual int getDefLine() const =0
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual const ArgumentList & templateArguments() const =0
virtual bool isTypedef() const =0
virtual bool isStatic() const =0
virtual Protection protection() const =0
virtual bool isVariable() const =0
virtual Specifier virtualness(int count=0) const =0
virtual const MemberDef * getEnumScope() const =0
virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists)=0
virtual void moveArgumentList(std::unique_ptr< ArgumentList > al)=0
static bool isSpecialization(const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists)
Definition doxygen.cpp:6243
static void substituteTemplatesInArgList(const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists, const ArgumentList &src, ArgumentList &dst)
Definition doxygen.cpp:6357
static void addLocalObjCMethod(const Entry *root, const DString &scopeName, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &exceptions, const DString &funcDecl, TypeSpecifier spec)
Definition doxygen.cpp:6401
static void addMemberDocs(const Entry *root, MemberDefMutable *md, const DString &funcDecl, const ArgumentList *al, bool over_load, TypeSpecifier spec)
Definition doxygen.cpp:5844
static void addMethodToClass(const Entry *root, ClassDefMutable *cd, const DString &rtype, const DString &rname, const DString &rargs, bool isFriend, Protection protection, bool stat, Specifier virt, TypeSpecifier spec, const DString &relates)
Definition doxygen.cpp:3951
static bool scopeIsTemplate(const Definition *d)
Definition doxygen.cpp:6259
static const ClassDef * findClassDefinition(FileDef *fd, NamespaceDef *nd, const DString &scopeName)
Definition doxygen.cpp:5996
DString warn_line(const DString &file, int line)
Definition message.cpp:211
NamespaceDef * getResolvedNamespace(const DString &name)
bool rightScopeMatch(const DString &scope, const DString &name)
Definition util.cpp:734
DString replaceAnonymousScopes(const DString &s, const DString &replacement)
Definition util.cpp:155
DString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
Definition util.cpp:908
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
Definition util.cpp:864
DString stripAnonymousNamespaceScope(const DString &s)
Definition util.cpp:167

References addLocalObjCMethod(), addMemberDocs(), addMethodToClass(), Entry::argList, argListToString(), MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Config_getBool, ArgumentList::empty(), DString::empty(), Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findClassDefinition(), MemberDef::getClassDef(), MemberDefMutable::getClassDefMutable(), MemberDef::getEnumScope(), MemberDef::getFileDef(), Definition::getLanguage(), getResolvedNamespace(), ClassDef::getTemplateParameterLists(), ArgumentList::hasParameters(), MemberDef::isEnumValue(), isSpecialization(), Entry::isStatic, MemberDef::isStatic(), MemberDef::isTypedef(), MemberDef::isVariable(), Entry::lang, DString::left(), matchArguments2(), Doxygen::memberNameLinkedMap, DString::mid(), MemberDefMutable::moveArgumentList(), Definition::name(), DString::npos, Entry::parent(), DString::prepend(), Entry::protection, MemberDef::protection(), ClassDef::qualifiedNameWithTemplateParameters(), replaceAnonymousScopes(), DString::rfind(), rightScopeMatch(), scopeIsTemplate(), Entry::section, MemberDefMutable::setDefinitionTemplateParameterLists(), ArgumentList::setTrailingReturnType(), ArgumentList::size(), Entry::startLine, stripAnonymousNamespaceScope(), DString::stripPrefix(), stripTemplateSpecifiersFromScope(), substitute(), substituteTemplatesInArgList(), Entry::tArgLists, tempArgListToString(), MemberDef::templateArguments(), toMemberDefMutable(), ArgumentList::trailingReturnType(), Entry::type, MemberDef::typeString(), Entry::virt, MemberDef::virtualness(), warn, and warn_line().

Referenced by findMember().

◆ addMemberSpecialization()

void addMemberSpecialization ( const Entry * root,
MemberName * mn,
ClassDefMutable * cd,
const DString & funcType,
const DString & funcName,
const DString & funcArgs,
const DString & funcDecl,
const DString & exceptions,
TypeSpecifier spec )
static

Definition at line 6855 of file doxygen.cpp.

6865{
6866 AUTO_TRACE("funcType={} funcName={} funcArgs={} funcDecl={} spec={}",funcType,funcName,funcArgs,funcDecl,spec);
6867 MemberDef *declMd=nullptr;
6868 for (const auto &md : *mn)
6869 {
6870 if (md->getClassDef()==cd)
6871 {
6872 // TODO: we should probably also check for matching arguments
6873 declMd = md.get();
6874 break;
6875 }
6876 }
6877 MemberType mtype=MemberType::Function;
6878 ArgumentList tArgList;
6879 // getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists);
6880 auto md = createMemberDef(
6881 root->fileName,root->startLine,root->startColumn,
6882 funcType,funcName,funcArgs,exceptions,
6883 declMd ? declMd->protection() : root->protection,
6884 root->virt,root->isStatic,Relationship::Member,
6885 mtype,tArgList,root->argList,root->metaData);
6886 auto mmd = toMemberDefMutable(md.get());
6887 //printf("new specialized member %s args='%s'\n",qPrint(md->name()),qPrint(funcArgs));
6888 mmd->setTagInfo(root->tagInfo());
6889 mmd->setLanguage(root->lang);
6890 mmd->setId(root->id);
6891 mmd->setMemberClass(cd);
6892 mmd->setTemplateSpecialization(true);
6893 mmd->setTypeConstraints(root->typeConstr);
6894 mmd->setDefinition(funcDecl);
6896 mmd->addQualifiers(root->qualifiers);
6897 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
6898 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
6899 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
6900 mmd->setDocsForDefinition(!root->proto);
6901 mmd->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
6902 mmd->addSectionsToDefinition(root->anchors);
6903 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
6904 FileDef *fd=root->fileDef();
6905 mmd->setBodyDef(fd);
6906 mmd->setMemberSpecifiers(spec);
6907 mmd->setVhdlSpecifiers(root->vhdlSpec);
6908 mmd->setMemberGroupId(root->mGrpId);
6909 cd->insertMember(md.get());
6910 mmd->setRefItems(root->sli);
6911 mmd->setRequirementReferences(root->rqli);
6912 addIncludeFile(mmd,fd,root);
6913
6914 mn->push_back(std::move(md));
6915}

References addIncludeFile(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, AUTO_TRACE, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, Entry::endBodyLine, Entry::fileDef(), Entry::fileName, Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), Entry::isStatic, Entry::lang, Entry::metaData, Entry::mGrpId, Entry::protection, MemberDef::protection(), Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::rqli, DefinitionMutable::setBodyDef(), Entry::sli, Entry::startColumn, Entry::startLine, Entry::tagInfo(), toMemberDefMutable(), Entry::typeConstr, Entry::vhdlSpec, and Entry::virt.

Referenced by findMember().

◆ addMembersToIndex()

void addMembersToIndex ( )
static

Definition at line 8582 of file doxygen.cpp.

8583{
8584 auto &index = Index::instance();
8585 // for each class member name
8586 for (const auto &mn : *Doxygen::memberNameLinkedMap)
8587 {
8588 // for each member definition
8589 for (const auto &md : *mn)
8590 {
8591 index.addClassMemberNameToIndex(md.get());
8592 if (md->getModuleDef())
8593 {
8594 index.addModuleMemberNameToIndex(md.get());
8595 }
8596 }
8597 }
8598 // for each file/namespace function name
8599 for (const auto &mn : *Doxygen::functionNameLinkedMap)
8600 {
8601 // for each member definition
8602 for (const auto &md : *mn)
8603 {
8604 if (md->getNamespaceDef())
8605 {
8606 index.addNamespaceMemberNameToIndex(md.get());
8607 }
8608 else
8609 {
8610 index.addFileMemberNameToIndex(md.get());
8611 }
8612 if (md->getModuleDef())
8613 {
8614 index.addModuleMemberNameToIndex(md.get());
8615 }
8616 }
8617 }
8618
8619 index.sortMemberIndexLists();
8620}
static Index & instance()
Definition index.cpp:112

References Doxygen::functionNameLinkedMap, Index::instance(), and Doxygen::memberNameLinkedMap.

Referenced by parseInput().

◆ addMembersToMemberGroup()

void addMembersToMemberGroup ( )
static

Definition at line 9742 of file doxygen.cpp.

9743{
9744 // for each class
9745 for (const auto &cd : *Doxygen::classLinkedMap)
9746 {
9747 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9748 if (cdm)
9749 {
9751 }
9752 }
9753 // for each file
9754 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9755 {
9756 for (const auto &fd : *fn)
9757 {
9758 fd->addMembersToMemberGroup();
9759 }
9760 }
9761 // for each namespace
9762 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9763 {
9765 if (ndm)
9766 {
9768 }
9769 }
9770 // for each group
9771 for (const auto &gd : *Doxygen::groupLinkedMap)
9772 {
9773 gd->addMembersToMemberGroup();
9774 }
9776}
virtual void addMembersToMemberGroup()=0
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:108
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:107
void addMembersToMemberGroup()
virtual void addMembersToMemberGroup()=0

References ClassDefMutable::addMembersToMemberGroup(), ModuleManager::addMembersToMemberGroup(), NamespaceDefMutable::addMembersToMemberGroup(), Doxygen::classLinkedMap, Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::namespaceLinkedMap, toClassDefMutable(), and toNamespaceDefMutable().

Referenced by parseInput().

◆ addMethodToClass()

void addMethodToClass ( const Entry * root,
ClassDefMutable * cd,
const DString & rtype,
const DString & rname,
const DString & rargs,
bool isFriend,
Protection protection,
bool stat,
Specifier virt,
TypeSpecifier spec,
const DString & relates )
static

Definition at line 3951 of file doxygen.cpp.

3957{
3958 FileDef *fd=root->fileDef();
3959
3960 DString type = rtype;
3961 DString args = rargs;
3962
3964 name.stripPrefix("::");
3965
3966 MemberType mtype = MemberType::Function;
3967 if (isFriend) mtype=MemberType::Friend;
3968 else if (root->mtype==MethodTypes::Signal) mtype=MemberType::Signal;
3969 else if (root->mtype==MethodTypes::Slot) mtype=MemberType::Slot;
3970 else if (root->mtype==MethodTypes::DCOP) mtype=MemberType::DCOP;
3971
3972 // strip redundant template specifier for constructors
3973 size_t i = DString::npos;
3974 size_t j = DString::npos;
3975 if ((fd==nullptr || fd->getLanguage()==SrcLangExt::Cpp) &&
3976 !name.startsWith("operator ") && // not operator
3977 (i=name.find('<'))!=DString::npos && // containing <
3978 (j=name.find('>'))!=DString::npos && // or >
3979 (j!=i+2 || name.at(i+1)!='=') // but not the C++20 spaceship operator <=>
3980 )
3981 {
3982 name=name.left(i);
3983 }
3984
3985 DString fileName = root->fileName;
3986 if (fileName.empty() && root->tagInfo())
3987 {
3988 fileName = root->tagInfo()->tagName;
3989 }
3990
3991 //printf("root->name='%s; args='%s' root->argList='%s'\n",
3992 // qPrint(root->name),qPrint(args),qPrint(argListToString(root->argList))
3993 // );
3994
3995 // adding class member
3996 Relationship relationship = relates.empty() ? Relationship::Member :
3997 root->relatesType==RelatesType::MemberOf ? Relationship::Foreign :
3998 Relationship::Related ;
3999 auto md = createMemberDef(
4000 fileName,root->startLine,root->startColumn,
4001 type,name,args,root->exception,
4002 protection,virt,
4003 stat && root->relatesType!=RelatesType::MemberOf,
4004 relationship,
4005 mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(),
4006 root->argList, root->metaData);
4007 auto mmd = toMemberDefMutable(md.get());
4008 mmd->setTagInfo(root->tagInfo());
4009 mmd->setMemberClass(cd);
4010 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
4011 mmd->setDocsForDefinition(!root->proto);
4012 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
4013 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
4014 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
4015 mmd->setMemberSpecifiers(spec);
4016 mmd->setVhdlSpecifiers(root->vhdlSpec);
4017 mmd->setMemberGroupId(root->mGrpId);
4018 mmd->setTypeConstraints(root->typeConstr);
4019 mmd->setLanguage(root->lang);
4020 mmd->setRequiresClause(root->req);
4021 mmd->setId(root->id);
4022 mmd->setBodyDef(fd);
4023 mmd->setFileDef(fd);
4024 mmd->addSectionsToDefinition(root->anchors);
4025 addIncludeFile(mmd,fd,root);
4026 DString def;
4028 SrcLangExt lang = cd->getLanguage();
4029 DString scopeSeparator=getLanguageSpecificSeparator(lang);
4030 if (scopeSeparator!="::")
4031 {
4032 qualScope = substitute(qualScope,"::",scopeSeparator);
4033 }
4034 if (lang==SrcLangExt::PHP)
4035 {
4036 // for PHP we use Class::method and Namespace\method
4037 scopeSeparator="::";
4038 }
4039 if (!relates.empty() || isFriend || Config_getBool(HIDE_SCOPE_NAMES))
4040 {
4041 if (!type.empty())
4042 {
4043 def=type+" "+name; //+optArgs;
4044 }
4045 else
4046 {
4047 def=name; //+optArgs;
4048 }
4049 }
4050 else
4051 {
4052 if (!type.empty())
4053 {
4054 def=type+" "+qualScope+scopeSeparator+name; //+optArgs;
4055 }
4056 else
4057 {
4058 def=qualScope+scopeSeparator+name; //+optArgs;
4059 }
4060 }
4061 def.stripPrefix("friend ");
4062 mmd->setDefinition(def);
4064 mmd->addQualifiers(root->qualifiers);
4065
4066 AUTO_TRACE("function member: type='{}' scope='{}' name='{}' args='{}' proto={} def='{}'",
4067 type, qualScope, rname, args, root->proto, def);
4068
4069 // add member to the class cd
4070 cd->insertMember(md.get());
4071 // add file to list of used files
4072 cd->insertUsedFile(fd);
4073
4074 addMemberToGroups(root,md.get());
4076 root->markAsProcessed();
4077 mmd->setRefItems(root->sli);
4078 mmd->setRequirementReferences(root->rqli);
4079
4080 // add member to the global list of all members
4081 //printf("Adding member=%s class=%s\n",qPrint(md->name()),qPrint(cd->name()));
4083 mn->push_back(std::move(md));
4084}
MethodTypes mtype
signal, slot, (dcop) method, or property?
Definition entry.h:188
Relationship
Definition types.h:167

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, AUTO_TRACE, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::exception, Entry::fileDef(), Entry::fileName, Definition::getLanguage(), getLanguageSpecificSeparator(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), Entry::lang, Entry::markAsProcessed(), Doxygen::memberNameLinkedMap, Entry::metaData, Entry::mGrpId, Entry::mtype, DString::npos, Entry::proto, MemberName::push_back(), ClassDef::qualifiedNameWithTemplateParameters(), Entry::qualifiers, Entry::relatesType, removeRedundantWhiteSpace(), Entry::req, Entry::rqli, Entry::sli, Entry::startColumn, Entry::startLine, DString::stripPrefix(), substitute(), Entry::tagInfo(), TagInfo::tagName, Entry::tArgLists, toMemberDefMutable(), Entry::typeConstr, and Entry::vhdlSpec.

Referenced by addMemberFunction(), and buildFunctionList().

◆ addOverloaded()

void addOverloaded ( const Entry * root,
MemberName * mn,
const DString & funcType,
const DString & funcName,
const DString & funcArgs,
const DString & funcDecl,
const DString & exceptions,
TypeSpecifier spec )
static

Definition at line 6919 of file doxygen.cpp.

6922{
6923 // for unique overloaded member we allow the class to be
6924 // omitted, this is to be Qt compatible. Using this should
6925 // however be avoided, because it is error prone
6926 bool sameClass=false;
6927 if (mn->size()>0)
6928 {
6929 // check if all members with the same name are also in the same class
6930 sameClass = std::equal(mn->begin()+1,mn->end(),mn->begin(),
6931 [](const auto &md1,const auto &md2)
6932 { return md1->getClassDef()->name()==md2->getClassDef()->name(); });
6933 }
6934 if (sameClass)
6935 {
6936 MemberDefMutable *mdm = toMemberDefMutable(mn->front().get());
6937 ClassDefMutable *cd = mdm ? mdm->getClassDefMutable() : nullptr;
6938 if (cd==nullptr) return;
6939
6940 MemberType mtype = MemberType::Function;
6941 if (root->mtype==MethodTypes::Signal) mtype=MemberType::Signal;
6942 else if (root->mtype==MethodTypes::Slot) mtype=MemberType::Slot;
6943 else if (root->mtype==MethodTypes::DCOP) mtype=MemberType::DCOP;
6944
6945 // new overloaded member function
6946 std::unique_ptr<ArgumentList> tArgList =
6947 getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists);
6948 //printf("new related member %s args='%s'\n",qPrint(md->name()),qPrint(funcArgs));
6949 auto md = createMemberDef(
6950 root->fileName,root->startLine,root->startColumn,
6951 funcType,funcName,funcArgs,exceptions,
6952 root->protection,root->virt,root->isStatic,Relationship::Related,
6953 mtype,tArgList ? *tArgList : ArgumentList(),root->argList,root->metaData);
6954 auto mmd = toMemberDefMutable(md.get());
6955 mmd->setTagInfo(root->tagInfo());
6956 mmd->setLanguage(root->lang);
6957 mmd->setId(root->id);
6958 mmd->setTypeConstraints(root->typeConstr);
6959 mmd->setMemberClass(cd);
6960 mmd->setDefinition(funcDecl);
6962 mmd->addQualifiers(root->qualifiers);
6964 doc+="<p>";
6965 doc+=root->doc;
6966 mmd->setDocumentation(doc,root->docFile,root->docLine);
6967 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
6968 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
6969 mmd->setDocsForDefinition(!root->proto);
6970 mmd->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
6971 mmd->addSectionsToDefinition(root->anchors);
6972 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
6973 FileDef *fd=root->fileDef();
6974 mmd->setBodyDef(fd);
6975 mmd->setMemberSpecifiers(spec);
6976 mmd->setVhdlSpecifiers(root->vhdlSpec);
6977 mmd->setMemberGroupId(root->mGrpId);
6978 cd->insertMember(md.get());
6979 cd->insertUsedFile(fd);
6980 mmd->setRefItems(root->sli);
6981 mmd->setRequirementReferences(root->rqli);
6982 addIncludeFile(mmd,fd,root);
6983
6984 mn->push_back(std::move(md));
6985 }
6986}
Ptr & front()
Definition membername.h:49
size_t size() const
Definition membername.h:46
iterator begin()
Definition membername.h:35
iterator end()
Definition membername.h:36

References addIncludeFile(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, MemberName::begin(), Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, MemberName::end(), Entry::endBodyLine, Entry::fileDef(), Entry::fileName, MemberName::front(), MemberDefMutable::getClassDefMutable(), getTemplateArgumentsFromName(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), Entry::isStatic, Entry::lang, Entry::metaData, Entry::mGrpId, Entry::mtype, Definition::name(), Entry::protection, Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::rqli, DefinitionMutable::setBodyDef(), MemberName::size(), Entry::sli, Entry::startColumn, Entry::startLine, Entry::tagInfo(), Entry::tArgLists, theTranslator, toMemberDefMutable(), Translator::trOverloadText(), Entry::typeConstr, Entry::vhdlSpec, and Entry::virt.

Referenced by findMember().

◆ addPageToContext()

void addPageToContext ( PageDef * pd,
Entry * root )
static

Definition at line 417 of file doxygen.cpp.

418{
419 if (root->parent()) // add the page to it's scope
420 {
421 DString scope = root->parent()->name;
422 if (root->parent()->section.isPackageDoc())
423 {
424 scope=substitute(scope,".","::");
425 }
426 scope = stripAnonymousNamespaceScope(scope);
427 scope+="::"+pd->name();
429 if (d)
430 {
431 pd->setPageScope(d);
432 }
433 }
434}
virtual void setPageScope(Definition *)=0

References findScopeFromQualifiedName(), Doxygen::globalScope, Definition::name(), Entry::name, Entry::parent(), Entry::section, PageDef::setPageScope(), stripAnonymousNamespaceScope(), substitute(), and Entry::tagInfo().

Referenced by addRelatedPage(), and findMainPage().

◆ addRelatedPage()

void addRelatedPage ( Entry * root)
static

Definition at line 436 of file doxygen.cpp.

437{
438 GroupDef *gd=nullptr;
439 for (const Grouping &g : root->groups)
440 {
441 if (!g.groupname.empty() && (gd=Doxygen::groupLinkedMap->find(g.groupname))) break;
442 }
443 //printf("---> addRelatedPage() %s gd=%p\n",qPrint(root->name),gd);
444 DString doc=root->doc+root->inbodyDocs;
445
446 PageDef *pd = addRelatedPage(root->name, // name
447 root->args, // ptitle
448 doc, // doc
449 root->docFile, // fileName
450 root->docLine, // docLine
451 root->startLine, // startLine
452 root->sli, // sli
453 gd, // gd
454 root->tagInfo(), // tagInfo
455 false, // xref
456 root->lang // lang
457 );
458 if (pd)
459 {
460 pd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
462 pd->setLocalToc(root->localToc);
463 addPageToContext(pd,root);
464 }
465}
LocalToc localToc
Definition entry.h:242
A model of a page symbol.
Definition pagedef.h:27
virtual void setLocalToc(const LocalToc &tl)=0
static void addRelatedPage(Entry *root)
Definition doxygen.cpp:436
static void addPageToContext(PageDef *pd, Entry *root)
Definition doxygen.cpp:417
Grouping info.
Definition types.h:227
DString groupname
name of the group
Definition types.h:257

References addPageToContext(), addRelatedPage(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, Entry::args, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, Entry::inbodyDocs, Entry::lang, Entry::localToc, Entry::name, DefinitionMutable::setBriefDescription(), PageDef::setLocalToc(), Entry::sli, Entry::startLine, and Entry::tagInfo().

Referenced by addRelatedPage(), and buildPageList().

◆ addRequirementReferences()

void addRequirementReferences ( )
static

Definition at line 5813 of file doxygen.cpp.

5814{
5815 AUTO_TRACE();
5816 applyToAllDefinitions([](auto* obj) { obj->addRequirementReferences(); });
5817}

References applyToAllDefinitions(), and AUTO_TRACE.

Referenced by parseInput().

◆ addSourceReferences()

void addSourceReferences ( )
static

Definition at line 9260 of file doxygen.cpp.

9261{
9262 // add source references for class definitions
9263 for (const auto &cd : *Doxygen::classLinkedMap)
9264 {
9265 const FileDef *fd=cd->getBodyDef();
9266 if (fd && cd->isLinkableInProject() && cd->getStartDefLine()!=-1)
9267 {
9268 const_cast<FileDef*>(fd)->addSourceRef(cd->getStartDefLine(),cd.get(),nullptr);
9269 }
9270 }
9271 // add source references for concept definitions
9272 for (const auto &cd : *Doxygen::conceptLinkedMap)
9273 {
9274 const FileDef *fd=cd->getBodyDef();
9275 if (fd && cd->isLinkableInProject() && cd->getStartDefLine()!=-1)
9276 {
9277 const_cast<FileDef*>(fd)->addSourceRef(cd->getStartDefLine(),cd.get(),nullptr);
9278 }
9279 }
9280 // add source references for namespace definitions
9281 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9282 {
9283 const FileDef *fd=nd->getBodyDef();
9284 if (fd && nd->isLinkableInProject() && nd->getStartDefLine()!=-1)
9285 {
9286 const_cast<FileDef*>(fd)->addSourceRef(nd->getStartDefLine(),nd.get(),nullptr);
9287 }
9288 }
9289
9290 // add source references for member names
9291 for (const auto &mn : *Doxygen::memberNameLinkedMap)
9292 {
9293 for (const auto &md : *mn)
9294 {
9295 //printf("class member %s: def=%s body=%d link?=%d\n",
9296 // qPrint(md->name()),
9297 // md->getBodyDef()?qPrint(md->getBodyDef()->name()):"<none>",
9298 // md->getStartBodyLine(),md->isLinkableInProject());
9299 const FileDef *fd=md->getBodyDef();
9300 if (fd &&
9301 md->getStartDefLine()!=-1 &&
9302 md->isLinkableInProject() &&
9304 )
9305 {
9306 //printf("Found member '%s' in file '%s' at line '%d' def=%s\n",
9307 // qPrint(md->name()),qPrint(fd->name()),md->getStartBodyLine(),qPrint(md->getOuterScope()->name()));
9308 const_cast<FileDef*>(fd)->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md.get());
9309 }
9310 }
9311 }
9312 for (const auto &mn : *Doxygen::functionNameLinkedMap)
9313 {
9314 for (const auto &md : *mn)
9315 {
9316 const FileDef *fd=md->getBodyDef();
9317 //printf("member %s body=[%d,%d] fd=%p link=%d parseSources=%d\n",
9318 // qPrint(md->name()),
9319 // md->getStartBodyLine(),md->getEndBodyLine(),fd,
9320 // md->isLinkableInProject(),
9321 // Doxygen::parseSourcesNeeded);
9322 if (fd &&
9323 md->getStartDefLine()!=-1 &&
9324 md->isLinkableInProject() &&
9326 )
9327 {
9328 //printf("Found member '%s' in file '%s' at line '%d' def=%s\n",
9329 // qPrint(md->name()),qPrint(fd->name()),md->getStartBodyLine(),qPrint(md->getOuterScope()->name()));
9330 const_cast<FileDef*>(fd)->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md.get());
9331 }
9332 }
9333 }
9334}
virtual const FileDef * getBodyDef() const =0
static bool parseSourcesNeeded
Definition doxygen.h:116

References Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, Doxygen::functionNameLinkedMap, FileDef::generateSourceFile(), Definition::getBodyDef(), Definition::getStartDefLine(), Definition::isLinkableInProject(), Doxygen::memberNameLinkedMap, Doxygen::namespaceLinkedMap, and Doxygen::parseSourcesNeeded.

Referenced by parseInput().

◆ addToIndices()

void addToIndices ( )
static

Definition at line 8624 of file doxygen.cpp.

8625{
8626 for (const auto &cd : *Doxygen::classLinkedMap)
8627 {
8628 if (cd->isLinkableInProject())
8629 {
8630 Doxygen::indexList->addIndexItem(cd.get(),nullptr);
8631 if (Doxygen::searchIndex.enabled())
8632 {
8633 Doxygen::searchIndex.setCurrentDoc(cd.get(),cd->anchor(),false);
8634 Doxygen::searchIndex.addWord(cd->localName(),true);
8635 }
8636 }
8637 }
8638
8639 for (const auto &cd : *Doxygen::conceptLinkedMap)
8640 {
8641 if (cd->isLinkableInProject())
8642 {
8643 Doxygen::indexList->addIndexItem(cd.get(),nullptr);
8644 if (Doxygen::searchIndex.enabled())
8645 {
8646 Doxygen::searchIndex.setCurrentDoc(cd.get(),cd->anchor(),false);
8647 Doxygen::searchIndex.addWord(cd->localName(),true);
8648 }
8649 }
8650 }
8651
8652 for (const auto &nd : *Doxygen::namespaceLinkedMap)
8653 {
8654 if (nd->isLinkableInProject())
8655 {
8656 Doxygen::indexList->addIndexItem(nd.get(),nullptr);
8657 if (Doxygen::searchIndex.enabled())
8658 {
8659 Doxygen::searchIndex.setCurrentDoc(nd.get(),nd->anchor(),false);
8660 Doxygen::searchIndex.addWord(nd->localName(),true);
8661 }
8662 }
8663 }
8664
8665 for (const auto &fn : *Doxygen::inputNameLinkedMap)
8666 {
8667 for (const auto &fd : *fn)
8668 {
8669 if (Doxygen::searchIndex.enabled() && fd->isLinkableInProject())
8670 {
8671 Doxygen::searchIndex.setCurrentDoc(fd.get(),fd->anchor(),false);
8672 Doxygen::searchIndex.addWord(fd->localName(),true);
8673 }
8674 }
8675 }
8676
8677 auto addWordsForTitle = [](const Definition *d,const DString &anchor,const DString &title)
8678 {
8680 if (Doxygen::searchIndex.enabled())
8681 {
8682 Doxygen::searchIndex.setCurrentDoc(d,anchor,false);
8683 std::string s = title.str();
8684 static const reg::Ex re(R"(\a[\w-]*)");
8685 reg::Iterator it(s,re);
8687 for (; it!=end ; ++it)
8688 {
8689 const auto &match = *it;
8690 std::string matchStr = match.str();
8691 Doxygen::searchIndex.addWord(matchStr,true);
8692 }
8693 }
8694 };
8695
8696 for (const auto &gd : *Doxygen::groupLinkedMap)
8697 {
8698 if (gd->isLinkableInProject())
8699 {
8700 addWordsForTitle(gd.get(),gd->anchor(),gd->groupTitle());
8701 }
8702 }
8703
8704 for (const auto &pd : *Doxygen::pageLinkedMap)
8705 {
8706 if (pd->isLinkableInProject())
8707 {
8708 addWordsForTitle(pd.get(),pd->anchor(),pd->title());
8709 }
8710 }
8711
8713 {
8714 addWordsForTitle(Doxygen::mainPage.get(),Doxygen::mainPage->anchor(),Doxygen::mainPage->title());
8715 }
8716
8717 auto addMemberToSearchIndex = [](const MemberDef *md)
8718 {
8719 if (Doxygen::searchIndex.enabled())
8720 {
8721 Doxygen::searchIndex.setCurrentDoc(md,md->anchor(),false);
8722 DString ln=md->localName();
8723 DString qn=md->qualifiedName();
8725 if (ln!=qn)
8726 {
8728 if (md->getClassDef())
8729 {
8730 Doxygen::searchIndex.addWord(md->getClassDef()->displayName(),true);
8731 }
8732 if (md->getNamespaceDef())
8733 {
8734 Doxygen::searchIndex.addWord(md->getNamespaceDef()->displayName(),true);
8735 }
8736 }
8737 }
8738 };
8739
8740 auto getScope = [](const MemberDef *md)
8741 {
8742 const Definition *scope = nullptr;
8743 if (md->getGroupDef()) scope = md->getGroupDef();
8744 else if (md->getClassDef()) scope = md->getClassDef();
8745 else if (md->getNamespaceDef()) scope = md->getNamespaceDef();
8746 else if (md->getFileDef()) scope = md->getFileDef();
8747 return scope;
8748 };
8749
8750 auto addMemberToIndices = [addMemberToSearchIndex,getScope](const MemberDef *md)
8751 {
8752 if (md->isLinkableInProject())
8753 {
8754 if (!(md->isEnumerate() && md->isAnonymous()))
8755 {
8756 Doxygen::indexList->addIndexItem(getScope(md),md);
8757 addMemberToSearchIndex(md);
8758 }
8759 if (md->isEnumerate())
8760 {
8761 for (const auto &fmd : md->enumFieldList())
8762 {
8763 Doxygen::indexList->addIndexItem(getScope(fmd),fmd);
8764 addMemberToSearchIndex(fmd);
8765 }
8766 }
8767 }
8768 };
8769
8770 // for each class member name
8771 for (const auto &mn : *Doxygen::memberNameLinkedMap)
8772 {
8773 // for each member definition
8774 for (const auto &md : *mn)
8775 {
8776 addMemberToIndices(md.get());
8777 }
8778 }
8779 // for each file/namespace function name
8780 for (const auto &mn : *Doxygen::functionNameLinkedMap)
8781 {
8782 // for each member definition
8783 for (const auto &md : *mn)
8784 {
8785 addMemberToIndices(md.get());
8786 }
8787 }
8788}
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:93
static IndexList * indexList
Definition doxygen.h:125
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:92
static SearchIndexIntf searchIndex
Definition doxygen.h:117
void addIndexItem(const Definition *context, const MemberDef *md, const DString &sectionAnchor=DString(), const DString &title=DString())
Definition indexlist.h:118
void addWord(const DString &word, bool hiPriority)
void setCurrentDoc(const Definition *ctx, const DString &anchor, bool isSourceFile)
Class representing a regular expression.
Definition regex.h:39
Class to iterate through matches.
Definition regex.h:245
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:180
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:861
DString filterTitle(const DString &title)
Definition util.cpp:4590

References IndexList::addIndexItem(), SearchIndexIntf::addWord(), Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, end(), filterTitle(), Doxygen::functionNameLinkedMap, Doxygen::groupLinkedMap, Doxygen::indexList, Doxygen::inputNameLinkedMap, Doxygen::mainPage, Doxygen::memberNameLinkedMap, Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, Doxygen::searchIndex, and SearchIndexIntf::setCurrentDoc().

Referenced by parseInput().

◆ addVariable()

void addVariable ( const Entry * root,
int isFuncPtr = -1 )
static

Definition at line 3445 of file doxygen.cpp.

3446{
3447 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
3448
3449 AUTO_TRACE("VARIABLE_SEC: type='{}' name='{}' args='{}' bodyLine={} endBodyLine={} mGrpId={} relates='{}'",
3450 root->type, root->name, root->args, root->bodyLine, root->endBodyLine, root->mGrpId, root->relates);
3451 //printf("root->parent->name=%s\n",qPrint(root->parent->name));
3452
3453 DString type = root->type;
3454 DString name = root->name;
3455 DString args = root->args;
3456 if (type.empty() && name.find("operator")==DString::npos &&
3457 (name.find('*')!=DString::npos || name.find('&')!=DString::npos))
3458 {
3459 // recover from parse error caused by redundant braces
3460 // like in "int *(var[10]);", which is parsed as
3461 // type="" name="int *" args="(var[10])"
3462
3463 type=name;
3464 std::string sargs = args.str();
3465 static const reg::Ex reName(R"(\a\w*)");
3467 if (reg::search(sargs,match,reName))
3468 {
3469 name = match.str(); // e.g. 'var' in '(var[10])'
3470 sargs = match.suffix().str(); // e.g. '[10]) in '(var[10])'
3471 size_t j = sargs.find(')');
3472 if (j!=std::string::npos) args=sargs.substr(0,j); // extract, e.g '[10]' from '[10])'
3473 }
3474 }
3475 else
3476 {
3477 int i=isFuncPtr;
3478 if (i==-1 && (root->spec.isAlias())==0) i=findFunctionPtr(type.str(),root->lang); // for typedefs isFuncPtr is not yet set
3479 AUTO_TRACE_ADD("functionPtr={}",i!=-1?"yes":"no");
3480 if (i>=0) // function pointer
3481 {
3482 size_t ii = i;
3483 size_t ai = type.find('[',ii);
3484 if (ai!=DString::npos && ai>ii) // function pointer array
3485 {
3486 args.prepend(type.mid(ai));
3487 type=type.left(ai);
3488 }
3489 else if (type.find(')',ii)!=DString::npos) // function ptr, not variable like "int (*bla)[10]"
3490 {
3491 type=type.left(type.length()-1);
3492 args.prepend(") ");
3493 }
3494 }
3495 }
3496 AUTO_TRACE_ADD("after correction: type='{}' name='{}' args='{}'",type,name,args);
3497
3498 DString scope;
3500
3501 // find the scope of this variable
3502 int index = computeQualifiedIndex(name);
3503 // grouped members are stored with full scope
3504 bool qualifiedGroupMember = index!=-1 && root->parent()->section.isGroupDoc() && root->parent()->tagInfo();
3505 // A specialization of a variable template that lives in a namespace, i.e.
3506 // `template<class T> constexpr bool std::ranges::enable_view<MyView<T>> = true;`.
3507 // Its scope has to be spelled out, so it must not be mistaken for the definition of a static
3508 // data member, which is declared in its class as well and is therefore picked up from there.
3509 bool variableTemplateSpecialization = index!=-1 && !root->tArgLists.empty() &&
3510 name.mid(index+2).find('<')!=DString::npos &&
3511 getClass(name.left(index))==nullptr;
3512 if (qualifiedGroupMember || variableTemplateSpecialization)
3513 {
3514 Definition *d = buildScopeFromQualifiedName(name.left(index+2),root->lang,root->tagInfo());
3515 if (variableTemplateSpecialization)
3516 // the scope may have been made up for this specialization, but it holds a documented member
3517 // now, which is only reachable through a page of its own
3518 {
3519 for (Definition *s=d; s && s!=Doxygen::globalScope; s=s->getOuterScope())
3520 {
3522 if (ndm && ndm->isArtificial()) ndm->setArtificial(false);
3523 }
3524 }
3525 scope=name.left(index);
3526 name=name.mid(index+2);
3527 }
3528 else
3529 {
3530 Entry *p = root->parent();
3531 while (p->section.isScope())
3532 {
3533 DString scopeName = p->name;
3534 if (!scopeName.empty())
3535 {
3536 scope.prepend(scopeName);
3537 break;
3538 }
3539 p=p->parent();
3540 }
3541 }
3542
3543 DString type_s = type;
3544 type=type.stripWhiteSpace();
3545 ClassDefMutable *cd=nullptr;
3546 bool isRelated=false;
3547 bool isMemberOf=false;
3548
3549 DString classScope=stripAnonymousNamespaceScope(scope);
3550 if (root->lang==SrcLangExt::CSharp)
3551 {
3552 classScope=mangleCSharpGenericName(classScope);
3553 }
3554 else
3555 {
3556 classScope=stripTemplateSpecifiersFromScope(classScope,false);
3557 }
3558 DString annScopePrefix=scope.left(scope.length()-classScope.length());
3559
3560
3561 // Look for last :: not part of template specifier
3562 int p=-1;
3563 for (size_t i=0;i<name.length()-1;i++)
3564 {
3565 if (name[i]==':' && name[i+1]==':')
3566 {
3567 p=static_cast<int>(i);
3568 }
3569 else if (name[i]=='<') // skip over template parts,
3570 // i.e. A::B<C::D> => p=1 and
3571 // A<B::C>::D => p=8
3572 {
3573 int e = findEndOfTemplate(name,i+1);
3574 if (e!=-1) i=static_cast<int>(e);
3575 }
3576 }
3577
3578 if (p!=-1) // found it
3579 {
3580 if (isTypeAClassFriend(type))
3581 {
3582 cd=getClassMutable(scope);
3583 if (cd)
3584 {
3585 addVariableToClass(root, // entry
3586 cd, // class to add member to
3587 MemberType::Friend, // type of member
3588 type, // type value as string
3589 name, // name of the member
3590 args, // arguments as string
3591 Protection::Public, // protection
3592 Relationship::Member // related to a class
3593 );
3594 }
3595 }
3596 if (root->bodyLine!=-1 && root->endBodyLine!=-1) // store the body location for later use
3597 {
3598 Doxygen::staticInitMap.emplace(name.str(),BodyInfo{root->startLine,root->bodyLine,root->endBodyLine});
3599 }
3600
3601
3602 AUTO_TRACE_ADD("static variable {} body=[{}..{}]",name,root->bodyLine,root->endBodyLine);
3603 return; /* skip this member, because it is a
3604 * static variable definition (always?), which will be
3605 * found in a class scope as well, but then we know the
3606 * correct protection level, so only then it will be
3607 * inserted in the correct list!
3608 */
3609 }
3610
3611 MemberType mtype = MemberType::Variable;
3612 if (type=="@")
3613 mtype=MemberType::EnumValue;
3614 else if (type_s.startsWith("typedef "))
3615 mtype=MemberType::Typedef;
3616 else if (type_s.startsWith("friend ") || type_s=="friend")
3617 mtype=MemberType::Friend;
3618 else if (root->mtype==MethodTypes::Property)
3619 mtype=MemberType::Property;
3620 else if (root->mtype==MethodTypes::Event)
3621 mtype=MemberType::Event;
3622 else if (type.find("sequence<") != DString::npos)
3623 mtype=sliceOpt ? MemberType::Sequence : MemberType::Typedef;
3624 else if (type.find("dictionary<") != DString::npos)
3625 mtype=sliceOpt ? MemberType::Dictionary : MemberType::Typedef;
3626
3627 if (!root->relates.empty()) // related variable
3628 {
3629 isRelated=true;
3630 isMemberOf=(root->relatesType==RelatesType::MemberOf);
3631 if (getClass(root->relates)==nullptr && !scope.empty())
3632 scope=mergeScopes(scope,root->relates);
3633 else
3634 scope=root->relates;
3635 }
3636
3637 cd=getClassMutable(scope);
3638 if (cd==nullptr && classScope!=scope) cd=getClassMutable(classScope);
3639 if (cd)
3640 {
3641 Relationship relationship = isMemberOf ? Relationship::Foreign :
3642 isRelated ? Relationship::Related :
3643 Relationship::Member ;
3644
3645 addVariableToClass(root, // entry
3646 cd, // class to add member to
3647 mtype, // member type
3648 type, // type value as string
3649 name, // name of the member
3650 args, // arguments as string
3651 root->protection,
3652 relationship
3653 );
3654
3655 }
3656 else if (!name.empty()) // global variable
3657 {
3658 addVariableToFile(root,mtype,scope,type,name,args);
3659 }
3660
3661}
DString substr(size_t pos=0, size_t count=npos) const
Returns a substring of length count starting at pos.
Definition dstring.h:223
const std::string & str() const
Definition dstring.h:645
bool startsWith(const char *s) const
Definition dstring.h:600
virtual bool isArtificial() const =0
static StaticInitMap staticInitMap
Definition doxygen.h:134
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:123
ClassDef * getClass(const DString &n)
Object representing the matching results.
Definition regex.h:160
static int findFunctionPtr(const std::string &type, SrcLangExt lang, int *pLength=nullptr)
Definition doxygen.cpp:3174
static MemberDef * addVariableToFile(const Entry *root, MemberType mtype, const DString &scope, const DString &type, const DString &name, const DString &args)
Definition doxygen.cpp:2921
static int findEndOfTemplate(const DString &s, size_t startPos)
Definition doxygen.cpp:3377
static MemberDef * addVariableToClass(const Entry *root, ClassDefMutable *cd, MemberType mtype, const DString &type, const DString &name, const DString &args, Protection prot, Relationship related)
Definition doxygen.cpp:2750
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:850
Data associated with description found in the body.
Definition definition.h:64
bool isTypeAClassFriend(const DString &type)
Definition types.h:924
int computeQualifiedIndex(const DString &name)
Return the index of the last :: in the string name that is still before the first <.
Definition util.cpp:5435

References addVariableToClass(), addVariableToFile(), Entry::args, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, buildScopeFromQualifiedName(), computeQualifiedIndex(), Config_getBool, DString::empty(), Entry::endBodyLine, DString::find(), findEndOfTemplate(), findFunctionPtr(), getClass(), getClassMutable(), Definition::getOuterScope(), Doxygen::globalScope, Definition::isArtificial(), EntryType::isScope(), isTypeAClassFriend(), Entry::lang, DString::left(), DString::length(), mangleCSharpGenericName(), mergeScopes(), Entry::mGrpId, DString::mid(), Entry::mtype, Entry::name, DString::npos, Entry::parent(), DString::prepend(), Entry::protection, Entry::relates, Entry::relatesType, removeRedundantWhiteSpace(), reg::search(), Entry::section, DefinitionMutable::setArtificial(), Entry::spec, DString::startsWith(), Doxygen::staticInitMap, DString::str(), stripAnonymousNamespaceScope(), stripTemplateSpecifiersFromScope(), DString::stripWhiteSpace(), DString::substr(), Entry::tagInfo(), Entry::tArgLists, toNamespaceDefMutable(), and Entry::type.

Referenced by buildDictionaryList(), buildSequenceList(), buildTypedefList(), and buildVarList().

◆ addVariableToClass()

MemberDef * addVariableToClass ( const Entry * root,
ClassDefMutable * cd,
MemberType mtype,
const DString & type,
const DString & name,
const DString & args,
Protection prot,
Relationship related )
static

Definition at line 2750 of file doxygen.cpp.

2759{
2761 DString scopeSeparator="::";
2762 SrcLangExt lang = cd->getLanguage();
2763 if (lang==SrcLangExt::Java || lang==SrcLangExt::CSharp)
2764 {
2765 qualScope = substitute(qualScope,"::",".");
2766 scopeSeparator=".";
2767 }
2768 AUTO_TRACE("class variable: file='{}' type='{}' scope='{}' name='{}' args='{}' prot={} mtype={} lang={} init='{}'",
2769 root->fileName, type, qualScope, name, args, root->protection, mtype, lang, root->initializer.str());
2770
2771 DString def;
2772 if (!type.empty())
2773 {
2774 if (related!=Relationship::Member || mtype==MemberType::Friend || Config_getBool(HIDE_SCOPE_NAMES))
2775 {
2776 if (root->spec.isAlias()) // turn 'typedef B A' into 'using A'
2777 {
2778 if (lang==SrcLangExt::Python)
2779 {
2780 def="type "+name+args;
2781 }
2782 else
2783 {
2784 def="using "+name;
2785 }
2786 }
2787 else
2788 {
2789 def=type+" "+name+args;
2790 }
2791 }
2792 else
2793 {
2794 if (root->spec.isAlias()) // turn 'typedef B C::A' into 'using C::A'
2795 {
2796 if (lang==SrcLangExt::Python)
2797 {
2798 def="type "+qualScope+scopeSeparator+name+args;
2799 }
2800 else
2801 {
2802 def="using "+qualScope+scopeSeparator+name;
2803 }
2804 }
2805 else
2806 {
2807 def=type+" "+qualScope+scopeSeparator+name+args;
2808 }
2809 }
2810 }
2811 else
2812 {
2813 if (Config_getBool(HIDE_SCOPE_NAMES))
2814 {
2815 def=name+args;
2816 }
2817 else
2818 {
2819 def=qualScope+scopeSeparator+name+args;
2820 }
2821 }
2822 def.stripPrefix("static ");
2823
2824 // see if the member is already found in the same scope
2825 // (this may be the case for a static member that is initialized
2826 // outside the class)
2828 if (mn)
2829 {
2830 for (const auto &imd : *mn)
2831 {
2832 //printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n",
2833 // md->getClassDef(),cd,qPrint(type),md->typeString());
2834 MemberDefMutable *md = toMemberDefMutable(imd.get());
2835 if (md &&
2836 md->getClassDef()==cd &&
2837 ((lang==SrcLangExt::Python && type.empty() && !md->typeString().empty()) ||
2839 // member already in the scope
2840 {
2841
2842 if (root->lang==SrcLangExt::ObjC &&
2843 root->mtype==MethodTypes::Property &&
2844 md->memberType()==MemberType::Variable)
2845 { // Objective-C 2.0 property
2846 // turn variable into a property
2847 md->setProtection(root->protection);
2848 cd->reclassifyMember(md,MemberType::Property);
2849 }
2850 addMemberDocs(root,md,def,nullptr,false,root->spec);
2851 AUTO_TRACE_ADD("Member already found!");
2852 return md;
2853 }
2854 }
2855 }
2856
2857 DString fileName = root->fileName;
2858 if (fileName.empty() && root->tagInfo())
2859 {
2860 fileName = root->tagInfo()->tagName;
2861 }
2862
2863 // new member variable, typedef or enum value
2864 auto md = createMemberDef(
2865 fileName,root->startLine,root->startColumn,
2866 type,name,args,root->exception,
2867 prot,Specifier::Normal,root->isStatic,related,
2868 mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(),
2869 ArgumentList(), root->metaData);
2870 auto mmd = toMemberDefMutable(md.get());
2871 mmd->setTagInfo(root->tagInfo());
2872 mmd->setMemberClass(cd); // also sets outer scope (i.e. getOuterScope())
2873 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
2874 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2875 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
2876 mmd->setDefinition(def);
2877 mmd->setBitfields(root->bitfields);
2878 mmd->addSectionsToDefinition(root->anchors);
2879 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
2880 mmd->setInitializer(root->initializer.str());
2881 mmd->setMaxInitLines(root->initLines);
2882 mmd->setMemberGroupId(root->mGrpId);
2883 mmd->setMemberSpecifiers(root->spec);
2884 mmd->setVhdlSpecifiers(root->vhdlSpec);
2885 mmd->setReadAccessor(root->read);
2886 mmd->setWriteAccessor(root->write);
2888 mmd->setHidden(root->hidden);
2889 mmd->setArtificial(root->artificial);
2890 mmd->setLanguage(root->lang);
2891 mmd->setId(root->id);
2892 addMemberToGroups(root,md.get());
2894 mmd->setBodyDef(root->fileDef());
2895 mmd->addQualifiers(root->qualifiers);
2896 addIncludeFile(mmd,root->fileDef(),root);
2897
2898 AUTO_TRACE_ADD("Adding new member '{}' to class '{}'",name,cd->name());
2899 cd->insertMember(md.get());
2900 mmd->setRefItems(root->sli);
2901 mmd->setRequirementReferences(root->rqli);
2902
2903 cd->insertUsedFile(root->fileDef());
2904 root->markAsProcessed();
2905
2906 if (mtype==MemberType::Typedef)
2907 {
2908 resolveTemplateInstanceInType(root,cd,md.get());
2909 }
2910
2911 // add the member to the global list
2912 MemberDef *result = md.get();
2914 mn->push_back(std::move(md));
2915
2916 return result;
2917}
virtual void reclassifyMember(MemberDefMutable *md, MemberType t)=0
DString bitfields
member's bit fields
Definition entry.h:200
DString write
property write accessor
Definition entry.h:221
DString read
property read accessor
Definition entry.h:220
virtual MemberType memberType() const =0
virtual void setProtection(Protection p)=0
static void resolveTemplateInstanceInType(const Entry *root, const Definition *scope, const MemberDef *md)
Definition doxygen.cpp:5088

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberDocs(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::artificial, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bitfields, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::exception, Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberDef::getClassDef(), Definition::getLanguage(), Entry::hidden, Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, Entry::initializer, Entry::initLines, ClassDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), Entry::isStatic, Entry::lang, Entry::markAsProcessed(), Doxygen::memberNameLinkedMap, MemberDef::memberType(), Entry::metaData, Entry::mGrpId, Entry::mtype, Definition::name(), Entry::protection, MemberName::push_back(), ClassDef::qualifiedNameWithTemplateParameters(), Entry::qualifiers, Entry::read, ClassDefMutable::reclassifyMember(), removeRedundantWhiteSpace(), resolveTemplateInstanceInType(), Entry::rqli, MemberDefMutable::setProtection(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, TextStream::str(), DString::stripPrefix(), substitute(), Entry::tagInfo(), TagInfo::tagName, Entry::tArgLists, toMemberDefMutable(), MemberDef::typeString(), Entry::vhdlSpec, and Entry::write.

Referenced by addVariable().

◆ addVariableToFile()

MemberDef * addVariableToFile ( const Entry * root,
MemberType mtype,
const DString & scope,
const DString & type,
const DString & name,
const DString & args )
static

Definition at line 2921 of file doxygen.cpp.

2928{
2929 AUTO_TRACE("global variable: file='{}' type='{}' scope='{}' name='{}' args='{}' prot={} mtype={} lang={} init='{}'",
2930 root->fileName, type, scope, name, args, root->protection, mtype, root->lang, root->initializer.str());
2931
2932 FileDef *fd = root->fileDef();
2933
2934 // see if we have a typedef that should hide a struct or union
2935 if (mtype==MemberType::Typedef && Config_getBool(TYPEDEF_HIDES_STRUCT))
2936 {
2937 DString ttype = type;
2938 ttype.stripPrefix("typedef ");
2939 if (ttype.stripPrefix("struct ") || ttype.stripPrefix("record ") || ttype.stripPrefix("union "))
2940 {
2941 static const reg::Ex re(R"(\a\w*)");
2943 const std::string &typ = ttype.str();
2944 if (reg::search(typ,match,re))
2945 {
2946 DString typeValue = match.str();
2947 ClassDefMutable *cd = getClassMutable(typeValue);
2948 if (cd)
2949 {
2950 // this typedef should hide compound name cd, so we
2951 // change the name that is displayed from cd.
2952 cd->setClassName(name);
2953 cd->setDocumentation(root->doc,root->docFile,root->docLine);
2954 cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2955 return nullptr;
2956 }
2957 }
2958 }
2959 }
2960
2961 // see if the function is inside a namespace
2962 NamespaceDefMutable *nd = nullptr;
2963 if (!scope.empty())
2964 {
2965 if (scope.find('@')!=DString::npos) return nullptr; // anonymous scope!
2966 nd = getResolvedNamespaceMutable(scope);
2967 }
2968 DString def;
2969
2970 // determine the definition of the global variable
2971 if (nd && !nd->isAnonymous() &&
2972 !Config_getBool(HIDE_SCOPE_NAMES)
2973 )
2974 // variable is inside a namespace, so put the scope before the name
2975 {
2976 SrcLangExt lang = nd->getLanguage();
2978
2979 if (!type.empty())
2980 {
2981 if (root->spec.isAlias()) // turn 'typedef B NS::A' into 'using NS::A'
2982 {
2983 if (lang==SrcLangExt::Python)
2984 {
2985 def="type "+nd->name()+sep+name+args;
2986 }
2987 else
2988 {
2989 def="using "+nd->name()+sep+name;
2990 }
2991 }
2992 else // normal member
2993 {
2994 def=type+" "+nd->name()+sep+name+args;
2995 }
2996 }
2997 else
2998 {
2999 def=nd->name()+sep+name+args;
3000 }
3001 }
3002 else
3003 {
3004 if (!type.empty() && !root->name.empty())
3005 {
3006 if (name.at(0)=='@') // dummy variable representing anonymous union
3007 {
3008 def=type;
3009 }
3010 else
3011 {
3012 if (root->spec.isAlias()) // turn 'typedef B A' into 'using A'
3013 {
3014 if (root->lang==SrcLangExt::Python)
3015 {
3016 def="type "+root->name+args;
3017 }
3018 else
3019 {
3020 def="using "+root->name;
3021 }
3022 }
3023 else // normal member
3024 {
3025 def=type+" "+name+args;
3026 }
3027 }
3028 }
3029 else
3030 {
3031 def=name+args;
3032 }
3033 }
3034 def.stripPrefix("static ");
3035
3037 if (mn)
3038 {
3039 //DString nscope=removeAnonymousScopes(scope);
3040 //NamespaceDef *nd=nullptr;
3041 //if (!nscope.empty())
3042 if (!scope.empty())
3043 {
3044 nd = getResolvedNamespaceMutable(scope);
3045 }
3046 for (const auto &imd : *mn)
3047 {
3048 MemberDefMutable *md = toMemberDefMutable(imd.get());
3049 if (md &&
3050 ((nd==nullptr && md->getNamespaceDef()==nullptr && md->getFileDef() &&
3051 root->fileName==md->getFileDef()->absFilePath()
3052 ) // both variable names in the same file
3053 || (nd!=nullptr && md->getNamespaceDef()==nd) // both in same namespace
3054 )
3055 && !md->isDefine() // function style #define's can be "overloaded" by typedefs or variables
3056 && !md->isEnumerate() // in C# an enum value and enum can have the same name
3057 )
3058 // variable already in the scope
3059 {
3060 bool isPHPArray = md->getLanguage()==SrcLangExt::PHP &&
3061 md->argsString()!=args &&
3062 args.find('[')!=DString::npos;
3063 bool staticsInDifferentFiles =
3064 root->isStatic && md->isStatic() &&
3065 root->fileName!=md->getDefFileName();
3066
3067 if (md->getFileDef() &&
3068 !isPHPArray && // not a php array
3069 !staticsInDifferentFiles
3070 )
3071 // not a php array variable
3072 {
3073 AUTO_TRACE_ADD("variable already found: scope='{}'",md->getOuterScope()->name());
3074 addMemberDocs(root,md,def,nullptr,false,root->spec);
3075 md->setRefItems(root->sli);
3076 md->setRequirementReferences(root->rqli);
3077 // if md is a variable forward declaration and root is the definition that
3078 // turn md into the definition
3079 if (!root->explicitExternal && md->isExternal())
3080 {
3081 md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn());
3082 md->setExplicitExternal(false,root->fileName,root->startLine,root->startColumn);
3083 }
3084 // if md is the definition and root point at a declaration, then add the
3085 // declaration info
3086 else if (root->explicitExternal && !md->isExternal())
3087 {
3088 md->setDeclFile(root->fileName,root->startLine,root->startColumn);
3089 }
3090 return md;
3091 }
3092 }
3093 }
3094 }
3095
3096 DString fileName = root->fileName;
3097 if (fileName.empty() && root->tagInfo())
3098 {
3099 fileName = root->tagInfo()->tagName;
3100 }
3101
3102 AUTO_TRACE_ADD("new variable, namespace='{}'",nd?nd->name():DString("<global>"));
3103 // new global variable, enum value or typedef
3104 auto md = createMemberDef(
3105 fileName,root->startLine,root->startColumn,
3106 type,name,args,DString(),
3107 root->protection, Specifier::Normal,root->isStatic,Relationship::Member,
3108 mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(),
3109 root->argList, root->metaData);
3110 auto mmd = toMemberDefMutable(md.get());
3111 mmd->setTagInfo(root->tagInfo());
3112 mmd->setMemberSpecifiers(root->spec);
3113 mmd->setVhdlSpecifiers(root->vhdlSpec);
3114 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
3115 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
3116 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
3117 mmd->addSectionsToDefinition(root->anchors);
3118 mmd->setInitializer(root->initializer.str());
3119 mmd->setMaxInitLines(root->initLines);
3120 mmd->setMemberGroupId(root->mGrpId);
3121 mmd->setDefinition(def);
3122 mmd->setLanguage(root->lang);
3123 mmd->setId(root->id);
3125 mmd->setExplicitExternal(root->explicitExternal,fileName,root->startLine,root->startColumn);
3126 mmd->addQualifiers(root->qualifiers);
3127 //md->setOuterScope(fd);
3128 if (!root->explicitExternal)
3129 {
3130 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
3131 mmd->setBodyDef(fd);
3132 }
3133 addMemberToGroups(root,md.get());
3134 addIncludeFile(mmd,fd,root);
3136
3137 mmd->setRefItems(root->sli);
3138 mmd->setRequirementReferences(root->rqli);
3139 if (nd && !nd->isAnonymous())
3140 {
3141 mmd->setNamespace(nd);
3142 nd->insertMember(md.get());
3143 }
3144
3145 // add member to the file (we do this even if we have already inserted
3146 // it into the namespace.
3147 if (fd)
3148 {
3149 mmd->setFileDef(fd);
3150 fd->insertMember(md.get());
3151 }
3152
3153 root->markAsProcessed();
3154
3155 if (mtype==MemberType::Typedef)
3156 {
3157 resolveTemplateInstanceInType(root,nd,md.get());
3158 }
3159
3160 // add member definition to the list of globals
3161 MemberDef *result = md.get();
3163 mn->push_back(std::move(md));
3164
3165
3166
3167 return result;
3168}
virtual void setClassName(const DString &name)=0
virtual size_t getDefColumn() const =0
virtual bool isExternal() const =0
virtual bool isDefine() const =0
virtual void setExplicitExternal(bool b, const DString &df, int line, size_t column)=0
virtual void setDeclFile(const DString &df, int line, size_t column)=0

References FileDef::absFilePath(), LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberDocs(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, MemberDef::argsString(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::explicitExternal, Entry::fileDef(), Entry::fileName, DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, getClassMutable(), Definition::getDefColumn(), Definition::getDefFileName(), Definition::getDefLine(), MemberDef::getFileDef(), Definition::getLanguage(), getLanguageSpecificSeparator(), MemberDef::getNamespaceDef(), Definition::getOuterScope(), getResolvedNamespaceMutable(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, Entry::initializer, Entry::initLines, FileDef::insertMember(), NamespaceDefMutable::insertMember(), ModuleManager::instance(), Definition::isAnonymous(), MemberDef::isDefine(), MemberDef::isEnumerate(), MemberDef::isExternal(), Entry::isStatic, MemberDef::isStatic(), Entry::lang, Entry::markAsProcessed(), Entry::metaData, Entry::mGrpId, Definition::name(), Entry::name, DString::npos, Entry::protection, MemberName::push_back(), Entry::qualifiers, resolveTemplateInstanceInType(), Entry::rqli, reg::search(), DefinitionMutable::setBriefDescription(), ClassDefMutable::setClassName(), MemberDefMutable::setDeclFile(), DefinitionMutable::setDocumentation(), MemberDefMutable::setExplicitExternal(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, DString::str(), TextStream::str(), DString::stripPrefix(), Entry::tagInfo(), TagInfo::tagName, Entry::tArgLists, toMemberDefMutable(), and Entry::vhdlSpec.

Referenced by addVariable().

◆ adjustConfiguration()

void adjustConfiguration ( )

adjust globals that depend on configuration settings.

Definition at line 12392 of file doxygen.cpp.

12393{
12394 AUTO_TRACE();
12395 Doxygen::globalNamespaceDef = createNamespaceDef("<globalScope>",1,1,"<globalScope>");
12406
12407 setTranslator(Config_getEnum(OUTPUT_LANGUAGE));
12408
12409 /* Set the global html file extension. */
12410 Doxygen::htmlFileExtension = Config_getString(HTML_FILE_EXTENSION);
12411
12412
12414 Config_getBool(CALLER_GRAPH) ||
12415 Config_getBool(REFERENCES_RELATION) ||
12416 Config_getBool(REFERENCED_BY_RELATION);
12417
12418 /**************************************************************************
12419 * Add custom extension mappings
12420 **************************************************************************/
12421
12422 StringVector extMaps = Config_getList(EXTENSION_MAPPING);
12423 for (const auto &mapping : extMaps)
12424 {
12425 DString mapStr = mapping;
12426 if (size_t i=mapStr.find('='); i==DString::npos)
12427 {
12428 continue;
12429 }
12430 else
12431 {
12432 DString ext = mapStr.left(i).stripWhiteSpace().lower();
12433 DString language = mapStr.mid(i+1).stripWhiteSpace().lower();
12434 if (ext.empty() || language.empty())
12435 {
12436 continue;
12437 }
12438
12439 if (!updateLanguageMapping(ext,language))
12440 {
12441 err("Failed to map file extension '{}' to unsupported language '{}'.\n"
12442 "Check the EXTENSION_MAPPING setting in the config file.\n",
12443 ext,language);
12444 }
12445 else
12446 {
12447 msg("Adding custom extension mapping: '{}' will be treated as language '{}'\n",
12448 ext,language);
12449 }
12450 }
12451 }
12452 // create input file exncodings
12453
12454 // check INPUT_ENCODING
12455 void *cd = portable_iconv_open("UTF-8",Config_getString(INPUT_ENCODING).data());
12456 if (cd==reinterpret_cast<void *>(-1))
12457 {
12458 term("unsupported character conversion: '{}'->'UTF-8': {}\n"
12459 "Check the 'INPUT_ENCODING' setting in the config file!\n",
12460 Config_getString(INPUT_ENCODING),strerror(errno));
12461 }
12462 else
12463 {
12465 }
12466
12467 // check and split INPUT_FILE_ENCODING
12468 StringVector fileEncod = Config_getList(INPUT_FILE_ENCODING);
12469 for (const auto &mapping : fileEncod)
12470 {
12471 DString mapStr = mapping;
12472 if (size_t i=mapStr.find('='); i==DString::npos)
12473 {
12474 continue;
12475 }
12476 else
12477 {
12478 DString pattern = mapStr.left(i).stripWhiteSpace().lower();
12479 DString encoding = mapStr.mid(i+1).stripWhiteSpace().lower();
12480 if (pattern.empty() || encoding.empty())
12481 {
12482 continue;
12483 }
12484 cd = portable_iconv_open("UTF-8",encoding.data());
12485 if (cd==reinterpret_cast<void *>(-1))
12486 {
12487 term("unsupported character conversion: '{}'->'UTF-8': {}\n"
12488 "Check the 'INPUT_FILE_ENCODING' setting in the config file!\n",
12489 encoding,strerror(errno));
12490 }
12491 else
12492 {
12494 }
12495
12496 Doxygen::inputFileEncodingList.emplace_back(pattern, encoding);
12497 }
12498 }
12499
12500 // add predefined macro name to a dictionary
12501 StringVector expandAsDefinedList = Config_getList(EXPAND_AS_DEFINED);
12502 for (const auto &s : expandAsDefinedList)
12503 {
12505 }
12506
12507 // read aliases and store them in a dictionary
12508 readAliases();
12509
12510 // store number of spaces in a tab into Doxygen::spaces
12511 int tabSize = Config_getInt(TAB_SIZE);
12512 Doxygen::spaces.resize(tabSize);
12513 for (int sp=0; sp<tabSize; sp++) Doxygen::spaces.at(sp)=' ';
12514 Doxygen::spaces.at(tabSize)='\0';
12515}
void readAliases()
Definition aliases.cpp:162
void resize(size_t newlen)
Definition dstring.h:209
DString lower() const
Definition dstring.h:326
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
static FileNameLinkedMap * plantUmlFileNameLinkedMap
Definition doxygen.h:102
static StringUnorderedSet expandAsDefinedSet
Definition doxygen.h:112
static InputFileEncodingList inputFileEncodingList
Definition doxygen.h:131
static FileNameLinkedMap * dotFileNameLinkedMap
Definition doxygen.h:99
static FileNameLinkedMap * imageNameLinkedMap
Definition doxygen.h:98
static FileNameLinkedMap * mscFileNameLinkedMap
Definition doxygen.h:100
static FileNameLinkedMap * mermaidFileNameLinkedMap
Definition doxygen.h:103
static FileNameLinkedMap * diaFileNameLinkedMap
Definition doxygen.h:101
static DString spaces
Definition doxygen.h:126
static std::unique_ptr< NamespaceDef > globalNamespaceDef
Definition doxygen.h:113
static DString htmlFileExtension
Definition doxygen.h:115
static FileNameLinkedMap * includeNameLinkedMap
Definition doxygen.h:94
static FileNameLinkedMap * exampleNameLinkedMap
Definition doxygen.h:95
Ordered dictionary of FileName objects.
Definition filename.h:70
#define Config_getInt(name)
Definition config.h:34
#define Config_getString(name)
Definition config.h:32
#define Config_getEnum(name)
Definition config.h:35
std::vector< std::string > StringVector
Definition containers.h:33
void setTranslator(OUTPUT_LANGUAGE_t langName)
Definition language.cpp:78
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
#define term(fmt,...)
Definition message.h:137
std::unique_ptr< NamespaceDef > createNamespaceDef(const DString &defFileName, int defLine, size_t defColumn, const DString &name, const DString &ref, const DString &refFile, const DString &type, bool isPublished)
Factory method to create new NamespaceDef instance.
int portable_iconv_close(void *cd)
void * portable_iconv_open(const char *tocode, const char *fromcode)
bool updateLanguageMapping(const DString &extension, const DString &language)
Definition util.cpp:4195

References DString::at(), AUTO_TRACE, Config_getBool, Config_getEnum, Config_getInt, Config_getList, Config_getString, createNamespaceDef(), DString::data(), Doxygen::diaFileNameLinkedMap, Doxygen::dotFileNameLinkedMap, DString::empty(), err, Doxygen::exampleNameLinkedMap, Doxygen::expandAsDefinedSet, DString::find(), Doxygen::globalNamespaceDef, Doxygen::globalScope, Doxygen::htmlFileExtension, Doxygen::imageNameLinkedMap, Doxygen::includeNameLinkedMap, Doxygen::inputFileEncodingList, Doxygen::inputNameLinkedMap, DString::left(), DString::lower(), Doxygen::mermaidFileNameLinkedMap, DString::mid(), Doxygen::mscFileNameLinkedMap, msg, DString::npos, Doxygen::parseSourcesNeeded, Doxygen::plantUmlFileNameLinkedMap, portable_iconv_close(), portable_iconv_open(), readAliases(), DString::resize(), setTranslator(), Doxygen::spaces, DString::stripWhiteSpace(), term, toNamespaceDefMutable(), and updateLanguageMapping().

Referenced by main().

◆ applyMemberOverrideOptions()

void applyMemberOverrideOptions ( const Entry * root,
MemberDefMutable * md )
static

Definition at line 2422 of file doxygen.cpp.

2423{
2424 root->commandOverrides.apply_callGraph ([&](bool b) { md->overrideCallGraph(b); });
2425 root->commandOverrides.apply_callerGraph ([&](bool b) { md->overrideCallerGraph(b); });
2426 root->commandOverrides.apply_referencedByRelation([&](bool b) { md->overrideReferencedByRelation(b); });
2427 root->commandOverrides.apply_referencesRelation ([&](bool b) { md->overrideReferencesRelation(b); });
2428 root->commandOverrides.apply_inlineSource ([&](bool b) { md->overrideInlineSource(b); });
2429 root->commandOverrides.apply_enumValues ([&](bool b) { md->overrideEnumValues(b); });
2430}
virtual void overrideReferencesRelation(bool e)=0
virtual void overrideReferencedByRelation(bool e)=0
virtual void overrideCallGraph(bool e)=0
virtual void overrideInlineSource(bool e)=0
virtual void overrideEnumValues(bool e)=0
virtual void overrideCallerGraph(bool e)=0

References Entry::commandOverrides, MemberDefMutable::overrideCallerGraph(), MemberDefMutable::overrideCallGraph(), MemberDefMutable::overrideEnumValues(), MemberDefMutable::overrideInlineSource(), MemberDefMutable::overrideReferencedByRelation(), and MemberDefMutable::overrideReferencesRelation().

Referenced by addDefineDoc(), addGlobalFunction(), addInterfaceOrServiceToServiceOrSingleton(), addLocalObjCMethod(), addMemberDocs(), addMemberSpecialization(), addMethodToClass(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildFunctionList(), createUsingMemberImportForClass(), findEnums(), findMember(), and findUsingDeclImports().

◆ applyToAllDefinitions()

template<typename Func>
void applyToAllDefinitions ( Func func)
static

Definition at line 5756 of file doxygen.cpp.

5757{
5758 for (const auto &cd : *Doxygen::classLinkedMap)
5759 {
5760 ClassDefMutable *cdm = toClassDefMutable(cd.get());
5761 if (cdm)
5762 {
5763 func(cdm);
5764 }
5765 }
5766
5767 for (const auto &cd : *Doxygen::conceptLinkedMap)
5768 {
5769 ConceptDefMutable *cdm = toConceptDefMutable(cd.get());
5770 if (cdm)
5771 {
5772 func(cdm);
5773 }
5774 }
5775
5776 for (const auto &fn : *Doxygen::inputNameLinkedMap)
5777 {
5778 for (const auto &fd : *fn)
5779 {
5780 func(fd.get());
5781 }
5782 }
5783
5784 for (const auto &nd : *Doxygen::namespaceLinkedMap)
5785 {
5787 if (ndm)
5788 {
5789 func(ndm);
5790 }
5791 }
5792
5793 for (const auto &gd : *Doxygen::groupLinkedMap)
5794 {
5795 func(gd.get());
5796 }
5797
5798 for (const auto &pd : *Doxygen::pageLinkedMap)
5799 {
5800 func(pd.get());
5801 }
5802
5803 for (const auto &dd : *Doxygen::dirLinkedMap)
5804 {
5805 func(dd.get());
5806 }
5807
5808 func(&ModuleManager::instance());
5809}
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:120

References Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, Doxygen::dirLinkedMap, Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, toClassDefMutable(), toConceptDefMutable(), and toNamespaceDefMutable().

Referenced by addListReferences(), and addRequirementReferences().

◆ associateVariableWithAnonymousEnumType()

template<typename Container>
void associateVariableWithAnonymousEnumType ( const MemberDef * md,
const Container * cd,
const MemberDef * enumTypeMember,
MemberListType mlFilter )
static

Definition at line 1549 of file doxygen.cpp.

1553{
1554 if (md && md->isEnumerate() && md->name().startsWith("@")) // anonymous enum type
1555 {
1556 MemberList *eiml = cd->getMemberList(mlFilter);
1557 if (eiml)
1558 {
1559 for (const auto &eimd : *eiml)
1560 {
1561 DString vtype = eimd->typeString();
1562 if (vtype.find(md->name())!=DString::npos)
1563 {
1565 if (mimd)
1566 {
1567 mimd->setAnonymousEnumType(enumTypeMember);
1568 break;
1569 }
1570 }
1571 }
1572 }
1573 }
1574}
virtual void setAnonymousEnumType(const MemberDef *md)=0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:126

References DString::find(), MemberDef::isEnumerate(), Definition::name(), DString::npos, MemberDefMutable::setAnonymousEnumType(), DString::startsWith(), and toMemberDefMutable().

Referenced by createTagLessInstance(), and processTagLessClassesForList().

◆ buildClassDocList()

void buildClassDocList ( const Entry * root)
static

Definition at line 1165 of file doxygen.cpp.

1166{
1167 if ((root->section.isCompoundDoc()) && !root->name.empty())
1168 {
1169 AUTO_TRACE();
1170 addClassToContext(root);
1171 }
1172 for (const auto &e : root->children()) buildClassDocList(e.get());
1173}
constexpr bool isCompoundDoc() const noexcept
Definition types.h:870
static void addClassToContext(const Entry *root)
Definition doxygen.cpp:954
static void buildClassDocList(const Entry *root)
Definition doxygen.cpp:1165

References addClassToContext(), AUTO_TRACE, buildClassDocList(), Entry::children(), DString::empty(), EntryType::isCompoundDoc(), Entry::name, and Entry::section.

Referenced by buildClassDocList(), and parseInput().

◆ buildClassList()

void buildClassList ( const Entry * root)
static

Definition at line 1155 of file doxygen.cpp.

1156{
1157 if ((root->section.isCompound() || root->section.isObjcImpl()) && !root->name.empty())
1158 {
1159 AUTO_TRACE();
1160 addClassToContext(root);
1161 }
1162 for (const auto &e : root->children()) buildClassList(e.get());
1163}
static void buildClassList(const Entry *root)
Definition doxygen.cpp:1155

References addClassToContext(), AUTO_TRACE, buildClassList(), Entry::children(), DString::empty(), EntryType::isCompound(), Entry::name, and Entry::section.

Referenced by buildClassList(), and parseInput().

◆ buildCompleteMemberLists()

void buildCompleteMemberLists ( )
static

Definition at line 9000 of file doxygen.cpp.

9001{
9002 // merge the member list of base classes into the inherited classes.
9003 for (const auto &cd : *Doxygen::classLinkedMap)
9004 {
9005 if (// !cd->isReference() && // not an external class
9006 cd->subClasses().empty() && // is a root of the hierarchy
9007 !cd->baseClasses().empty()) // and has at least one base class
9008 {
9009 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9010 if (cdm)
9011 {
9012 //printf("*** merging members for %s\n",qPrint(cd->name()));
9013 cdm->mergeMembers();
9014 }
9015 }
9016 }
9017 // now sort the member list of all members for all classes.
9018 for (const auto &cd : *Doxygen::classLinkedMap)
9019 {
9020 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9021 if (cdm)
9022 {
9023 cdm->sortAllMembersList();
9024 }
9025 }
9026}
virtual void sortAllMembersList()=0
virtual void mergeMembers()=0

References Doxygen::classLinkedMap, ClassDefMutable::mergeMembers(), ClassDefMutable::sortAllMembersList(), and toClassDefMutable().

Referenced by parseInput().

◆ buildConceptDocList()

void buildConceptDocList ( const Entry * root)
static

Definition at line 1350 of file doxygen.cpp.

1351{
1352 if (root->section.isConceptDoc())
1353 {
1354 AUTO_TRACE();
1355 addConceptToContext(root);
1356 }
1357 for (const auto &e : root->children()) buildConceptDocList(e.get());
1358}
static void addConceptToContext(const Entry *root)
Definition doxygen.cpp:1179
static void buildConceptDocList(const Entry *root)
Definition doxygen.cpp:1350

References addConceptToContext(), AUTO_TRACE, buildConceptDocList(), Entry::children(), and Entry::section.

Referenced by buildConceptDocList(), and parseInput().

◆ buildConceptList()

void buildConceptList ( const Entry * root)
static

Definition at line 1340 of file doxygen.cpp.

1341{
1342 if (root->section.isConcept())
1343 {
1344 AUTO_TRACE();
1345 addConceptToContext(root);
1346 }
1347 for (const auto &e : root->children()) buildConceptList(e.get());
1348}
static void buildConceptList(const Entry *root)
Definition doxygen.cpp:1340

References addConceptToContext(), AUTO_TRACE, buildConceptList(), Entry::children(), and Entry::section.

Referenced by buildConceptList(), and parseInput().

◆ buildDefineList()

void buildDefineList ( )
static

Definition at line 9339 of file doxygen.cpp.

9340{
9341 AUTO_TRACE();
9342 for (const auto &s : g_inputFiles)
9343 {
9344 auto it = Doxygen::macroDefinitions.find(s);
9346 {
9347 for (const auto &def : it->second)
9348 {
9349 auto md = createMemberDef(
9350 def.fileName,def.lineNr,def.columnNr,
9351 "#define",def.name,def.args,DString(),
9352 Protection::Public,Specifier::Normal,false,Relationship::Member,MemberType::Define,
9353 ArgumentList(),ArgumentList(),"");
9354 auto mmd = toMemberDefMutable(md.get());
9355
9356 if (!def.args.empty())
9357 {
9358 mmd->moveArgumentList(stringToArgumentList(SrcLangExt::Cpp, def.args));
9359 }
9360 mmd->setInitializer(def.definition);
9361 mmd->setFileDef(def.fileDef);
9362 mmd->setDefinition("#define "+def.name);
9363
9365 if (def.fileDef)
9366 {
9367 const MemberList *defMl = def.fileDef->getMemberList(MemberListType::DocDefineMembers());
9368 if (defMl)
9369 {
9370 const MemberDef *defMd = defMl->findRev(def.name);
9371 if (defMd) // definition already stored
9372 {
9373 mmd->setRedefineCount(defMd->redefineCount()+1);
9374 }
9375 }
9376 def.fileDef->insertMember(md.get());
9377 }
9378 AUTO_TRACE_ADD("adding macro {} with definition {}",def.name,def.definition);
9379 mn->push_back(std::move(md));
9380 }
9381 }
9382 }
9383}
static DefinesPerFileList macroDefinitions
Definition doxygen.h:128
virtual int redefineCount() const =0
const MemberDef * findRev(const DString &name) const
Definition memberlist.h:107
static StringVector g_inputFiles
Definition doxygen.cpp:191

References LinkedMap< T, Hash, KeyEqual, Map >::add(), AUTO_TRACE, AUTO_TRACE_ADD, createMemberDef(), end(), MemberVector::findRev(), Doxygen::functionNameLinkedMap, g_inputFiles, Doxygen::macroDefinitions, MemberName::push_back(), MemberDef::redefineCount(), stringToArgumentList(), and toMemberDefMutable().

Referenced by parseInput().

◆ buildDictionaryList()

void buildDictionaryList ( const Entry * root)
static

Definition at line 3784 of file doxygen.cpp.

3785{
3786 if (!root->name.empty() &&
3787 root->section.isVariable() &&
3788 root->type.find("dictionary<")!=DString::npos // it's a dictionary
3789 )
3790 {
3791 AUTO_TRACE();
3792 addVariable(root);
3793 }
3794 for (const auto &e : root->children())
3795 if (!e->section.isEnum())
3796 buildDictionaryList(e.get());
3797}
static void buildDictionaryList(const Entry *root)
Definition doxygen.cpp:3784
static void addVariable(const Entry *root, int isFuncPtr=-1)
Definition doxygen.cpp:3445

References addVariable(), AUTO_TRACE, buildDictionaryList(), Entry::children(), DString::empty(), DString::find(), Entry::name, DString::npos, Entry::section, and Entry::type.

Referenced by buildDictionaryList(), and parseInput().

◆ buildExampleList()

void buildExampleList ( Entry * root)
static

Definition at line 10393 of file doxygen.cpp.

10394{
10395 if ((root->section.isExample() || root->section.isExampleLineno()) && !root->name.empty())
10396 {
10397 if (Doxygen::exampleLinkedMap->find(root->name))
10398 {
10399 warn(root->fileName,root->startLine,"Example {} was already documented. Ignoring documentation found here.",root->name);
10400 }
10401 else
10402 {
10404 createPageDef(root->fileName,root->startLine,
10405 root->name,root->doc+" "+root->inbodyDocs,root->args));
10406 pd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
10407 pd->setFileName(convertNameToFile(pd->name()+"-example",false,true));
10409 pd->setLanguage(root->lang);
10410 pd->setShowLineNo(root->section.isExampleLineno());
10411
10412 //we don't add example to groups
10413 //addExampleToGroups(root,pd);
10414 }
10415 }
10416 for (const auto &e : root->children()) buildExampleList(e.get());
10417}
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:91
virtual void setFileName(const DString &name)=0
virtual void setShowLineNo(bool)=0
static void buildExampleList(Entry *root)
std::unique_ptr< PageDef > createPageDef(const DString &f, int l, const DString &n, const DString &d, const DString &t)
Definition pagedef.cpp:89
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2995

References LinkedMap< T, Hash, KeyEqual, Map >::add(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, Entry::args, Entry::brief, Entry::briefFile, Entry::briefLine, buildExampleList(), Entry::children(), convertNameToFile(), createPageDef(), Entry::doc, DString::empty(), Doxygen::exampleLinkedMap, Entry::fileName, Entry::inbodyDocs, Entry::lang, Definition::name(), Entry::name, Entry::section, DefinitionMutable::setBriefDescription(), PageDef::setFileName(), DefinitionMutable::setLanguage(), PageDef::setShowLineNo(), Entry::startLine, and warn.

Referenced by buildExampleList(), and parseInput().

◆ buildFileList()

void buildFileList ( const Entry * root)
static

Definition at line 611 of file doxygen.cpp.

612{
613 if ((root->section.isFileDoc() || (root->section.isFile() && Config_getBool(EXTRACT_ALL))) &&
614 !root->name.empty() && !root->tagInfo() // skip any file coming from tag files
615 )
616 {
617 bool ambig = false;
619 if (!fd || ambig)
620 {
621 bool save_ambig = ambig;
622 // use the directory of the file to see if the described file is in the same
623 // directory as the describing file.
624 DString fn = root->fileName;
625 size_t newIndex=fn.rfind('/');
626 if (newIndex==DString::npos)
627 {
628 fn = root->name;
629 }
630 else
631 {
632 fn = fn.left(newIndex)+"/"+root->name;
633 }
635 if (!fd) ambig = save_ambig;
636 }
637 //printf("**************** root->name=%s fd=%p\n",qPrint(root->name),(void*)fd);
638 if (fd && !ambig)
639 {
640 //printf("Adding documentation!\n");
641 // using false in setDocumentation is small hack to make sure a file
642 // is documented even if a \file command is used without further
643 // documentation
644 fd->setDocumentation(root->doc,root->docFile,root->docLine,false);
645 fd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
647 fd->setRefItems(root->sli);
649 addIncludeFile(fd,fd,root);
650 root->commandOverrides.apply_includeGraph ([&](bool b) { fd->overrideIncludeGraph(b); });
651 root->commandOverrides.apply_includedByGraph([&](bool b) { fd->overrideIncludedByGraph(b); });
652 for (const Grouping &g : root->groups)
653 {
654 GroupDef *gd=nullptr;
656 {
657 if (!gd->containsFile(fd))
658 {
659 gd->addFile(fd);
660 fd->makePartOfGroup(gd);
661 //printf("File %s: in group %s\n",qPrint(fd->name()),qPrint(gd->name()));
662 }
663 }
664 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
665 {
666 warn(root->fileName, root->startLine,
667 "Found non-existing group '{}' for the command '{}', ignoring command",
669 );
670 }
671 }
672 }
673 else
674 {
675 DString text(4096, DString::ExplicitSize);
676 text.sprintf("the name '%s' supplied as "
677 "the argument in the \\file statement ",
678 qPrint(root->name));
679 if (ambig) // name is ambiguous
680 {
681 text+="matches the following input files:\n";
683 text+="\n";
684 text+="Please use a more specific name by "
685 "including a (larger) part of the path!";
686 }
687 else // name is not an input file
688 {
689 text+="is not an input file";
690 }
691 warn(root->fileName,root->startLine,"{}", text);
692 }
693 }
694 for (const auto &e : root->children()) buildFileList(e.get());
695}
@ ExplicitSize
Definition dstring.h:131
virtual void makePartOfGroup(GroupDef *gd)=0
constexpr bool isFile() const noexcept
Definition types.h:869
virtual void overrideIncludeGraph(bool e)=0
virtual void overrideIncludedByGraph(bool e)=0
virtual bool containsFile(const FileDef *def) const =0
virtual void addFile(FileDef *def)=0
static void buildFileList(const Entry *root)
Definition doxygen.cpp:611
static constexpr const char * getGroupPriName(GroupPri_t priority) noexcept
Definition types.h:240
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
GroupPri_t pri
priority of this definition
Definition types.h:258

References GroupDef::addFile(), addIncludeFile(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, Entry::brief, Entry::briefFile, Entry::briefLine, buildFileList(), Entry::children(), Entry::commandOverrides, Config_getBool, GroupDef::containsFile(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), DString::ExplicitSize, Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), FileNameLinkedMap::findFileDef(), Grouping::getGroupPriName(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, Doxygen::inputNameLinkedMap, EntryType::isFile(), DString::left(), DefinitionMutable::makePartOfGroup(), Entry::name, DString::npos, FileDef::overrideIncludedByGraph(), FileDef::overrideIncludeGraph(), Grouping::pri, qPrint(), DString::rfind(), Entry::rqli, Entry::section, DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), FileNameLinkedMap::showFileDefMatches(), Entry::sli, DString::sprintf(), Entry::startLine, Entry::tagInfo(), and warn.

Referenced by buildFileList(), and parseInput().

◆ buildFunctionList()

void buildFunctionList ( const Entry * root)
static

Definition at line 4198 of file doxygen.cpp.

4199{
4200 if (root->section.isFunction())
4201 {
4202 AUTO_TRACE("member function: type='{}' scope='{}' name='{}' args='{}' relates='{}' relatesType='{}'"
4203 " file='{}' line={} bodyLine={} #tArgLists={} mGrpId={}"
4204 " spec={} proto={} docFile='{}'",
4205 root->type, root->parent()->name, root->name, root->args, root->relates, root->relatesType,
4206 root->fileName, root->startLine, root->bodyLine, root->tArgLists.size(), root->mGrpId,
4207 root->spec, root->proto, root->docFile);
4208
4209 bool isFriend=root->type=="friend" || root->type.find("friend ")!=DString::npos;
4210 DString rname = removeRedundantWhiteSpace(root->name);
4211 //printf("rname=%s\n",qPrint(rname));
4212
4213 DString scope;
4214 int index = computeQualifiedIndex(rname);
4215 if (index!=-1 && root->parent()->section.isGroupDoc() && root->parent()->tagInfo())
4216 // grouped members are stored with full scope
4217 {
4218 buildScopeFromQualifiedName(rname.left(index+2),root->lang,root->tagInfo());
4219 scope=rname.left(index);
4220 rname=rname.mid(index+2);
4221 }
4222 else
4223 {
4224 scope=root->parent()->name; //stripAnonymousNamespaceScope(root->parent->name);
4225 }
4226 if (!rname.empty() && scope.find('@')==DString::npos)
4227 {
4228 // check if this function's parent is a class
4229 if (root->lang==SrcLangExt::CSharp)
4230 {
4231 scope=mangleCSharpGenericName(scope);
4232 }
4233 else
4234 {
4235 scope=stripTemplateSpecifiersFromScope(scope,false);
4236 }
4237
4238 FileDef *rfd=root->fileDef();
4239
4240 size_t memIndex=rname.rfind("::");
4241
4243 if (cd && scope+"::"==rname.left(scope.length()+2)) // found A::f inside A
4244 {
4245 // strip scope from name
4246 rname=rname.mid(root->parent()->name.length()+2);
4247 }
4248
4249 bool isMember=false;
4250 if (memIndex!=DString::npos)
4251 {
4252 size_t ts=rname.find('<');
4253 size_t te=rname.find('>');
4254 if (memIndex>0 && (ts==DString::npos || te==DString::npos))
4255 {
4256 // note: the following code was replaced by inMember=true to deal with a
4257 // function rname='X::foo' of class X inside a namespace also called X...
4258 // bug id 548175
4259 //nd = Doxygen::namespaceLinkedMap->find(rname.left(memIndex));
4260 //isMember = nd==nullptr;
4261 //if (nd)
4262 //{
4263 // // strip namespace scope from name
4264 // scope=rname.left(memIndex);
4265 // rname=rname.mid(memIndex+2);
4266 //}
4267 isMember = true;
4268 }
4269 else
4270 {
4271 isMember=memIndex<ts || memIndex>te;
4272 }
4273 }
4274
4275 if (!root->parent()->name.empty() && root->parent()->section.isCompound() && cd)
4276 {
4277 AUTO_TRACE_ADD("member '{}' of class '{}'", rname,cd->name());
4278 addMethodToClass(root,cd,root->type,rname,root->args,isFriend,
4279 root->protection,root->isStatic,root->virt,root->spec,root->relates);
4280 }
4281 else if (root->parent()->section.isObjcImpl() && cd)
4282 {
4283 const MemberDef *md = cd->getMemberByName(rname);
4284 if (md)
4285 {
4286 MemberDefMutable *mdm = toMemberDefMutable(const_cast<MemberDef*>(md));
4287 if (mdm)
4288 {
4289 mdm->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
4290 mdm->setBodyDef(root->fileDef());
4291 }
4292 }
4293 }
4294 else if (!root->parent()->section.isCompound() && !root->parent()->section.isObjcImpl() &&
4295 !isMember &&
4296 (root->relates.empty() || root->relatesType==RelatesType::Duplicate) &&
4297 !root->type.startsWith("extern ") && !root->type.startsWith("typedef ")
4298 )
4299 // no member => unrelated function
4300 {
4301 /* check the uniqueness of the function name in the file.
4302 * A file could contain a function prototype and a function definition
4303 * or even multiple function prototypes.
4304 */
4305 bool found=false;
4306 MemberDef *md_found=nullptr;
4308 if (mn)
4309 {
4310 AUTO_TRACE_ADD("function '{}' already found",rname);
4311 for (const auto &imd : *mn)
4312 {
4313 MemberDefMutable *md = toMemberDefMutable(imd.get());
4314 if (md)
4315 {
4316 const NamespaceDef *mnd = md->getNamespaceDef();
4317 NamespaceDef *rnd = nullptr;
4318 //printf("root namespace=%s\n",qPrint(rootNav->parent()->name()));
4319 DString fullScope = scope;
4320 DString parentScope = root->parent()->name;
4321 if (!parentScope.empty() && !leftScopeMatch(parentScope,scope))
4322 {
4323 if (!scope.empty()) fullScope.prepend("::");
4324 fullScope.prepend(parentScope);
4325 }
4326 //printf("fullScope=%s\n",qPrint(fullScope));
4327 rnd = getResolvedNamespace(fullScope);
4328 const FileDef *mfd = md->getFileDef();
4329 DString nsName,rnsName;
4330 if (mnd) nsName = mnd->name();
4331 if (rnd) rnsName = rnd->name();
4332 //printf("matching arguments for %s%s %s%s\n",
4333 // qPrint(md->name()),md->argsString(),qPrint(rname),qPrint(argListToString(root->argList)));
4334 const ArgumentList &mdAl = md->argumentList();
4335 const ArgumentList &mdTempl = md->templateArguments();
4336
4337 // in case of template functions, we need to check if the
4338 // functions have the same number of template parameters
4339 bool sameTemplateArgs = true;
4340 bool matchingReturnTypes = true;
4341 bool sameRequiresClause = true;
4342 if (!mdTempl.empty() && !root->tArgLists.empty())
4343 {
4344 sameTemplateArgs = matchTemplateArguments(mdTempl,root->tArgLists.back());
4345 if (md->typeString()!=removeRedundantWhiteSpace(root->type))
4346 {
4347 matchingReturnTypes = false;
4348 }
4349 if (md->requiresClause()!=root->req)
4350 {
4351 sameRequiresClause = false;
4352 }
4353 }
4354 else if (!mdTempl.empty() || !root->tArgLists.empty())
4355 { // if one has template parameters and the other doesn't then that also counts as a
4356 // difference
4357 sameTemplateArgs = false;
4358 }
4359
4360 bool staticsInDifferentFiles =
4361 root->isStatic && md->isStatic() && root->fileName!=md->getDefFileName();
4362
4363 if (sameTemplateArgs &&
4364 matchingReturnTypes &&
4365 sameRequiresClause &&
4366 !staticsInDifferentFiles &&
4367 matchArguments2(md->getOuterScope(),mfd,md->typeString(),&mdAl,
4368 rnd ? rnd : Doxygen::globalScope,rfd,root->type,&root->argList,
4369 false,root->lang)
4370 )
4371 {
4372 GroupDef *gd=nullptr;
4373 if (!root->groups.empty() && !root->groups.front().groupname.empty())
4374 {
4375 gd = Doxygen::groupLinkedMap->find(root->groups.front().groupname);
4376 }
4377 //printf("match!\n");
4378 //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,qPrint(nsName),qPrint(rnsName));
4379 // see if we need to create a new member
4380 found=(mnd && rnd && nsName==rnsName) || // members are in the same namespace
4381 ((mnd==nullptr && rnd==nullptr && mfd!=nullptr && // no external reference and
4382 mfd->absFilePath()==root->fileName // prototype in the same file
4383 )
4384 );
4385 // otherwise, allow a duplicate global member with the same argument list
4386 if (!found && gd && gd==md->getGroupDef() && nsName==rnsName)
4387 {
4388 // member is already in the group, so we don't want to add it again.
4389 found=true;
4390 }
4391
4392 AUTO_TRACE_ADD("combining function with prototype found={} in namespace '{}'",found,nsName);
4393
4394 if (found)
4395 {
4396 // merge argument lists
4397 ArgumentList mergedArgList = root->argList;
4398 mergeArguments(const_cast<ArgumentList&>(mdAl),mergedArgList,!root->doc.empty());
4399 // merge documentation
4400 if (md->documentation().empty() && !root->doc.empty())
4401 {
4402 if (root->proto)
4403 {
4405 }
4406 else
4407 {
4409 }
4410 }
4411
4412 md->setDocumentation(root->doc,root->docFile,root->docLine);
4414 md->setDocsForDefinition(!root->proto);
4415 if (md->getStartBodyLine()==-1 && root->bodyLine!=-1)
4416 {
4417 md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
4418 md->setBodyDef(rfd);
4419 }
4420
4421 if (md->briefDescription().empty() && !root->brief.empty())
4422 {
4423 md->setArgsString(root->args);
4424 }
4425 md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
4426
4428
4430 md->addQualifiers(root->qualifiers);
4431
4432 // merge ingroup specifiers
4433 if (md->getGroupDef()==nullptr && !root->groups.empty())
4434 {
4435 addMemberToGroups(root,md);
4436 }
4437 else if (md->getGroupDef()!=nullptr && root->groups.empty())
4438 {
4439 //printf("existing member is grouped, new member not\n");
4440 }
4441 else if (md->getGroupDef()!=nullptr && !root->groups.empty())
4442 {
4443 //printf("both members are grouped\n");
4444 }
4446
4447 // if md is a declaration and root is the corresponding
4448 // definition, then turn md into a definition.
4449 if (md->isPrototype() && !root->proto)
4450 {
4451 md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn());
4452 md->setPrototype(false,root->fileName,root->startLine,root->startColumn);
4453 }
4454 // if md is already the definition, then add the declaration info
4455 else if (!md->isPrototype() && root->proto)
4456 {
4457 md->setDeclFile(root->fileName,root->startLine,root->startColumn);
4458 }
4459 }
4460 }
4461 }
4462 if (found)
4463 {
4464 md_found = md;
4465 break;
4466 }
4467 }
4468 }
4469 if (!found) /* global function is unique with respect to the file */
4470 {
4471 addGlobalFunction(root,rname,scope);
4472 }
4473 else
4474 {
4475 FileDef *fd=root->fileDef();
4476 if (fd)
4477 {
4478 // add member to the file (we do this even if we have already
4479 // inserted it into the namespace)
4480 fd->insertMember(md_found);
4481 }
4482 }
4483
4484 AUTO_TRACE_ADD("unrelated function type='{}' name='{}' args='{}'",root->type,rname,root->args);
4485 }
4486 else
4487 {
4488 AUTO_TRACE_ADD("function '{}' is not processed",rname);
4489 }
4490 }
4491 else if (rname.empty())
4492 {
4493 warn(root->fileName,root->startLine,
4494 "Illegal member name found."
4495 );
4496 }
4497 }
4498 for (const auto &e : root->children()) buildFunctionList(e.get());
4499}
virtual const MemberDef * getMemberByName(const DString &) const =0
Returns the member with the given name.
virtual DString briefDescription(bool abbreviate=false) const =0
virtual DString documentation() const =0
virtual bool isPrototype() const =0
virtual void setArgsString(const DString &as)=0
virtual void setPrototype(bool p, const DString &df, int line, size_t column)=0
virtual void moveDeclArgumentList(std::unique_ptr< ArgumentList > al)=0
static void buildFunctionList(const Entry *root)
Definition doxygen.cpp:4198
static void addGlobalFunction(const Entry *root, const DString &rname, const DString &sc)
Definition doxygen.cpp:4088
bool matchTemplateArguments(const ArgumentList &srcAl, const ArgumentList &dstAl)
Definition util.cpp:1893

References FileDef::absFilePath(), addGlobalFunction(), addMemberToGroups(), ModuleManager::addMemberToModule(), addMethodToClass(), MemberDefMutable::addQualifiers(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, Entry::args, MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Definition::briefDescription(), Entry::briefFile, Entry::briefLine, buildFunctionList(), buildScopeFromQualifiedName(), Entry::children(), computeQualifiedIndex(), Entry::doc, Entry::docFile, Entry::docLine, Definition::documentation(), ArgumentList::empty(), DString::empty(), Entry::endBodyLine, Entry::fileDef(), Entry::fileName, DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, getClassMutable(), Definition::getDefColumn(), Definition::getDefFileName(), Definition::getDefLine(), MemberDef::getFileDef(), MemberDef::getGroupDef(), ClassDef::getMemberByName(), MemberDef::getNamespaceDef(), Definition::getOuterScope(), getResolvedNamespace(), Definition::getStartBodyLine(), Doxygen::globalScope, Doxygen::groupLinkedMap, Entry::groups, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, FileDef::insertMember(), ModuleManager::instance(), EntryType::isCompound(), MemberDef::isPrototype(), Entry::isStatic, MemberDef::isStatic(), Entry::lang, DString::left(), leftScopeMatch(), DString::length(), mangleCSharpGenericName(), matchArguments2(), matchTemplateArguments(), mergeArguments(), Entry::mGrpId, DString::mid(), MemberDefMutable::moveArgumentList(), MemberDefMutable::moveDeclArgumentList(), Definition::name(), Entry::name, DString::npos, Entry::parent(), DString::prepend(), Entry::protection, Entry::proto, Entry::qualifiers, Entry::relates, Entry::relatesType, removeRedundantWhiteSpace(), Entry::req, MemberDef::requiresClause(), DString::rfind(), Entry::section, MemberDefMutable::setArgsString(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDeclFile(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setPrototype(), Entry::spec, Entry::startColumn, Entry::startLine, DString::startsWith(), stringToArgumentList(), stripTemplateSpecifiersFromScope(), Entry::tagInfo(), Entry::tArgLists, MemberDef::templateArguments(), toMemberDefMutable(), Entry::type, MemberDef::typeString(), Entry::virt, and warn.

Referenced by buildFunctionList(), and parseInput().

◆ buildGroupList()

void buildGroupList ( const Entry * root)
static

Definition at line 540 of file doxygen.cpp.

541{
542 // --- first process only local groups
543 // first process the @defgroups blocks
544 buildGroupListFiltered(root,false,false);
545 // then process the @addtogroup, @weakgroup blocks
546 buildGroupListFiltered(root,true,false);
547
548 // --- then also process external groups
549 // first process the @defgroups blocks
550 buildGroupListFiltered(root,false,true);
551 // then process the @addtogroup, @weakgroup blocks
552 buildGroupListFiltered(root,true,true);
553}
static void buildGroupListFiltered(const Entry *root, bool additional, bool includeExternal)
Definition doxygen.cpp:467

References buildGroupListFiltered().

Referenced by parseInput().

◆ buildGroupListFiltered()

void buildGroupListFiltered ( const Entry * root,
bool additional,
bool includeExternal )
static

Definition at line 467 of file doxygen.cpp.

468{
469 if (root->section.isGroupDoc() && !root->name.empty() &&
470 ((!includeExternal && root->tagInfo()==nullptr) ||
471 ( includeExternal && root->tagInfo()!=nullptr))
472 )
473 {
474 AUTO_TRACE("additional={} includeExternal={}",additional,includeExternal);
475 if ((root->groupDocType==Entry::GROUPDOC_NORMAL && !additional) ||
476 (root->groupDocType!=Entry::GROUPDOC_NORMAL && additional))
477 {
479 AUTO_TRACE_ADD("Processing group '{}':'{}' gd={}", root->type,root->name,(void*)gd);
480
481 if (gd)
482 {
483 if ( !gd->hasGroupTitle() )
484 {
485 gd->setGroupTitle( root->type );
486 }
487 else if ( root->type.length() > 0 && root->name != root->type && gd->groupTitle() != root->type )
488 {
489 warn( root->fileName,root->startLine,
490 "group {}: ignoring title \"{}\" that does not match old title \"{}\"",
491 root->name, root->type, gd->groupTitle() );
492 }
493 gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
494 gd->setDocumentation( root->doc, root->docFile, root->docLine );
495 gd->setInbodyDocumentation( root->inbodyDocs, root->inbodyFile, root->inbodyLine );
497 gd->setRefItems(root->sli);
499 gd->setLanguage(root->lang);
501 {
502 root->commandOverrides.apply_groupGraph([&](bool b) { gd->overrideGroupGraph(b); });
503 }
504 addIncludeFile(gd,nullptr,root);
505 }
506 else
507 {
508 if (root->tagInfo())
509 {
510 gd = Doxygen::groupLinkedMap->add(root->name,
511 std::unique_ptr<GroupDef>(
512 createGroupDef(root->fileName,root->startLine,root->name,root->type,root->tagInfo()->fileName)));
513 gd->setReference(root->tagInfo()->tagName);
514 }
515 else
516 {
517 gd = Doxygen::groupLinkedMap->add(root->name,
518 std::unique_ptr<GroupDef>(
519 createGroupDef(root->fileName,root->startLine,root->name,root->type)));
520 }
521 gd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
522 // allow empty docs for group
523 gd->setDocumentation(!root->doc.empty() ? root->doc : DString(" "),root->docFile,root->docLine,false);
524 gd->setInbodyDocumentation( root->inbodyDocs, root->inbodyFile, root->inbodyLine );
526 gd->setRefItems(root->sli);
528 gd->setLanguage(root->lang);
529 addIncludeFile(gd,nullptr,root);
531 {
532 root->commandOverrides.apply_groupGraph([&](bool b) { gd->overrideGroupGraph(b); });
533 }
534 }
535 }
536 }
537 for (const auto &e : root->children()) buildGroupListFiltered(e.get(),additional,includeExternal);
538}
virtual void setReference(const DString &r)=0
GroupDocType groupDocType
Definition entry.h:240
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:128
virtual DString groupTitle() const =0
virtual void overrideGroupGraph(bool e)=0
virtual void setGroupTitle(const DString &newtitle)=0
virtual bool hasGroupTitle() const =0
std::unique_ptr< GroupDef > createGroupDef(const DString &fileName, int line, const DString &name, const DString &title, const DString &refFileName)
Definition groupdef.cpp:184

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, AUTO_TRACE, AUTO_TRACE_ADD, Entry::brief, Entry::briefFile, Entry::briefLine, buildGroupListFiltered(), Entry::children(), Entry::commandOverrides, createGroupDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::fileName, TagInfo::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), Entry::GROUPDOC_NORMAL, Entry::groupDocType, Doxygen::groupLinkedMap, GroupDef::groupTitle(), GroupDef::hasGroupTitle(), Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, Entry::lang, DString::length(), Entry::name, GroupDef::overrideGroupGraph(), Entry::rqli, Entry::section, DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), GroupDef::setGroupTitle(), DefinitionMutable::setInbodyDocumentation(), DefinitionMutable::setLanguage(), DefinitionMutable::setReference(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, Entry::startLine, Entry::tagInfo(), TagInfo::tagName, Entry::type, and warn.

Referenced by buildGroupList(), and buildGroupListFiltered().

◆ buildInterfaceAndServiceList()

void buildInterfaceAndServiceList ( const Entry * root)
static

Definition at line 3899 of file doxygen.cpp.

3900{
3901 if (root->section.isExportedInterface() || root->section.isIncludedService())
3902 {
3903 AUTO_TRACE("Exported interface/included service: type='{}' scope='{}' name='{}' args='{}'"
3904 " relates='{}' relatesType='{}' file='{}' line={} bodyLine={} #tArgLists={}"
3905 " mGrpId={} spec={} proto={} docFile='{}'",
3906 root->type, root->parent()->name, root->name, root->args,
3907 root->relates, root->relatesType, root->fileName, root->startLine, root->bodyLine, root->tArgLists.size(),
3908 root->mGrpId, root->spec, root->proto, root->docFile);
3909
3910 DString rname = removeRedundantWhiteSpace(root->name);
3911
3912 if (!rname.empty())
3913 {
3914 DString scope = root->parent()->name;
3915 ClassDefMutable *cd = getClassMutable(scope);
3916 ASSERT(cd);
3917 if (cd && ((ClassDef::Interface == cd->compoundType()) ||
3918 (ClassDef::Service == cd->compoundType()) ||
3920 {
3922 }
3923 else
3924 {
3925 ASSERT(false); // was checked by scanner.l
3926 }
3927 }
3928 else if (rname.empty())
3929 {
3930 warn(root->fileName,root->startLine,
3931 "Illegal member name found.");
3932 }
3933 }
3934 // can only have these in IDL anyway
3935 switch (root->lang)
3936 {
3937 case SrcLangExt::Unknown: // fall through (root node always is Unknown)
3938 case SrcLangExt::IDL:
3939 for (const auto &e : root->children()) buildInterfaceAndServiceList(e.get());
3940 break;
3941 default:
3942 return; // nothing to do here
3943 }
3944}
@ Singleton
Definition classdef.h:114
@ Interface
Definition classdef.h:109
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e. class/struct/union/...
static void addInterfaceOrServiceToServiceOrSingleton(const Entry *root, ClassDefMutable *cd, DString const &rname)
Definition doxygen.cpp:3835
static void buildInterfaceAndServiceList(const Entry *root)
Definition doxygen.cpp:3899
#define ASSERT(x)
Definition message.h:142

References addInterfaceOrServiceToServiceOrSingleton(), Entry::args, ASSERT, AUTO_TRACE, Entry::bodyLine, buildInterfaceAndServiceList(), Entry::children(), ClassDef::compoundType(), Entry::docFile, DString::empty(), Entry::fileName, getClassMutable(), ClassDef::Interface, Entry::lang, Entry::mGrpId, Entry::name, Entry::parent(), Entry::proto, Entry::relates, Entry::relatesType, removeRedundantWhiteSpace(), Entry::section, ClassDef::Service, ClassDef::Singleton, Entry::spec, Entry::startLine, Entry::tArgLists, Entry::type, and warn.

Referenced by buildInterfaceAndServiceList(), and parseInput().

◆ buildListOfUsingDecls()

void buildListOfUsingDecls ( const Entry * root)
static

Definition at line 2317 of file doxygen.cpp.

2318{
2319 if (root->section.isUsingDecl() &&
2320 !root->parent()->section.isCompound() // not a class/struct member
2321 )
2322 {
2323 DString name = substitute(root->name,".","::");
2324 g_usingDeclarations.insert(name.str());
2325 }
2326 for (const auto &e : root->children()) buildListOfUsingDecls(e.get());
2327}
static StringSet g_usingDeclarations
Definition doxygen.cpp:193
static void buildListOfUsingDecls(const Entry *root)
Definition doxygen.cpp:2317

References buildListOfUsingDecls(), Entry::children(), g_usingDeclarations, EntryType::isCompound(), Entry::name, Entry::parent(), Entry::section, and substitute().

Referenced by buildListOfUsingDecls(), and parseInput().

◆ buildNamespaceList()

void buildNamespaceList ( const Entry * root)
static

Definition at line 1989 of file doxygen.cpp.

1990{
1991 if (
1992 (root->section.isNamespace() ||
1993 root->section.isNamespaceDoc() ||
1994 root->section.isPackageDoc()
1995 ) &&
1996 !root->name.empty()
1997 )
1998 {
1999 AUTO_TRACE("name={}",root->name);
2000
2001 DString fName = root->name;
2002 if (root->section.isPackageDoc())
2003 {
2004 fName=substitute(fName,".","::");
2005 }
2006
2007 DString fullName = stripAnonymousNamespaceScope(fName);
2008 if (!fullName.empty())
2009 {
2010 AUTO_TRACE_ADD("Found namespace {} in {} at line {}",root->name,root->fileName,root->startLine);
2012 if (ndi) // existing namespace
2013 {
2015 if (nd) // non-inline namespace
2016 {
2017 AUTO_TRACE_ADD("Existing namespace");
2018 nd->setDocumentation(root->doc,root->docFile,root->docLine);
2019 nd->setName(fullName); // change name to match docs
2021 nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2022 if (nd->getLanguage()==SrcLangExt::Unknown)
2023 {
2024 nd->setLanguage(root->lang);
2025 }
2026 if (root->tagInfo()==nullptr && nd->isReference() && !(root->doc.empty() && root->brief.empty()))
2027 // if we previously found namespace nd in a tag file and now we find a
2028 // documented namespace with the same name in the project, then remove
2029 // the tag file reference
2030 {
2031 nd->setReference("");
2032 nd->setFileName(fullName);
2033 }
2034 nd->setMetaData(root->metaData);
2035
2036 // file definition containing the namespace nd
2037 FileDef *fd=root->fileDef();
2038 if (nd->isArtificial())
2039 {
2040 nd->setArtificial(false); // found namespace explicitly, so cannot be artificial
2041 nd->setDefFile(root->fileName,root->startLine,root->startColumn);
2042 }
2043 // insert the namespace in the file definition
2044 if (fd) fd->insertNamespace(nd);
2045 addNamespaceToGroups(root,nd);
2046 nd->setRefItems(root->sli);
2047 nd->setRequirementReferences(root->rqli);
2048 addIncludeFile(nd,fd,root);
2049 }
2050 }
2051 else // fresh namespace
2052 {
2053 DString tagName;
2054 DString tagFileName;
2055 const TagInfo *tagInfo = root->tagInfo();
2056 if (tagInfo)
2057 {
2058 tagName = tagInfo->tagName;
2059 tagFileName = tagInfo->fileName;
2060 }
2061 AUTO_TRACE_ADD("new namespace {} lang={} tagName={}",fullName,root->lang,tagName);
2062 // add namespace to the list
2064 Doxygen::namespaceLinkedMap->add(fullName,
2065 createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine,
2066 root->startColumn,fullName,tagName,tagFileName,
2067 root->type,root->spec.isPublished())));
2068 if (nd)
2069 {
2070 nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
2071 nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2073 nd->setHidden(root->hidden);
2074 nd->setArtificial(root->artificial);
2075 nd->setLanguage(root->lang);
2076 nd->setId(root->id);
2077 nd->setMetaData(root->metaData);
2078 nd->setInline(root->spec.isInline());
2079 nd->setExported(root->exported);
2080
2081 addNamespaceToGroups(root,nd);
2082 nd->setRefItems(root->sli);
2083 nd->setRequirementReferences(root->rqli);
2084
2085 // file definition containing the namespace nd
2086 FileDef *fd=root->fileDef();
2087 // insert the namespace in the file definition
2088 if (fd) fd->insertNamespace(nd);
2089
2090 // the empty string test is needed for extract all case
2091 nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2092 nd->insertUsedFile(fd);
2093 nd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
2094 nd->setBodyDef(fd);
2095 addIncludeFile(nd,fd,root);
2096
2097 // also add namespace to the correct structural context
2098 Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName,nullptr,tagInfo);
2099 AUTO_TRACE_ADD("adding namespace {} to context {}",nd->name(),d ? d->name() : DString("<none>"));
2100 if (d==nullptr) // we didn't find anything, create the scope artificially
2101 // anyway, so we can at least relate scopes properly.
2102 {
2103 d = buildScopeFromQualifiedName(fullName,nd->getLanguage(),tagInfo);
2105 if (dm)
2106 {
2107 dm->addInnerCompound(nd);
2108 }
2109 nd->setOuterScope(d);
2110 // TODO: Due to the order in which the tag file is written
2111 // a nested class can be found before its parent!
2112 }
2113 else
2114 {
2116 if (dm)
2117 {
2118 dm->addInnerCompound(nd);
2119 }
2120 nd->setOuterScope(d);
2121 // in case of d is an inline namespace, alias insert nd in the part scope of d.
2123 {
2124 NamespaceDef *pnd = toNamespaceDef(d);
2125 if (pnd && pnd->isInline())
2126 {
2127 d = d->getOuterScope();
2128 if (d)
2129 {
2130 dm = toDefinitionMutable(d);
2131 if (dm)
2132 {
2133 auto aliasNd = createNamespaceDefAlias(d,nd);
2134 dm->addInnerCompound(aliasNd.get());
2135 DString aliasName = aliasNd->name();
2136 AUTO_TRACE_ADD("adding alias {} to {}",aliasName,d->name());
2137 Doxygen::namespaceLinkedMap->add(aliasName,std::move(aliasNd));
2138 }
2139 }
2140 else
2141 {
2142 break;
2143 }
2144 }
2145 else
2146 {
2147 break;
2148 }
2149 }
2150 }
2151 }
2152 }
2153 }
2154 }
2155 for (const auto &e : root->children()) buildNamespaceList(e.get());
2156}
virtual bool isReference() const =0
virtual void setName(const DString &name)=0
virtual void setExported(bool b)=0
bool exported
is the symbol exported from a C++20 module
Definition entry.h:196
virtual void insertNamespace(NamespaceDef *nd)=0
virtual bool isInline() const =0
virtual void insertUsedFile(FileDef *fd)=0
virtual void setFileName(const DString &fn)=0
virtual void setMetaData(const DString &m)=0
virtual void setInline(bool isInline)=0
static void buildNamespaceList(const Entry *root)
Definition doxygen.cpp:1989
void addNamespaceToGroups(const Entry *root, NamespaceDef *nd)
std::unique_ptr< NamespaceDef > createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd)
Factory method to create an alias of an existing namespace.
NamespaceDef * toNamespaceDef(Definition *d)

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), DefinitionMutable::addInnerCompound(), addNamespaceToGroups(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, Entry::artificial, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, buildNamespaceList(), buildScopeFromQualifiedName(), Entry::children(), createNamespaceDef(), createNamespaceDefAlias(), Definition::definitionType(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::exported, Entry::fileDef(), Entry::fileName, TagInfo::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findScopeFromQualifiedName(), Definition::getLanguage(), Definition::getOuterScope(), Doxygen::globalScope, Entry::hidden, Entry::id, FileDef::insertNamespace(), NamespaceDefMutable::insertUsedFile(), Definition::isArtificial(), NamespaceDef::isInline(), Definition::isReference(), Entry::lang, Entry::metaData, Definition::name(), Entry::name, Doxygen::namespaceLinkedMap, Entry::rqli, Entry::section, DefinitionMutable::setArtificial(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), DefinitionMutable::setDefFile(), DefinitionMutable::setDocumentation(), DefinitionMutable::setExported(), NamespaceDefMutable::setFileName(), DefinitionMutable::setHidden(), DefinitionMutable::setId(), NamespaceDefMutable::setInline(), DefinitionMutable::setLanguage(), NamespaceDefMutable::setMetaData(), DefinitionMutable::setName(), DefinitionMutable::setOuterScope(), DefinitionMutable::setReference(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, stripAnonymousNamespaceScope(), substitute(), Entry::tagInfo(), TagInfo::tagName, toDefinitionMutable(), toNamespaceDef(), toNamespaceDefMutable(), Entry::type, and Definition::TypeNamespace.

Referenced by buildNamespaceList(), and parseInput().

◆ buildPageList()

void buildPageList ( Entry * root)
static

Definition at line 10149 of file doxygen.cpp.

10150{
10151 if (root->section.isPageDoc())
10152 {
10153 if (!root->name.empty())
10154 {
10155 addRelatedPage(root);
10156 }
10157 }
10158 else if (root->section.isMainpageDoc())
10159 {
10160 DString title=root->args.stripWhiteSpace();
10161 if (title.empty()) title=theTranslator->trMainPage();
10162 //DString name = Config_getBool(GENERATE_TREEVIEW)?"main":"index";
10163 DString name = "index";
10164 addRefItem(root->sli,
10165 name,
10166 theTranslator->trPage(true,true),
10167 name,
10168 title,
10169 DString(),nullptr
10170 );
10171 }
10172 for (const auto &e : root->children()) buildPageList(e.get());
10173}
virtual DString trPage(bool first_capital, bool singular)=0
virtual DString trMainPage()=0
static void buildPageList(Entry *root)
void addRefItem(const RefItemVector &sli, const DString &key, const DString &prefix, const DString &name, const DString &title, const DString &args, const Definition *scope)
Definition reflist.h:136

References addRefItem(), addRelatedPage(), Entry::args, buildPageList(), Entry::children(), DString::empty(), Entry::name, Entry::section, Entry::sli, DString::stripWhiteSpace(), theTranslator, Translator::trMainPage(), and Translator::trPage().

Referenced by buildPageList(), and parseInput().

◆ buildRequirementsList()

void buildRequirementsList ( Entry * root)
static

Definition at line 10137 of file doxygen.cpp.

10138{
10139 if (root->section.isRequirementDoc())
10140 {
10142 }
10143 for (const auto &e : root->children()) buildRequirementsList(e.get());
10144}
static RequirementManager & instance()
void addRequirement(Entry *e)
static void buildRequirementsList(Entry *root)

References RequirementManager::addRequirement(), buildRequirementsList(), Entry::children(), RequirementManager::instance(), and Entry::section.

Referenced by buildRequirementsList(), and parseInput().

◆ buildScopeFromQualifiedName()

Definition * buildScopeFromQualifiedName ( const DString & name_,
SrcLangExt lang,
const TagInfo * tagInfo )
static

returns the Definition object belonging to the first level levels of full qualified name name. Creates an artificial scope if the scope is not found and set the parent/child scope relation if the scope is found.

Definition at line 724 of file doxygen.cpp.

725{
727 name.stripPrefix("::");
728 int level = name.contains("::");
729 //printf("buildScopeFromQualifiedName(%s) level=%d\n",qPrint(name),level);
730 int i=0, p=0, l=0;
732 DString fullScope;
733 while (i<level)
734 {
735 int idx=getScopeFragment(name,p,&l);
736 if (idx==-1) return prevScope;
737 DString nsName = name.mid(idx,l);
738 if (nsName.empty()) return prevScope;
739 if (!fullScope.empty()) fullScope+="::";
740 fullScope+=nsName;
742 DefinitionMutable *innerScope = toDefinitionMutable(nd);
743 ClassDef *cd=nullptr;
744 if (nd==nullptr) cd = getClass(fullScope);
745 if (nd==nullptr && cd) // scope is a class
746 {
747 innerScope = toDefinitionMutable(cd);
748 }
749 else if (nd==nullptr && cd==nullptr && fullScope.find('<')==DString::npos) // scope is not known and could be a namespace!
750 {
751 // introduce bogus namespace
752 //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),(void*)tagInfo);
753 NamespaceDefMutable *newNd=
755 Doxygen::namespaceLinkedMap->add(fullScope,
757 "[generated]",1,1,fullScope,
758 tagInfo?tagInfo->tagName:DString(),
759 tagInfo?tagInfo->fileName:DString())));
760 if (newNd)
761 {
762 newNd->setLanguage(lang);
763 newNd->setArtificial(true);
764 // add namespace to the list
765 innerScope = newNd;
766 }
767 }
768 else // scope is a namespace
769 {
770 }
771 if (innerScope)
772 {
773 // make the parent/child scope relation
774 DefinitionMutable *prevScopeMutable = toDefinitionMutable(prevScope);
775 if (prevScopeMutable)
776 {
777 prevScopeMutable->addInnerCompound(toDefinition(innerScope));
778 }
779 innerScope->setOuterScope(prevScope);
780 }
781 else // current scope is a class, so return only the namespace part...
782 {
783 return prevScope;
784 }
785 // proceed to the next scope fragment
786 p=idx+l+2;
787 prevScope=toDefinition(innerScope);
788 i++;
789 }
790 return prevScope;
791}
Definition * toDefinition(DefinitionMutable *dm)
DString stripTemplateSpecifiers(const DString &s)
Definition doxygen.cpp:697
int getScopeFragment(const DString &s, int p, int *l)
Definition util.cpp:3930

References DefinitionMutable::addInnerCompound(), createNamespaceDef(), DString::empty(), TagInfo::fileName, DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), getClass(), getScopeFragment(), Doxygen::globalScope, Doxygen::namespaceLinkedMap, DString::npos, DefinitionMutable::setArtificial(), DefinitionMutable::setLanguage(), DefinitionMutable::setOuterScope(), stripTemplateSpecifiers(), TagInfo::tagName, toDefinition(), toDefinitionMutable(), and toNamespaceDefMutable().

Referenced by addClassToContext(), addConceptToContext(), addEnumValuesToEnums(), addVariable(), buildFunctionList(), buildNamespaceList(), buildTypedefList(), findClassRelation(), findEnums(), findScopeFromQualifiedName(), and resolveClassNestingRelations().

◆ buildSequenceList()

void buildSequenceList ( const Entry * root)
static

Definition at line 3766 of file doxygen.cpp.

3767{
3768 if (!root->name.empty() &&
3769 root->section.isVariable() &&
3770 root->type.find("sequence<")!=DString::npos // it's a sequence
3771 )
3772 {
3773 AUTO_TRACE();
3774 addVariable(root);
3775 }
3776 for (const auto &e : root->children())
3777 if (!e->section.isEnum())
3778 buildSequenceList(e.get());
3779}
static void buildSequenceList(const Entry *root)
Definition doxygen.cpp:3766

References addVariable(), AUTO_TRACE, buildSequenceList(), Entry::children(), DString::empty(), DString::find(), Entry::name, DString::npos, Entry::section, and Entry::type.

Referenced by buildSequenceList(), and parseInput().

◆ buildTypedefList()

void buildTypedefList ( const Entry * root)
static

Definition at line 3666 of file doxygen.cpp.

3667{
3668 //printf("buildVarList(%s)\n",qPrint(rootNav->name()));
3669 if (!root->name.empty() &&
3670 root->section.isVariable() &&
3671 root->type.find("typedef ")!=DString::npos // its a typedef
3672 )
3673 {
3674 AUTO_TRACE();
3675 DString rname = removeRedundantWhiteSpace(root->name);
3676 DString scope;
3677 int index = computeQualifiedIndex(rname);
3678 if (index!=-1 && root->parent()->section.isGroupDoc() && root->parent()->tagInfo())
3679 // grouped members are stored with full scope
3680 {
3681 buildScopeFromQualifiedName(rname.left(index+2),root->lang,root->tagInfo());
3682 scope=rname.left(index);
3683 rname=rname.mid(index+2);
3684 }
3685 else
3686 {
3687 scope=root->parent()->name; //stripAnonymousNamespaceScope(root->parent->name);
3688 }
3692 bool found=false;
3693 if (mn) // symbol with the same name already found
3694 {
3695 for (auto &imd : *mn)
3696 {
3697 if (!imd->isTypedef())
3698 continue;
3699
3700 DString rtype = root->type;
3701 rtype.stripPrefix("typedef ");
3702
3703 // merge the typedefs only if they're not both grouped, and both are
3704 // either part of the same class, part of the same namespace, or both
3705 // are global (i.e., neither in a class or a namespace)
3706 bool notBothGrouped = root->groups.empty() || imd->getGroupDef()==nullptr; // see example #100
3707 bool bothSameScope = (!cd && !nd) || (cd && imd->getClassDef() == cd) || (nd && imd->getNamespaceDef() == nd);
3708 //printf("imd->isTypedef()=%d imd->typeString()=%s root->type=%s\n",imd->isTypedef(),
3709 // qPrint(imd->typeString()),qPrint(root->type));
3710 if (notBothGrouped && bothSameScope && imd->typeString()==rtype)
3711 {
3712 MemberDefMutable *md = toMemberDefMutable(imd.get());
3713 if (md)
3714 {
3715 md->setDocumentation(root->doc,root->docFile,root->docLine);
3717 md->setDocsForDefinition(!root->proto);
3718 md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
3720 md->setRefItems(root->sli);
3721 md->setRequirementReferences(root->rqli);
3722 md->addQualifiers(root->qualifiers);
3723
3724 // merge ingroup specifiers
3725 if (md->getGroupDef()==nullptr && !root->groups.empty())
3726 {
3727 addMemberToGroups(root,md);
3728 }
3729 else if (md->getGroupDef()!=nullptr && root->groups.empty())
3730 {
3731 //printf("existing member is grouped, new member not\n");
3732 }
3733 else if (md->getGroupDef()!=nullptr && !root->groups.empty())
3734 {
3735 //printf("both members are grouped\n");
3736 }
3737 found=true;
3738 break;
3739 }
3740 }
3741 }
3742 }
3743 if (found)
3744 {
3745 AUTO_TRACE_ADD("typedef '{}' already found",rname);
3746 // mark the entry as processed, as we copied everything from it elsewhere
3747 // also, otherwise, due to containing `typedef` it may later get treated
3748 // as a function typedef in filterMemberDocumentation, which is incorrect
3749 root->markAsProcessed();
3750 }
3751 else
3752 {
3753 AUTO_TRACE_ADD("new typedef '{}'",rname);
3754 addVariable(root);
3755 }
3756
3757 }
3758 for (const auto &e : root->children())
3759 if (!e->section.isEnum())
3760 buildTypedefList(e.get());
3761}
static void buildTypedefList(const Entry *root)
Definition doxygen.cpp:3666

References addMemberToGroups(), MemberDefMutable::addQualifiers(), DefinitionMutable::addSectionsToDefinition(), addVariable(), Entry::anchors, AUTO_TRACE, AUTO_TRACE_ADD, Entry::brief, Entry::briefFile, Entry::briefLine, buildScopeFromQualifiedName(), buildTypedefList(), Entry::children(), computeQualifiedIndex(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, getClassMutable(), MemberDef::getGroupDef(), getResolvedNamespace(), Entry::groups, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, Entry::lang, DString::left(), Entry::markAsProcessed(), DString::mid(), Entry::name, DString::npos, Entry::parent(), Entry::proto, Entry::qualifiers, removeRedundantWhiteSpace(), Entry::rqli, Entry::section, DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, DString::stripPrefix(), Entry::tagInfo(), toMemberDefMutable(), and Entry::type.

Referenced by buildTypedefList(), and parseInput().

◆ buildVarList()

void buildVarList ( const Entry * root)
static

Definition at line 3803 of file doxygen.cpp.

3804{
3805 //printf("buildVarList(%s) section=%08x\n",qPrint(rootNav->name()),rootNav->section());
3806 int isFuncPtr=-1;
3807 if (!root->name.empty() &&
3808 (root->type.empty() || g_compoundKeywords.find(root->type.str())==g_compoundKeywords.end()) &&
3809 (
3810 (root->section.isVariable() && // it's a variable
3811 root->type.find("typedef ")==DString::npos // and not a typedef
3812 ) ||
3813 (root->section.isFunction() && // or maybe a function pointer variable
3814 (isFuncPtr=findFunctionPtr(root->type.str(),root->lang))!=-1
3815 ) ||
3816 (root->section.isFunction() && // class variable initialized by constructor
3818 )
3819 )
3820 ) // documented variable
3821 {
3822 AUTO_TRACE();
3823 addVariable(root,isFuncPtr);
3824 }
3825 for (const auto &e : root->children())
3826 if (!e->section.isEnum())
3827 buildVarList(e.get());
3828}
static void buildVarList(const Entry *root)
Definition doxygen.cpp:3803
static bool isVarWithConstructor(const Entry *root)
Definition doxygen.cpp:3234
static const StringUnorderedSet g_compoundKeywords
Definition doxygen.cpp:202

References addVariable(), AUTO_TRACE, buildVarList(), Entry::children(), DString::empty(), DString::find(), findFunctionPtr(), g_compoundKeywords, isVarWithConstructor(), Entry::lang, Entry::name, DString::npos, Entry::section, DString::str(), and Entry::type.

Referenced by buildVarList(), and parseInput().

◆ checkConfiguration()

void checkConfiguration ( )

check and resolve config options

Definition at line 12381 of file doxygen.cpp.

12382{
12383 AUTO_TRACE();
12384
12385 Config::postProcess(false);
12389}
void initWarningFormat()
Definition message.cpp:233
void postProcess(bool clearHeaderAndFooter, CompareMode compareMode=CompareMode::Full)
void checkAndCorrect(bool quiet, const bool check)
void updateObsolete()

References AUTO_TRACE, Config::checkAndCorrect(), Config_getBool, initWarningFormat(), Config::postProcess(), and Config::updateObsolete().

Referenced by main().

◆ checkMarkdownMainfile()

void checkMarkdownMainfile ( )
static

Definition at line 12883 of file doxygen.cpp.

12884{
12885 if (Config_getBool(MARKDOWN_SUPPORT))
12886 {
12887 DString mdfileAsMainPage = Config_getString(USE_MDFILE_AS_MAINPAGE);
12888 if (mdfileAsMainPage.empty()) return;
12889 FileInfo fi(mdfileAsMainPage.data());
12890 if (!fi.exists())
12891 {
12892 warn_uncond("Specified markdown mainpage '{}' does not exist\n",mdfileAsMainPage);
12893 return;
12894 }
12895 bool ambig = false;
12896 if (Doxygen::inputNameLinkedMap->findFileDef(fi.absFilePath(),ambig)==nullptr)
12897 {
12898 warn_uncond("Specified markdown mainpage '{}' has not been defined as input file\n",mdfileAsMainPage);
12899 return;
12900 }
12901 }
12902}
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
#define warn_uncond(fmt,...)
Definition message.h:122

References FileInfo::absFilePath(), Config_getBool, Config_getString, DString::data(), DString::empty(), FileInfo::exists(), Doxygen::inputNameLinkedMap, and warn_uncond.

Referenced by parseInput().

◆ checkPageRelations()

void checkPageRelations ( )
static

Definition at line 10288 of file doxygen.cpp.

10289{
10290 for (const auto &pd : *Doxygen::pageLinkedMap)
10291 {
10292 Definition *ppd = pd->getOuterScope();
10293 while (ppd)
10294 {
10295 if (ppd==pd.get())
10296 {
10297 term("page defined {} with label {} is a subpage "
10298 "of itself! Please remove this cyclic dependency.\n",
10299 warn_line(pd->docFile(),pd->docLine()),pd->name());
10300 }
10301 ppd=ppd->getOuterScope();
10302 }
10303 }
10304}

References Definition::getOuterScope(), Doxygen::pageLinkedMap, term, and warn_line().

Referenced by parseInput().

◆ cleanUpDoxygen()

void cleanUpDoxygen ( )

Definition at line 11918 of file doxygen.cpp.

11919{
11923
11924 delete Doxygen::indexList;
11934 Doxygen::mainPage.reset();
11938 Doxygen::globalScope = nullptr;
11940 delete theTranslator;
11941 delete g_outputList;
11942
11947 delete Doxygen::dirLinkedMap;
11948 delete Doxygen::symbolMap;
11949}
static ParserManager * parserManager
Definition doxygen.h:122
static SymbolMap< Definition > * symbolMap
Definition doxygen.h:118
static FormulaManager & instance()
Definition formula.cpp:54
void clear()
Definition linkedmap.h:212
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:179
static OutputList * g_outputList
Definition doxygen.cpp:192

References FormulaManager::clear(), LinkedMap< T, Hash, KeyEqual, Map >::clear(), ModuleManager::clear(), Doxygen::diaFileNameLinkedMap, Doxygen::dirLinkedMap, Doxygen::dotFileNameLinkedMap, Doxygen::exampleLinkedMap, Doxygen::exampleNameLinkedMap, Doxygen::functionNameLinkedMap, g_outputList, Doxygen::globalNamespaceDef, Doxygen::globalScope, Doxygen::groupLinkedMap, Doxygen::imageNameLinkedMap, Doxygen::includeNameLinkedMap, Doxygen::indexList, Doxygen::inputNameLinkedMap, FormulaManager::instance(), ModuleManager::instance(), SectionManager::instance(), Doxygen::mainPage, Doxygen::memberNameLinkedMap, Doxygen::mermaidFileNameLinkedMap, Doxygen::mscFileNameLinkedMap, Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, Doxygen::parserManager, Doxygen::plantUmlFileNameLinkedMap, Doxygen::symbolMap, and theTranslator.

Referenced by generateOutput(), parseInput(), readConfiguration(), and stopDoxygen().

◆ clearAll()

void clearAll ( )

Definition at line 205 of file doxygen.cpp.

References Doxygen::classLinkedMap, CitationManager::clear(), FormulaManager::clear(), LinkedMap< T, Hash, KeyEqual, Map >::clear(), Doxygen::conceptLinkedMap, Doxygen::diaFileNameLinkedMap, Doxygen::dotFileNameLinkedMap, Doxygen::exampleLinkedMap, Doxygen::exampleNameLinkedMap, g_inputFiles, Doxygen::hiddenClassLinkedMap, Doxygen::imageNameLinkedMap, Doxygen::includeNameLinkedMap, Doxygen::inputNameLinkedMap, CitationManager::instance(), FormulaManager::instance(), SectionManager::instance(), Doxygen::mainPage, Doxygen::mermaidFileNameLinkedMap, Doxygen::mscFileNameLinkedMap, Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, Doxygen::plantUmlFileNameLinkedMap, and Doxygen::tagDestinationMap.

◆ combineUsingRelations()

void combineUsingRelations ( )
static

Definition at line 9717 of file doxygen.cpp.

9718{
9719 // for each file
9720 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9721 {
9722 for (const auto &fd : *fn)
9723 {
9724 fd->combineUsingRelations();
9725 }
9726 }
9727
9728 // for each namespace
9729 NamespaceDefSet visitedNamespaces;
9730 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9731 {
9733 if (ndm)
9734 {
9735 ndm->combineUsingRelations(visitedNamespaces);
9736 }
9737 }
9738}
virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace)=0
std::unordered_set< const NamespaceDef * > NamespaceDefSet

References NamespaceDefMutable::combineUsingRelations(), Doxygen::inputNameLinkedMap, Doxygen::namespaceLinkedMap, and toNamespaceDefMutable().

Referenced by parseInput().

◆ compareDoxyfile()

void compareDoxyfile ( Config::CompareMode diffList)
static

Definition at line 10792 of file doxygen.cpp.

10793{
10794 std::ofstream f;
10795 bool fileOpened=openOutputFile("-",f);
10796 if (fileOpened)
10797 {
10798 TextStream t(&f);
10799 Config::compareDoxyfile(t,diffList);
10800 }
10801 else
10802 {
10803 term("Cannot open stdout for writing\n");
10804 }
10805}
Text streaming class that buffers data.
Definition textstream.h:36
void compareDoxyfile(TextStream &t, CompareMode compareMode)
bool openOutputFile(const DString &outFile, std::ofstream &f)
Definition util.cpp:5122

References Config::compareDoxyfile(), openOutputFile(), and term.

Referenced by readConfiguration().

◆ computeClassRelations()

void computeClassRelations ( )
static

Definition at line 5626 of file doxygen.cpp.

5627{
5628 AUTO_TRACE();
5629 for (const auto &[name,root] : g_classEntries)
5630 {
5631 DString bName = extractClassName(root);
5632 ClassDefMutable *cd = getClassMutable(bName);
5633 if (cd)
5634 {
5635 findBaseClassesForClass(root,cd,cd,cd,DocumentedOnly,false);
5636 }
5637 size_t numMembers = cd ? cd->memberNameInfoLinkedMap().size() : 0;
5638 if ((cd==nullptr || (!cd->hasDocumentation() && !cd->isReference())) && numMembers>0 && !bName.endsWith("::"))
5639 {
5640 if (!root->name.empty() && root->name.find('@')==DString::npos && // normal name
5641 (EntryType::guessSection(root->fileName).isHeader() ||
5642 Config_getBool(EXTRACT_LOCAL_CLASSES)) && // not defined in source file
5643 protectionLevelVisible(root->protection) && // hidden by protection
5644 !Config_getBool(HIDE_UNDOC_CLASSES) // undocumented class are visible
5645 )
5646 warn_undoc(root->fileName,root->startLine, "Compound {} is not documented.", root->name);
5647 }
5648 }
5649}
virtual const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const =0
Returns a dictionary of all members.
bool endsWith(const char *s) const
Definition dstring.h:617
size_t size() const
Definition linkedmap.h:210
static DString extractClassName(const Entry *root)
Definition doxygen.cpp:5531
static void findBaseClassesForClass(const Entry *root, Definition *context, ClassDefMutable *masterCd, ClassDefMutable *instanceCd, FindBaseClassRelation_Mode mode, bool isArtificial, const ArgumentList *actualArgs=nullptr, const TemplateNameMap &templateNames=TemplateNameMap())
Definition doxygen.cpp:4986
static std::multimap< std::string, const Entry * > g_classEntries
Definition doxygen.cpp:190
#define warn_undoc(file, line, fmt,...)
Definition message.h:102

References AUTO_TRACE, Config_getBool, DocumentedOnly, DString::empty(), DString::endsWith(), extractClassName(), Entry::fileName, DString::find(), findBaseClassesForClass(), g_classEntries, getClassMutable(), EntryType::guessSection(), Definition::hasDocumentation(), Definition::isReference(), ClassDef::memberNameInfoLinkedMap(), Entry::name, DString::npos, Entry::protection, protectionLevelVisible(), LinkedMap< T, Hash, KeyEqual, Map >::size(), Entry::startLine, and warn_undoc.

Referenced by parseInput().

◆ computeMemberReferences()

void computeMemberReferences ( )
static

Definition at line 5720 of file doxygen.cpp.

5721{
5722 AUTO_TRACE();
5723 for (const auto &cd : *Doxygen::classLinkedMap)
5724 {
5725 ClassDefMutable *cdm = toClassDefMutable(cd.get());
5726 if (cdm)
5727 {
5728 cdm->computeAnchors();
5729 }
5730 }
5731 for (const auto &fn : *Doxygen::inputNameLinkedMap)
5732 {
5733 for (const auto &fd : *fn)
5734 {
5735 fd->computeAnchors();
5736 }
5737 }
5738 for (const auto &nd : *Doxygen::namespaceLinkedMap)
5739 {
5741 if (ndm)
5742 {
5743 ndm->computeAnchors();
5744 }
5745 }
5746 for (const auto &gd : *Doxygen::groupLinkedMap)
5747 {
5748 gd->computeAnchors();
5749 }
5750}
virtual void computeAnchors()=0
virtual void computeAnchors()=0

References AUTO_TRACE, Doxygen::classLinkedMap, ClassDefMutable::computeAnchors(), NamespaceDefMutable::computeAnchors(), Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, Doxygen::namespaceLinkedMap, toClassDefMutable(), and toNamespaceDefMutable().

Referenced by parseInput().

◆ computeMemberRelations()

void computeMemberRelations ( )
static

Definition at line 8943 of file doxygen.cpp.

8944{
8945 for (const auto &cd : *Doxygen::classLinkedMap)
8946 {
8947 if (cd->isLinkable())
8948 {
8949 for (const auto &bcd : cd->baseClasses())
8950 {
8951 auto actualArgs = stringToArgumentList(cd->getLanguage(),bcd.templSpecifiers);
8952 computeMemberRelationsForBaseClass(cd.get(),&bcd,actualArgs.get());
8953 }
8954 }
8955 }
8956}
static void computeMemberRelationsForBaseClass(const ClassDef *cd, const BaseClassDef *bcd, const ArgumentList *actualArgs)
Definition doxygen.cpp:8824

References Doxygen::classLinkedMap, computeMemberRelationsForBaseClass(), and stringToArgumentList().

Referenced by parseInput().

◆ computeMemberRelationsForBaseClass()

void computeMemberRelationsForBaseClass ( const ClassDef * cd,
const BaseClassDef * bcd,
const ArgumentList * actualArgs )
static

Definition at line 8824 of file doxygen.cpp.

8825{
8826 for (const auto &mn : cd->memberNameInfoLinkedMap()) // for each member in class cd with a unique name
8827 {
8828 for (const auto &imd : *mn) // for each member with a given name
8829 {
8830 MemberDefMutable *md = toMemberDefMutable(imd->memberDef());
8831 if (md && (md->isFunction() || md->isCSharpProperty())) // filter on reimplementable members
8832 {
8833 ClassDef *mbcd = bcd->classDef;
8834 if (mbcd && mbcd->isLinkable()) // filter on linkable classes
8835 {
8836 const auto &bmn = mbcd->memberNameInfoLinkedMap();
8837 const auto &bmni = bmn.find(mn->memberName());
8838 if (bmni) // there are base class members with the same name
8839 {
8840 for (const auto &ibmd : *bmni) // for base class member with that name
8841 {
8842 MemberDefMutable *bmd = toMemberDefMutable(ibmd->memberDef());
8843 if (bmd) // not part of an inline namespace
8844 {
8845 auto lang = bmd->getLanguage();
8846 auto compType = mbcd->compoundType();
8847 if (bmd->virtualness()!=Specifier::Normal ||
8848 lang==SrcLangExt::Python ||
8849 lang==SrcLangExt::Java ||
8850 lang==SrcLangExt::PHP ||
8851 compType==ClassDef::Interface ||
8852 compType==ClassDef::Protocol)
8853 {
8854 const ArgumentList &bmdAl = bmd->argumentList();
8855 const ArgumentList &mdAl = md->argumentList();
8856 const ClassDef *baseClass = bcd->classDef;
8857 const ClassDef *baseTemplate = baseClass->templateMaster() ? baseClass->templateMaster() : baseClass;
8858 const ClassDef *memberClass = bmd->getClassDef();
8859 bool instantiateBaseMember = actualArgs &&
8860 (memberClass==baseClass || memberClass==baseTemplate) &&
8861 !baseTemplate->templateArguments().empty();
8862 bool useDerivedScope = false;
8863 ArgumentList instantiatedBmdAl;
8864 DString instantiatedBmdType = bmd->typeString();
8865 if (instantiateBaseMember)
8866 {
8867 instantiatedBmdAl = bmdAl;
8868 for (Argument &arg : instantiatedBmdAl)
8869 {
8871 arg.type,baseTemplate->templateArguments(),actualArgs);
8872 useDerivedScope = useDerivedScope || substitutedType!=arg.type;
8873 arg.type = substitutedType;
8874 }
8875 DString substitutedTrailingReturnType = substituteTemplateArgumentsInString(
8876 instantiatedBmdAl.trailingReturnType(),baseTemplate->templateArguments(),actualArgs);
8877 useDerivedScope = useDerivedScope ||
8878 substitutedTrailingReturnType!=instantiatedBmdAl.trailingReturnType();
8879 instantiatedBmdAl.setTrailingReturnType(substitutedTrailingReturnType);
8881 instantiatedBmdType,baseTemplate->templateArguments(),actualArgs);
8882 useDerivedScope = useDerivedScope || substitutedType!=instantiatedBmdType;
8883 instantiatedBmdType = substitutedType;
8884 }
8885 //printf(" Base argList='%s'\n Super argList='%s'\n",
8886 // qPrint(argListToString(bmdAl)),
8887 // qPrint(argListToString(mdAl))
8888 // );
8889 if (
8890 lang==SrcLangExt::Python ||
8891 matchArguments2(useDerivedScope ? cd : bmd->getOuterScope(),
8892 useDerivedScope ? cd->getFileDef() : bmd->getFileDef(),
8893 instantiatedBmdType,instantiateBaseMember ? &instantiatedBmdAl : &bmdAl,
8894 md->getOuterScope(), md->getFileDef(), md->typeString(),&mdAl,
8895 true,lang
8896 )
8897 )
8898 {
8899 if (lang==SrcLangExt::Python && md->name().startsWith("__")) continue; // private members do not reimplement
8900 //printf("match!\n");
8901 const MemberDef *rmd = md->reimplements();
8902 if (rmd==nullptr) // not already assigned
8903 {
8904 //printf("%s: setting (new) reimplements member %s\n",qPrint(md->qualifiedName()),qPrint(bmd->qualifiedName()));
8905 md->setReimplements(bmd);
8906 }
8907 //printf("%s: add reimplementedBy member %s\n",qPrint(bmd->qualifiedName()),qPrint(md->qualifiedName()));
8908 bmd->insertReimplementedBy(md);
8909 }
8910 else
8911 {
8912 //printf("no match!\n");
8913 }
8914 }
8915 }
8916 }
8917 }
8918 }
8919 }
8920 }
8921 }
8922
8923 // do also for indirect base classes
8924 for (const auto &bbcd : bcd->classDef->baseClasses())
8925 {
8926 DString templSpec = bbcd.templSpecifiers;
8927 const ClassDef *baseClass = bcd->classDef;
8928 const ClassDef *baseTemplate = baseClass->templateMaster() ? baseClass->templateMaster() : baseClass;
8929 if (actualArgs)
8930 {
8931 templSpec = substituteTemplateArgumentsInString(templSpec,baseTemplate->templateArguments(),actualArgs);
8932 }
8933 auto nextActualArgs = stringToArgumentList(baseClass->getLanguage(),templSpec);
8934 computeMemberRelationsForBaseClass(cd,&bbcd,nextActualArgs.get());
8935 }
8936}
This class contains the information about the argument of a function or template.
Definition arguments.h:27
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
virtual bool isCSharpProperty() const =0
virtual bool isFunction() const =0
virtual const MemberDef * reimplements() const =0
virtual void setReimplements(MemberDef *md)=0
virtual void insertReimplementedBy(MemberDef *md)=0
ClassDef * classDef
Class definition that this relation inherits from.
Definition classdef.h:56
DString substituteTemplateArgumentsInString(const DString &nm, const ArgumentList &formalArgs, const ArgumentList *actualArgs)
Definition util.cpp:3656

References MemberDef::argumentList(), ClassDef::baseClasses(), BaseClassDef::classDef, ClassDef::compoundType(), computeMemberRelationsForBaseClass(), ArgumentList::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberDef::getClassDef(), ClassDef::getFileDef(), MemberDef::getFileDef(), Definition::getLanguage(), Definition::getOuterScope(), MemberDefMutable::insertReimplementedBy(), ClassDef::Interface, MemberDef::isCSharpProperty(), MemberDef::isFunction(), Definition::isLinkable(), matchArguments2(), ClassDef::memberNameInfoLinkedMap(), Definition::name(), ClassDef::Protocol, MemberDef::reimplements(), MemberDefMutable::setReimplements(), DString::startsWith(), stringToArgumentList(), substituteTemplateArgumentsInString(), ClassDef::templateArguments(), ClassDef::templateMaster(), toMemberDefMutable(), MemberDef::typeString(), and MemberDef::virtualness().

Referenced by computeMemberRelations(), and computeMemberRelationsForBaseClass().

◆ computePageRelations()

void computePageRelations ( Entry * root)
static

Definition at line 10258 of file doxygen.cpp.

10259{
10260 if ((root->section.isPageDoc() || root->section.isMainpageDoc()) && !root->name.empty())
10261 {
10262 PageDef *pd = root->section.isPageDoc() ?
10264 Doxygen::mainPage.get();
10265 if (pd)
10266 {
10267 for (const BaseInfo &bi : root->extends)
10268 {
10270 if (pd==subPd)
10271 {
10272 term("page defined {} with label {} is a direct "
10273 "subpage of itself! Please remove this cyclic dependency.\n",
10274 warn_line(pd->docFile(),pd->docLine()),pd->name());
10275 }
10276 else if (subPd)
10277 {
10278 pd->addInnerCompound(subPd);
10279 //printf("*** Added subpage relation: %s->%s\n",
10280 // qPrint(pd->name()),qPrint(subPd->name()));
10281 }
10282 }
10283 }
10284 }
10285 for (const auto &e : root->children()) computePageRelations(e.get());
10286}
virtual int docLine() const =0
virtual DString docFile() const =0
std::vector< BaseInfo > extends
list of base classes
Definition entry.h:229
static void computePageRelations(Entry *root)
DString name
the name of the base class
Definition entry.h:100

References DefinitionMutable::addInnerCompound(), Entry::children(), computePageRelations(), Definition::docFile(), Definition::docLine(), DString::empty(), Entry::extends, LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::mainPage, BaseInfo::name, Definition::name(), Entry::name, Doxygen::pageLinkedMap, Entry::section, term, and warn_line().

Referenced by computePageRelations(), and parseInput().

◆ computeTemplateClassRelations()

void computeTemplateClassRelations ( )
static

Definition at line 5651 of file doxygen.cpp.

5652{
5653 AUTO_TRACE();
5654 for (const auto &[name,root] : g_classEntries)
5655 {
5656 DString bName=stripAnonymousNamespaceScope(root->name);
5659 // strip any anonymous scopes first
5660 if (cd && !cd->getTemplateInstances().empty())
5661 {
5662 AUTO_TRACE_ADD("Template class '{}'",cd->name());
5663 for (const auto &ti : cd->getTemplateInstances()) // for each template instance
5664 {
5665 ClassDefMutable *tcd=toClassDefMutable(ti.classDef);
5666 if (tcd && tcd->isImplicitTemplateInstance()) // (partial) specializations have their own base classes
5667 {
5668 AUTO_TRACE_ADD("Template instance '{}'",tcd->name());
5669 DString templSpec = ti.templSpec;
5670 std::unique_ptr<ArgumentList> templArgs = stringToArgumentList(tcd->getLanguage(),templSpec);
5671 for (const BaseInfo &bi : root->extends)
5672 {
5673 // check if the base class is a template argument
5674 BaseInfo tbi = bi;
5675 const ArgumentList &tl = cd->templateArguments();
5676 if (!tl.empty())
5677 {
5678 TemplateNameMap baseClassNames = tcd->getTemplateBaseClassNames();
5679 TemplateNameMap templateNames = getTemplateArgumentsInName(tl,bi.name.str());
5680 // for each template name that we inherit from we need to
5681 // substitute the formal with the actual arguments
5682 TemplateNameMap actualTemplateNames;
5683 for (const auto &tn_kv : templateNames)
5684 {
5685 size_t templIndex = tn_kv.second;
5686 Argument actArg;
5687 bool hasActArg=false;
5688 if (templIndex<templArgs->size())
5689 {
5690 actArg=templArgs->at(templIndex);
5691 hasActArg=true;
5692 }
5693 if (hasActArg &&
5694 baseClassNames.find(actArg.type.str())!=baseClassNames.end() &&
5695 actualTemplateNames.find(actArg.type.str())==actualTemplateNames.end()
5696 )
5697 {
5698 actualTemplateNames.emplace(actArg.type.str(),static_cast<int>(templIndex));
5699 }
5700 }
5701
5702 tbi.name = substituteTemplateArgumentsInString(bi.name,tl,templArgs.get());
5703 // find a documented base class in the correct scope
5704 if (!findClassRelation(root,cd,tcd,&tbi,actualTemplateNames,DocumentedOnly,false))
5705 {
5706 // no documented base class -> try to find an undocumented one
5707 findClassRelation(root,cd,tcd,&tbi,actualTemplateNames,Undocumented,true);
5708 }
5709 }
5710 }
5711 }
5712 }
5713 }
5714 }
5715}
DString type
Definition arguments.h:43
virtual const TemplateInstanceList & getTemplateInstances() const =0
Returns a sorted dictionary with all template instances found for this template class.
virtual const TemplateNameMap & getTemplateBaseClassNames() const =0
static TemplateNameMap getTemplateArgumentsInName(const ArgumentList &templateArguments, const std::string &name)
Definition doxygen.cpp:4767

References AUTO_TRACE, AUTO_TRACE_ADD, DocumentedOnly, ArgumentList::empty(), Entry::extends, findClassRelation(), g_classEntries, getClassMutable(), Definition::getLanguage(), getTemplateArgumentsInName(), ClassDef::getTemplateBaseClassNames(), ClassDef::getTemplateInstances(), ClassDef::isImplicitTemplateInstance(), BaseInfo::name, Definition::name(), Entry::name, DString::str(), stringToArgumentList(), stripAnonymousNamespaceScope(), stripTemplateSpecifiersFromScope(), substituteTemplateArgumentsInString(), ClassDef::templateArguments(), toClassDefMutable(), Argument::type, and Undocumented.

Referenced by parseInput().

◆ computeTooltipTexts()

void computeTooltipTexts ( )
static

Definition at line 9436 of file doxygen.cpp.

9437{
9438 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9439 if (numThreads>1)
9440 {
9441 ThreadPool threadPool(numThreads);
9442 std::vector < std::future< void > > results;
9443 // queue the work
9444 for (const auto &[name,symList] : *Doxygen::symbolMap)
9445 {
9446 for (const auto &def : symList)
9447 {
9449 if (dm && !isSymbolHidden(def) && !def->isArtificial() && def->isLinkableInProject())
9450 {
9451 auto processTooltip = [dm]() {
9452 dm->computeTooltip();
9453 };
9454 results.emplace_back(threadPool.queue(processTooltip));
9455 }
9456 }
9457 }
9458 // wait for the results
9459 for (auto &f : results)
9460 {
9461 f.get();
9462 }
9463 }
9464 else
9465 {
9466 for (const auto &[name,symList] : *Doxygen::symbolMap)
9467 {
9468 for (const auto &def : symList)
9469 {
9471 if (dm && !isSymbolHidden(def) && !def->isArtificial() && def->isLinkableInProject())
9472 {
9473 dm->computeTooltip();
9474 }
9475 }
9476 }
9477 }
9478}
virtual void computeTooltip()=0
Class managing a pool of worker threads.
Definition threadpool.h:48
static bool isSymbolHidden(const Definition *d)
Definition doxygen.cpp:9429

References DefinitionMutable::computeTooltip(), Config_getInt, isSymbolHidden(), ThreadPool::queue(), Doxygen::symbolMap, and toDefinitionMutable().

Referenced by parseInput().

◆ computeVerifiedDotPath()

void computeVerifiedDotPath ( )
static

Definition at line 10716 of file doxygen.cpp.

10717{
10718 // check dot path
10719 DString dotPath = Config_getString(DOT_PATH);
10720 if (!dotPath.empty())
10721 {
10722 FileInfo fi(dotPath.str());
10723 if (!(fi.exists() && fi.isFile()) )// not an existing user specified path + exec
10724 {
10725 dotPath = dotPath+"/dot"+Portable::commandExtension();
10726 FileInfo dp(dotPath.str());
10727 if (!dp.exists() || !dp.isFile())
10728 {
10729 warn_uncond("the dot tool could not be found as '{}'\n",dotPath);
10730 dotPath = "dot";
10731 dotPath += Portable::commandExtension();
10732 }
10733 else if (dp.isRelative())
10734 {
10735 dotPath = fi.dirPath() + "/" + dotPath;
10736 }
10737 }
10738#if defined(_WIN32) // convert slashes
10739 size_t l=dotPath.length();
10740 for (size_t i=0;i<l;i++) if (dotPath.at(i)=='/') dotPath.at(i)='\\';
10741#endif
10742 }
10743 else
10744 {
10745 dotPath = "dot";
10746 dotPath += Portable::commandExtension();
10747 }
10748 Doxygen::verifiedDotPath = dotPath;
10750}
static DString verifiedDotPath
Definition doxygen.h:130
const char * commandExtension()
Definition portable.cpp:477
#define TRACE(...)
Definition trace.h:77

References DString::at(), Portable::commandExtension(), Config_getString, FileInfo::dirPath(), DString::empty(), FileInfo::exists(), FileInfo::isFile(), FileInfo::isRelative(), DString::length(), DString::str(), TRACE, Doxygen::verifiedDotPath, and warn_uncond.

Referenced by parseInput().

◆ convertToCompoundType()

ClassDef::CompoundType convertToCompoundType ( EntryType section,
TypeSpecifier specifier )
static

Definition at line 908 of file doxygen.cpp.

909{
911
912 if (specifier.isStruct())
914 else if (specifier.isRecord())
916 else if (specifier.isUnion())
917 sec=ClassDef::Union;
918 else if (specifier.isCategory())
920 else if (specifier.isInterface())
922 else if (specifier.isProtocol())
924 else if (specifier.isException())
926 else if (specifier.isService())
928 else if (specifier.isSingleton())
930
931 if (section.isUnionDoc())
932 sec=ClassDef::Union;
933 else if (section.isStructDoc())
935 else if (section.isRecordDoc())
937 else if (section.isInterfaceDoc())
939 else if (section.isProtocolDoc())
941 else if (section.isCategoryDoc())
943 else if (section.isExceptionDoc())
945 else if (section.isServiceDoc())
947 else if (section.isSingletonDoc())
949
950 return sec;
951}
@ Exception
Definition classdef.h:112

References ClassDef::Category, ClassDef::Class, ClassDef::Exception, ClassDef::Interface, ClassDef::Protocol, ClassDef::Record, ClassDef::Service, ClassDef::Singleton, ClassDef::Struct, and ClassDef::Union.

Referenced by addClassToContext().

◆ copyExtraFiles()

void copyExtraFiles ( StringVector files,
const DString & filesOption,
const DString & outputOption,
bool toIndex )
inlinestatic

Definition at line 10985 of file doxygen.cpp.

10986{
10987 for (const auto &fileName : files)
10988 {
10989 if (!fileName.empty())
10990 {
10991 FileInfo fi(fileName);
10992 if (!fi.exists())
10993 {
10994 err("Extra file '{}' specified in {} does not exist!\n", fileName,filesOption);
10995 }
10996 else if (fi.isDir())
10997 {
10998 err("Extra file '{}' specified in {} is a directory, it has to be a file!\n", fileName,filesOption);
10999 }
11000 else
11001 {
11002 DString destFileName = outputOption+"/"+fi.fileName();
11003 copyFile(fileName, destFileName);
11004 if (toIndex) Doxygen::indexList->addImageFile(fi.fileName());
11005 }
11006 }
11007 }
11008}
void addImageFile(const DString &name)
Definition indexlist.h:124
bool copyFile(const DString &src, const DString &dest)
Copies the contents of file with name src to the newly created file with name dest.
Definition util.cpp:4755

References IndexList::addImageFile(), copyFile(), err, FileInfo::exists(), FileInfo::fileName(), Doxygen::indexList, and FileInfo::isDir().

Referenced by generateOutput().

◆ copyIcon()

void copyIcon ( const DString & outputOption,
bool toIndex )
static

Definition at line 10960 of file doxygen.cpp.

10961{
10962 DString projectIcon = Config_getString(PROJECT_ICON);
10963 if (!projectIcon.empty())
10964 {
10965 FileInfo fi(projectIcon.str());
10966 if (!fi.exists())
10967 {
10968 err("Project icon '{}' specified by PROJECT_ICON does not exist!\n",projectIcon);
10969 projectIcon = Config_updateString(PROJECT_ICON,""); // revert to the default
10970 }
10971 else if (fi.isDir())
10972 {
10973 err("Project icon '{}' specified by PROJECT_ICON is a directory, it has to be a file!\n",projectIcon);
10974 projectIcon = Config_updateString(PROJECT_ICON,""); // revert to the default
10975 }
10976 else
10977 {
10978 DString destFileName = outputOption+"/"+fi.fileName();
10979 copyFile(projectIcon,destFileName);
10980 if (toIndex) Doxygen::indexList->addImageFile(fi.fileName());
10981 }
10982 }
10983}
#define Config_updateString(name, value)
Definition config.h:39

References IndexList::addImageFile(), Config_getString, Config_updateString, copyFile(), DString::empty(), err, FileInfo::exists(), FileInfo::fileName(), Doxygen::indexList, FileInfo::isDir(), and DString::str().

Referenced by generateOutput().

◆ copyLatexStyleSheet()

void copyLatexStyleSheet ( )
static

Definition at line 10851 of file doxygen.cpp.

10852{
10853 StringVector latexExtraStyleSheet = Config_getList(LATEX_EXTRA_STYLESHEET);
10854 for (const auto &sheet : latexExtraStyleSheet)
10855 {
10856 std::string fileName = sheet;
10857 if (!fileName.empty())
10858 {
10859 FileInfo fi(fileName);
10860 if (!fi.exists())
10861 {
10862 err("Style sheet '{}' specified by LATEX_EXTRA_STYLESHEET does not exist!\n",fileName);
10863 }
10864 else if (fi.isDir())
10865 {
10866 err("Style sheet '{}' specified by LATEX_EXTRA_STYLESHEET is a directory, it has to be a file!\n", fileName);
10867 }
10868 else
10869 {
10870 DString destFileName = Config_getString(LATEX_OUTPUT)+"/"+fi.fileName();
10871 if (!checkExtension(fi.fileName(), LATEX_STYLE_EXTENSION))
10872 {
10873 destFileName += LATEX_STYLE_EXTENSION;
10874 }
10875 copyFile(fileName, destFileName);
10876 }
10877 }
10878 }
10879}
#define LATEX_STYLE_EXTENSION
Definition latexgen.h:24
bool checkExtension(const DString &fName, const DString &ext)
Definition util.cpp:4058

References checkExtension(), Config_getList, Config_getString, copyFile(), err, FileInfo::exists(), FileInfo::fileName(), FileInfo::isDir(), and LATEX_STYLE_EXTENSION.

Referenced by generateOutput().

◆ copyLogo()

void copyLogo ( const DString & outputOption,
bool toIndex )
static

Definition at line 10935 of file doxygen.cpp.

10936{
10937 DString projectLogo = projectLogoFile();
10938 if (!projectLogo.empty())
10939 {
10940 FileInfo fi(projectLogo.str());
10941 if (!fi.exists())
10942 {
10943 err("Project logo '{}' specified by PROJECT_LOGO does not exist!\n",projectLogo);
10944 projectLogo = Config_updateString(PROJECT_LOGO,""); // revert to the default
10945 }
10946 else if (fi.isDir())
10947 {
10948 err("Project logo '{}' specified by PROJECT_LOGO is a directory, it has to be a file!\n",projectLogo);
10949 projectLogo = Config_updateString(PROJECT_LOGO,""); // revert to the default
10950 }
10951 else
10952 {
10953 DString destFileName = outputOption+"/"+fi.fileName();
10954 copyFile(projectLogo,destFileName);
10955 if (toIndex) Doxygen::indexList->addImageFile(fi.fileName());
10956 }
10957 }
10958}
DString projectLogoFile()
Definition util.cpp:2712

References IndexList::addImageFile(), Config_updateString, copyFile(), DString::empty(), err, FileInfo::exists(), FileInfo::fileName(), Doxygen::indexList, FileInfo::isDir(), projectLogoFile(), and DString::str().

Referenced by generateOutput().

◆ copyStyleSheet()

void copyStyleSheet ( )
static

Definition at line 10882 of file doxygen.cpp.

10883{
10884 DString htmlStyleSheet = Config_getString(HTML_STYLESHEET);
10885 if (!htmlStyleSheet.empty())
10886 {
10887 if (!htmlStyleSheet.startsWith("http:") && !htmlStyleSheet.startsWith("https:"))
10888 {
10889 FileInfo fi(htmlStyleSheet.str());
10890 if (!fi.exists())
10891 {
10892 err("Style sheet '{}' specified by HTML_STYLESHEET does not exist!\n",htmlStyleSheet);
10893 htmlStyleSheet = Config_updateString(HTML_STYLESHEET,""); // revert to the default
10894 }
10895 else if (fi.isDir())
10896 {
10897 err("Style sheet '{}' specified by HTML_STYLESHEET is a directory, it has to be a file!\n",htmlStyleSheet);
10898 htmlStyleSheet = Config_updateString(HTML_STYLESHEET,""); // revert to the default
10899 }
10900 else
10901 {
10902 DString destFileName = Config_getString(HTML_OUTPUT)+"/"+fi.fileName();
10903 copyFile(htmlStyleSheet,destFileName);
10904 }
10905 }
10906 }
10907 StringVector htmlExtraStyleSheet = Config_getList(HTML_EXTRA_STYLESHEET);
10908 for (const auto &sheet : htmlExtraStyleSheet)
10909 {
10910 DString fileName(sheet);
10911 if (!fileName.empty() && !fileName.startsWith("http:") && !fileName.startsWith("https:"))
10912 {
10913 FileInfo fi(fileName.str());
10914 if (!fi.exists())
10915 {
10916 err("Style sheet '{}' specified by HTML_EXTRA_STYLESHEET does not exist!\n",fileName);
10917 }
10918 else if (fi.fileName()=="doxygen.css" || fi.fileName()=="tabs.css" || fi.fileName()=="navtree.css")
10919 {
10920 err("Style sheet '{}' specified by HTML_EXTRA_STYLESHEET is already a built-in stylesheet. Please use a different name\n",fi.fileName());
10921 }
10922 else if (fi.isDir())
10923 {
10924 err("Style sheet '{}' specified by HTML_EXTRA_STYLESHEET is a directory, it has to be a file!\n",fileName);
10925 }
10926 else
10927 {
10928 DString destFileName = Config_getString(HTML_OUTPUT)+"/"+fi.fileName();
10929 copyFile(fileName, destFileName);
10930 }
10931 }
10932 }
10933}

References Config_getList, Config_getString, Config_updateString, copyFile(), DString::empty(), err, FileInfo::exists(), FileInfo::fileName(), FileInfo::isDir(), DString::startsWith(), and DString::str().

Referenced by generateOutput().

◆ countMembers()

void countMembers ( )
static

Definition at line 9496 of file doxygen.cpp.

9497{
9498 for (const auto &cd : *Doxygen::classLinkedMap)
9499 {
9500 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9501 if (cdm)
9502 {
9503 cdm->countMembers();
9504 }
9505 }
9506
9507 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9508 {
9510 if (ndm)
9511 {
9512 ndm->countMembers();
9513 }
9514 }
9515
9516 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9517 {
9518 for (const auto &fd : *fn)
9519 {
9520 fd->countMembers();
9521 }
9522 }
9523
9524 for (const auto &gd : *Doxygen::groupLinkedMap)
9525 {
9526 gd->countMembers();
9527 }
9528
9529 auto &mm = ModuleManager::instance();
9530 mm.countMembers();
9531}
virtual void countMembers()=0
virtual void countMembers()=0

References Doxygen::classLinkedMap, ClassDefMutable::countMembers(), NamespaceDefMutable::countMembers(), Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::namespaceLinkedMap, toClassDefMutable(), and toNamespaceDefMutable().

Referenced by generateOutput().

◆ createOutputDirectory()

DString createOutputDirectory ( const DString & baseDirName,
const DString & formatDirName,
const char * defaultDirName )
static

Definition at line 12630 of file doxygen.cpp.

12633{
12634 DString result = formatDirName;
12635 if (result.empty())
12636 {
12637 result = baseDirName + defaultDirName;
12638 }
12639 else if (formatDirName[0]!='/' && (formatDirName.length()==1 || formatDirName[1]!=':'))
12640 {
12641 result.prepend(baseDirName+"/");
12642 }
12643 Dir formatDir(result.str());
12644 if (!formatDir.exists() && !formatDir.mkdir(result.str()))
12645 {
12646 term("Could not create output directory {}\n", result);
12647 }
12648 return result;
12649}
Class representing a directory in the file system.
Definition dir.h:73

References DString::empty(), Dir::exists(), DString::length(), Dir::mkdir(), DString::prepend(), DString::str(), and term.

Referenced by parseInput().

◆ createTagLessInstance()

ClassDefMutable * createTagLessInstance ( const Definition * root,
const ClassDef * templ,
const DString & fieldName,
bool hasNamedVariable )
static

Definition at line 1576 of file doxygen.cpp.

1577{
1578 DString fullName;
1579 if (Config_getEnum(TAGLESS_NAMESTYLE)==TAGLESS_NAMESTYLE_t::flat)
1580 {
1581 // "flat" style: refer to the anonymous compound via its flattened scope and
1582 // member names, e.g. 'struct A { struct { int x; } y; };' yields 'A.y'.
1583 // This matches the pre-1.18 naming and is friendlier for consumers of the
1584 // XML output that cannot handle type names starting with '[' (e.g. mkdoxy).
1585 fullName = removeAnonymousScopes(templ->name());
1586 if (fullName.endsWith("::")) fullName = fullName.left(fullName.length()-2);
1587 // add the field name as a suffix to make the name unique again; the
1588 // separator is only added when there is a flattened scope left (a
1589 // file-scope anonymous compound has none and would otherwise get a
1590 // leading '.').
1591 if (!fullName.empty()) fullName += ".";
1592 fullName += fieldName;
1593 }
1594 else // "marker" style (the default)
1595 {
1596 DString n = templ->name();
1597 // replace e.g. X::@1343:@4343::Y -> X::[struct]::Y
1598 if (size_t sn = n.find('@'); sn!=DString::npos)
1599 {
1600 const char *p = n.data()+sn;
1601 char c;
1602 while ((c=*p))
1603 {
1604 if (!isdigit(c) && c!='@' && c!=':') break;
1605 p++;
1606 }
1607 n = n.left(sn)+"["+templ->compoundTypeString().str()+"]"+p;
1608 }
1609 // add field name to the class name to make it unique again, e.g. X::[struct]::Y.m
1610 fullName = n+"."+fieldName;
1611 }
1612
1613 //printf("** adding class %s based on %s in %s\n",qPrint(fullName),qPrint(templ->name()),qPrint(root->name()));
1615 Doxygen::classLinkedMap->add(fullName,
1617 templ->getDefLine(),
1618 templ->getDefColumn(),
1619 fullName,
1620 templ->compoundType())));
1621 if (cd)
1622 {
1623 //printf("cd->name()=%s displayName=%s\n",qPrint(cd->name()),qPrint(cd->displayName()));
1624 cd->setDocumentation(templ->documentation(),templ->docFile(),templ->docLine()); // copy docs to definition
1625 cd->setBriefDescription(templ->briefDescription(),templ->briefFile(),templ->briefLine());
1626 cd->setLanguage(templ->getLanguage());
1627 cd->setBodySegment(templ->getDefLine(),templ->getStartBodyLine(),templ->getEndBodyLine());
1628 cd->setBodyDef(templ->getBodyDef());
1629
1630 if (hasNamedVariable)
1631 {
1632 cd->setHasNamedVariable(true);
1633 if (root!=Doxygen::globalScope)
1634 {
1635 DefinitionMutable *outerScope = toDefinitionMutable(const_cast<Definition*>(root));
1636 if (root && root->definitionType()==Definition::TypeFile)
1637 {
1638 FileDef *fd = toFileDef(const_cast<Definition*>(root));
1639 fd->insertClass(cd);
1640 cd->setFileDef(fd);
1642 }
1643 else if (outerScope)
1644 {
1645 outerScope->addInnerCompound(cd);
1646 cd->setOuterScope(const_cast<Definition*>(root));
1647 }
1648 }
1649 }
1650 else
1651 {
1652 cd->setArtificial(true);
1653 }
1654
1655 for (auto &gd : root->partOfGroups())
1656 {
1657 cd->makePartOfGroup(gd);
1658 gd->addClass(cd);
1659 }
1660
1661 auto addMember = [&](const MemberDef *md) -> MemberDefMutable*
1662 {
1663 auto newMd = createMemberDef(md->getDefFileName(),md->getDefLine(),md->getDefColumn(),
1664 md->typeString(),md->name(),md->argsString(),md->excpString(),
1665 md->protection(),md->virtualness(),md->isStatic(),Relationship::Member,
1666 md->memberType(),
1667 ArgumentList(),ArgumentList(),"");
1668 MemberDefMutable *imd = toMemberDefMutable(newMd.get());
1669 imd->setDefinition(md->definition());
1670 imd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
1671 imd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
1672 imd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
1673 imd->setMemberSpecifiers(md->getMemberSpecifiers());
1674 imd->setId(md->id());
1675 imd->addQualifiers(md->getQualifiers());
1676 imd->setVhdlSpecifiers(md->getVhdlSpecifiers());
1677 imd->setMemberGroupId(md->getMemberGroupId());
1678 imd->setInitializer(md->initializer());
1679 imd->setRequiresClause(md->requiresClause());
1680 imd->setMaxInitLines(md->initializerLines());
1681 imd->setBitfields(md->bitfieldString());
1682 imd->setLanguage(md->getLanguage());
1683 imd->setAnchor();
1684 MemberName *mn = Doxygen::memberNameLinkedMap->add(md->name());
1685 mn->push_back(std::move(newMd));
1686 return imd;
1687 };
1688
1689 static auto memberListPairs = std::array<std::pair<MemberListType,MemberListType>,3>{{
1690 { MemberListType::PubAttribs(), MemberListType::PubTypes() },
1691 { MemberListType::ProAttribs(), MemberListType::ProTypes() },
1692 { MemberListType::PriAttribs(), MemberListType::PriTypes() }
1693 }};
1694 for (auto [attribs,types] : memberListPairs)
1695 {
1696 MemberList *ml = templ->getMemberList(attribs);
1697 if (ml)
1698 {
1699 for (const auto &md : *ml)
1700 {
1701 //printf(" Member attribute %s def=%s\n",qPrint(md->name()),qPrint(md->definition()));
1702 MemberDefMutable *imd = addMember(md);
1703 if (!hasNamedVariable && root) // we have an anonymous struct/union without associated member variable,
1704 // so we also need to create a new member to show in the outer scope's detailed section.
1705 // e.g. struct S { union { int a; int b; }; }; needs S::a and S::b as members
1706 {
1707 MemberDefMutable *dimd = addMember(md);
1708 // link the detailed member to the original member
1711 if (root && root->definitionType()==Definition::TypeClass && dimd)
1712 {
1713 ClassDefMutable *cm = toClassDefMutable(const_cast<Definition*>(root));
1714 if (cm)
1715 {
1716 //printf(" Member attribute %s added to class %s\n",qPrint(md->name()),qPrint(cm->name()));
1717 dimd->setMemberClass(cm);
1718 cm->insertMember(dimd);
1719 associateVariableWithAnonymousEnumType(md,cm,dimd,attribs);
1720 }
1721 }
1722 else if (root && root->definitionType()==Definition::TypeFile && dimd)
1723 {
1724 FileDef *fd = toFileDef(const_cast<Definition*>(root));
1725 if (fd)
1726 {
1727 //printf(" Member attribute %s added to file %s\n",qPrint(md->name()),qPrint(fd->name()));
1728 dimd->setOuterScope(fd);
1729 dimd->setFileDef(fd);
1730 fd->insertMember(dimd);
1731 associateVariableWithAnonymousEnumType(md,fd,dimd,attribs);
1732 }
1733 }
1734 else if (root && root->definitionType()==Definition::TypeNamespace && dimd)
1735 {
1736 NamespaceDefMutable *ndm = toNamespaceDefMutable(const_cast<Definition*>(root));
1737 if (ndm)
1738 {
1739 //printf(" Member attribute %s added to namespace %s\n",qPrint(md->name()),qPrint(ndm->name()));
1740 dimd->setOuterScope(ndm);
1741 dimd->setNamespace(ndm);
1742 ndm->insertMember(dimd);
1743 associateVariableWithAnonymousEnumType(md,ndm,dimd,attribs);
1744 }
1745 }
1746 }
1747
1748 imd->setMemberClass(cd);
1749 cd->insertMember(imd);
1750 associateVariableWithAnonymousEnumType(md,cd,imd,attribs);
1751 }
1752 }
1753 ml = templ->getMemberList(types);
1754 if (ml)
1755 {
1756 for (const auto &md : *ml)
1757 {
1758 //printf(" Member type %s def=%s\n",qPrint(md->name()),qPrint(md->definition()));
1759 MemberDefMutable *mdm = addMember(md);
1760 mdm->setMemberClass(cd);
1761 cd->insertMember(mdm);
1763 associateVariableWithAnonymousEnumType(md,cd,mdm,attribs);
1764 if (md->isEnumerate() && md->name().startsWith("@")) // anonymous enum type
1765 {
1766 for (const auto &emd : md->enumFieldList())
1767 {
1768 //printf(" enum field %s\n",qPrint(emd->name()));
1769 MemberDefMutable *emdm = addMember(emd);
1770 mdm->insertEnumField(emdm);
1771 emdm->setEnumScope(md);
1772 emdm->setMemberClass(cd);
1773 cd->insertMember(emdm);
1775 associateVariableWithAnonymousEnumType(md,cd,emdm,attribs);
1776 }
1777 }
1778 }
1779 }
1780 }
1781 }
1782 return cd;
1783}
virtual MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual void setHasNamedVariable(bool b)=0
virtual int getEndBodyLine() const =0
virtual DString briefFile() const =0
virtual int briefLine() const =0
virtual const GroupList & partOfGroups() const =0
virtual void setClassDefOfAnonymousType(const ClassDef *cd)=0
virtual void setMemberClass(ClassDef *cd)=0
virtual void setMemberSpecifiers(TypeSpecifier s)=0
virtual void setVhdlSpecifiers(VhdlSpecifier s)=0
virtual void setFileDef(FileDef *fd)=0
virtual void setAnonymousMemberForDeclaration(const MemberDef *md)=0
virtual void setAnonymousMemberForDetails(const MemberDef *md)=0
virtual void setBitfields(const DString &s)=0
virtual void setNamespace(NamespaceDef *nd)=0
virtual void setAnchor()=0
static void associateVariableWithAnonymousEnumType(const MemberDef *md, const Container *cd, const MemberDef *enumTypeMember, MemberListType mlFilter)
Definition doxygen.cpp:1549
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:2054
DString removeAnonymousScopes(const DString &str)
Definition util.cpp:98

References LinkedMap< T, Hash, KeyEqual, Map >::add(), DefinitionMutable::addInnerCompound(), MemberDefMutable::addQualifiers(), associateVariableWithAnonymousEnumType(), Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), Doxygen::classLinkedMap, ClassDef::compoundType(), ClassDef::compoundTypeString(), Config_getEnum, createClassDef(), createMemberDef(), DString::data(), Definition::definitionType(), Definition::docFile(), Definition::docLine(), Definition::documentation(), DString::empty(), DString::endsWith(), DString::find(), Definition::getBodyDef(), Definition::getDefColumn(), Definition::getDefFileName(), Definition::getDefLine(), Definition::getEndBodyLine(), Definition::getLanguage(), ClassDef::getMemberList(), Definition::getStartBodyLine(), Doxygen::globalScope, FileDef::insertClass(), MemberDefMutable::insertEnumField(), ClassDefMutable::insertMember(), FileDef::insertMember(), NamespaceDefMutable::insertMember(), DString::left(), DString::length(), DefinitionMutable::makePartOfGroup(), Doxygen::memberNameLinkedMap, Definition::name(), DString::npos, Definition::partOfGroups(), MemberName::push_back(), removeAnonymousScopes(), MemberDefMutable::setAnchor(), MemberDefMutable::setAnonymousMemberForDeclaration(), MemberDefMutable::setAnonymousMemberForDetails(), DefinitionMutable::setArtificial(), MemberDefMutable::setBitfields(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setClassDefOfAnonymousType(), MemberDefMutable::setDefinition(), DefinitionMutable::setDocumentation(), MemberDefMutable::setEnumScope(), ClassDefMutable::setFileDef(), MemberDefMutable::setFileDef(), ClassDefMutable::setHasNamedVariable(), DefinitionMutable::setId(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setInitializer(), DefinitionMutable::setLanguage(), MemberDefMutable::setMaxInitLines(), MemberDefMutable::setMemberClass(), MemberDefMutable::setMemberGroupId(), MemberDefMutable::setMemberSpecifiers(), MemberDefMutable::setNamespace(), DefinitionMutable::setOuterScope(), MemberDefMutable::setRequiresClause(), MemberDefMutable::setVhdlSpecifiers(), DString::str(), toClassDefMutable(), toDefinitionMutable(), toFileDef(), toMemberDefMutable(), toNamespaceDefMutable(), Definition::TypeClass, Definition::TypeFile, and Definition::TypeNamespace.

Referenced by processTagLessClassesForList().

◆ createTemplateInstanceMembers()

void createTemplateInstanceMembers ( )
static

Definition at line 8960 of file doxygen.cpp.

8961{
8962 // for each class
8963 for (const auto &cd : *Doxygen::classLinkedMap)
8964 {
8965 // that is a template
8966 for (const auto &ti : cd->getTemplateInstances())
8967 {
8968 ClassDefMutable *tcdm = toClassDefMutable(ti.classDef);
8969 if (tcdm && tcdm->isImplicitTemplateInstance()) // (partial) specializations have their own members
8970 {
8971 tcdm->addMembersToTemplateInstance(cd.get(),cd->templateArguments(),ti.templSpec);
8972 }
8973 }
8974 }
8975}
virtual void addMembersToTemplateInstance(const ClassDef *cd, const ArgumentList &templateArguments, const DString &templSpec)=0

References ClassDefMutable::addMembersToTemplateInstance(), Doxygen::classLinkedMap, ClassDef::isImplicitTemplateInstance(), and toClassDefMutable().

Referenced by parseInput().

◆ createUsingMemberImportForClass()

void createUsingMemberImportForClass ( const Entry * root,
ClassDefMutable * cd,
const MemberDef * md,
const DString & fileName,
const DString & memName )
static

Definition at line 2434 of file doxygen.cpp.

2436{
2437 AUTO_TRACE("creating new member {} for class {}",memName,cd->name());
2438 const ArgumentList &templAl = md->templateArguments();
2439 const ArgumentList &al = md->argumentList();
2440 auto newMd = createMemberDef(
2441 fileName,root->startLine,root->startColumn,
2442 md->typeString(),memName,md->argsString(),
2443 md->excpString(),root->protection,root->virt,
2444 md->isStatic(),Relationship::Member,md->memberType(),
2445 templAl,al,root->metaData
2446 );
2447 auto newMmd = toMemberDefMutable(newMd.get());
2448 newMmd->setMemberClass(cd);
2449 cd->insertMember(newMd.get());
2450 if (!root->doc.empty() || !root->brief.empty())
2451 {
2452 newMmd->setDocumentation(root->doc,root->docFile,root->docLine);
2453 newMmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2454 newMmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
2455 }
2456 else
2457 {
2458 newMmd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
2459 newMmd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
2460 newMmd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
2461 }
2462 newMmd->setDefinition(md->definition());
2463 applyMemberOverrideOptions(root,newMmd);
2464 newMmd->addQualifiers(root->qualifiers);
2465 newMmd->setBitfields(md->bitfieldString());
2466 newMmd->addSectionsToDefinition(root->anchors);
2467 newMmd->setBodySegment(md->getDefLine(),md->getStartBodyLine(),md->getEndBodyLine());
2468 newMmd->setBodyDef(md->getBodyDef());
2469 newMmd->setInitializer(md->initializer());
2470 newMmd->setRequiresClause(md->requiresClause());
2471 newMmd->setMaxInitLines(md->initializerLines());
2472 newMmd->setMemberGroupId(root->mGrpId);
2473 newMmd->setMemberSpecifiers(md->getMemberSpecifiers());
2474 newMmd->setVhdlSpecifiers(md->getVhdlSpecifiers());
2475 newMmd->setLanguage(root->lang);
2476 newMmd->setId(root->id);
2478 mn->push_back(std::move(newMd));
2479}
virtual DString inbodyFile() const =0
virtual int inbodyLine() const =0
virtual DString definition() const =0
virtual DString excpString() const =0
virtual VhdlSpecifier getVhdlSpecifiers() const =0
virtual DString bitfieldString() const =0
virtual TypeSpecifier getMemberSpecifiers() const =0
virtual int initializerLines() const =0

References LinkedMap< T, Hash, KeyEqual, Map >::add(), Entry::anchors, applyMemberOverrideOptions(), MemberDef::argsString(), MemberDef::argumentList(), AUTO_TRACE, MemberDef::bitfieldString(), Entry::brief, Definition::briefDescription(), Definition::briefFile(), Entry::briefFile, Definition::briefLine(), Entry::briefLine, createMemberDef(), MemberDef::definition(), Entry::doc, Definition::docFile(), Entry::docFile, Definition::docLine(), Entry::docLine, Definition::documentation(), DString::empty(), MemberDef::excpString(), Definition::getBodyDef(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getMemberSpecifiers(), Definition::getStartBodyLine(), MemberDef::getVhdlSpecifiers(), Entry::id, Entry::inbodyDocs, Definition::inbodyDocumentation(), Definition::inbodyFile(), Entry::inbodyFile, Definition::inbodyLine(), Entry::inbodyLine, MemberDef::initializer(), MemberDef::initializerLines(), ClassDefMutable::insertMember(), MemberDef::isStatic(), Entry::lang, Doxygen::memberNameLinkedMap, MemberDef::memberType(), Entry::metaData, Entry::mGrpId, Definition::name(), Entry::protection, MemberName::push_back(), Entry::qualifiers, MemberDef::requiresClause(), Entry::startColumn, Entry::startLine, MemberDef::templateArguments(), toMemberDefMutable(), MemberDef::typeString(), and Entry::virt.

Referenced by findUsingDeclImports().

◆ devUsage()

void devUsage ( )
static

Definition at line 11726 of file doxygen.cpp.

11727{
11729 msg("Developer parameters:\n");
11730 msg(" -m dump symbol map\n");
11731 msg(" -b making messages output unbuffered\n");
11732 msg(" -c <file> process input file as a comment block and produce HTML output\n");
11733#if ENABLE_TRACING
11734 msg(" -t [<file|stdout|stderr>] trace debug info to file, stdout, or stderr (default file stdout)\n");
11735 msg(" -t_time [<file|stdout|stderr>] trace debug info to file, stdout, or stderr (default file stdout),\n"
11736 " and include time and thread information\n");
11737#endif
11738 msg(" -d <level> enable a debug level, such as (multiple invocations of -d are possible):\n");
11740}
@ Time
Definition debug.h:36
static void printFlags()
Definition debug.cpp:137
static void clearFlag(const DebugMask mask)
Definition debug.cpp:122

References Debug::clearFlag(), msg, Debug::printFlags(), and Debug::Time.

Referenced by readConfiguration().

◆ distributeClassGroupRelations()

void distributeClassGroupRelations ( )

Definition at line 1515 of file doxygen.cpp.

1516{
1517 //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
1518 //if (!inlineGroupedClasses) return;
1519 //printf("** distributeClassGroupRelations()\n");
1520
1521 ClassDefSet visitedClasses;
1522 for (const auto &cd : *Doxygen::classLinkedMap)
1523 {
1524 //printf("Checking %s\n",qPrint(cd->name()));
1525 // distribute the group to nested classes as well
1526 if (visitedClasses.find(cd.get())==visitedClasses.end() && !cd->partOfGroups().empty())
1527 {
1528 //printf(" Candidate for merging\n");
1529 GroupDef *gd = cd->partOfGroups().front();
1530 for (auto &ncd : cd->getClasses())
1531 {
1533 if (ncdm && ncdm->partOfGroups().empty())
1534 {
1535 //printf(" Adding %s to group '%s'\n",qPrint(ncd->name()),
1536 // gd->groupTitle());
1537 ncdm->makePartOfGroup(gd);
1538 gd->addClass(ncdm);
1539 }
1540 }
1541 visitedClasses.insert(cd.get()); // only visit every class once
1542 }
1543 }
1544}
virtual bool addClass(ClassDef *def)=0
std::unordered_set< const ClassDef * > ClassDefSet
Definition classdef.h:91

References GroupDef::addClass(), Doxygen::classLinkedMap, DefinitionMutable::makePartOfGroup(), Definition::partOfGroups(), and toClassDefMutable().

◆ distributeConceptGroups()

void distributeConceptGroups ( )
static

Definition at line 1362 of file doxygen.cpp.

1363{
1364 AUTO_TRACE();
1365 for (const auto &cd : *Doxygen::conceptLinkedMap)
1366 {
1367 if (cd->groupId()!=DOX_NOGROUP)
1368 {
1369 for (const auto &ocd : *Doxygen::conceptLinkedMap)
1370 {
1371 if (cd!=ocd && cd->groupId()==ocd->groupId() &&
1372 !cd->partOfGroups().empty() && ocd->partOfGroups().empty())
1373 {
1374 ConceptDefMutable *ocdm = toConceptDefMutable(ocd.get());
1375 if (ocdm)
1376 {
1377 for (const auto &gd : cd->partOfGroups())
1378 {
1379 if (gd)
1380 {
1381 AUTO_TRACE_ADD("making concept '{}' part of group '{}'",ocdm->name(),gd->name());
1382 ocdm->makePartOfGroup(gd);
1383 gd->addConcept(ocd.get());
1384 }
1385 }
1386 }
1387 }
1388 }
1389 }
1390 }
1391}
#define DOX_NOGROUP
Definition membergroup.h:26

References AUTO_TRACE, AUTO_TRACE_ADD, Doxygen::conceptLinkedMap, DOX_NOGROUP, DefinitionMutable::makePartOfGroup(), Definition::name(), and toConceptDefMutable().

Referenced by parseInput().

◆ distributeMemberGroupDocumentation()

void distributeMemberGroupDocumentation ( )
static

Definition at line 9780 of file doxygen.cpp.

9781{
9782 // for each class
9783 for (const auto &cd : *Doxygen::classLinkedMap)
9784 {
9785 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9786 if (cdm)
9787 {
9789 }
9790 }
9791 // for each file
9792 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9793 {
9794 for (const auto &fd : *fn)
9795 {
9796 fd->distributeMemberGroupDocumentation();
9797 }
9798 }
9799 // for each namespace
9800 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9801 {
9803 if (ndm)
9804 {
9806 }
9807 }
9808 // for each group
9809 for (const auto &gd : *Doxygen::groupLinkedMap)
9810 {
9811 gd->distributeMemberGroupDocumentation();
9812 }
9814}
virtual void distributeMemberGroupDocumentation()=0
void distributeMemberGroupDocumentation()
virtual void distributeMemberGroupDocumentation()=0

References Doxygen::classLinkedMap, ClassDefMutable::distributeMemberGroupDocumentation(), ModuleManager::distributeMemberGroupDocumentation(), NamespaceDefMutable::distributeMemberGroupDocumentation(), Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::namespaceLinkedMap, toClassDefMutable(), and toNamespaceDefMutable().

Referenced by parseInput().

◆ dumpSymbol()

void dumpSymbol ( TextStream & t,
Definition * d )
static

Definition at line 11685 of file doxygen.cpp.

11686{
11687 DString anchor;
11689 {
11690 MemberDef *md = toMemberDef(d);
11691 anchor=":"+md->anchor();
11692 }
11693 DString scope;
11694 DString fn = d->getOutputFileBase();
11697 {
11698 scope = fn;
11699 }
11700 t << "REPLACE INTO symbols (symbol_id,scope_id,name,file,line) VALUES('"
11701 << fn+anchor << "','"
11702 << scope << "','"
11703 << d->name() << "','"
11704 << d->getDefFileName() << "','"
11705 << d->getDefLine()
11706 << "');\n";
11707}
virtual DString anchor() const =0
virtual DString getOutputFileBase() const =0
MemberDef * toMemberDef(Definition *d)
void addHtmlExtensionIfMissing(DString &fName)
Definition util.cpp:4063

References addHtmlExtensionIfMissing(), Definition::anchor(), Definition::definitionType(), Definition::getDefFileName(), Definition::getDefLine(), Definition::getOuterScope(), Definition::getOutputFileBase(), Doxygen::globalScope, Definition::name(), toMemberDef(), and Definition::TypeMember.

Referenced by dumpSymbolMap().

◆ dumpSymbolMap()

void dumpSymbolMap ( )
static

Definition at line 11709 of file doxygen.cpp.

11710{
11711 std::ofstream f = Portable::openOutputStream("symbols.sql");
11712 if (f.is_open())
11713 {
11714 TextStream t(&f);
11715 for (const auto &[name,symList] : *Doxygen::symbolMap)
11716 {
11717 for (const auto &def : symList)
11718 {
11719 dumpSymbol(t,def);
11720 }
11721 }
11722 }
11723}
static void dumpSymbol(TextStream &t, Definition *d)
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:679

References dumpSymbol(), Portable::openOutputStream(), and Doxygen::symbolMap.

Referenced by generateOutput().

◆ exitDoxygen()

void exitDoxygen ( )
staticnoexcept

Definition at line 12617 of file doxygen.cpp.

12618{
12619 if (!g_successfulRun) // premature exit
12620 {
12621 Dir thisDir;
12622 msg("Exiting...\n");
12623 if (!Doxygen::filterDBFileName.empty())
12624 {
12625 thisDir.remove(Doxygen::filterDBFileName.str());
12626 }
12627 }
12628}
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:319
static DString filterDBFileName
Definition doxygen.h:124
static bool g_successfulRun
Definition doxygen.cpp:194

References Doxygen::filterDBFileName, g_successfulRun, msg, and Dir::remove().

Referenced by parseInput().

◆ extractClassName()

DString extractClassName ( const Entry * root)
static

Definition at line 5531 of file doxygen.cpp.

5532{
5533 // strip any anonymous scopes first
5536 if (size_t i=bName.find('<'); (root->lang==SrcLangExt::CSharp || root->lang==SrcLangExt::Java) && i!=DString::npos)
5537 {
5538 // a Java/C# generic class looks like a C++ specialization, so we need to strip the
5539 // template part before looking for matches
5540 if (root->lang==SrcLangExt::CSharp)
5541 {
5542 bName = mangleCSharpGenericName(root->name);
5543 }
5544 else
5545 {
5546 bName = bName.left(i);
5547 }
5548 }
5549 return bName;
5550}

References DString::find(), Entry::lang, DString::left(), mangleCSharpGenericName(), Entry::name, DString::npos, stripAnonymousNamespaceScope(), and stripTemplateSpecifiersFromScope().

Referenced by computeClassRelations(), findInheritedTemplateInstances(), and findUsedTemplateInstances().

◆ filterMemberDocumentation()

void filterMemberDocumentation ( const Entry * root,
const DString & relates )
static

Definition at line 7663 of file doxygen.cpp.

7664{
7665 AUTO_TRACE("root->type='{}' root->inside='{}' root->name='{}' root->args='{}' section={} root->spec={} root->mGrpId={}",
7666 root->type,root->inside,root->name,root->args,root->section,root->spec,root->mGrpId);
7667 //printf("root->parent()->name=%s\n",qPrint(root->parent()->name));
7668 bool isFunc=true;
7669
7670 DString type = root->type;
7671 DString args = root->args;
7672 int i=-1, l=0;
7673 if ( // detect func variable/typedef to func ptr
7674 (i=findFunctionPtr(type.str(),root->lang,&l))!=-1
7675 )
7676 {
7677 //printf("Fixing function pointer!\n");
7678 // fix type and argument
7679 args.prepend(type.mid(i+l));
7680 type=type.left(i+l);
7681 //printf("Results type=%s,name=%s,args=%s\n",qPrint(type),qPrint(root->name),qPrint(args));
7682 isFunc=false;
7683 }
7684 else if ((type.startsWith("typedef ") && args.find('(')!=DString::npos))
7685 // detect function types marked as functions
7686 {
7687 isFunc=false;
7688 }
7689
7690 //printf("Member %s isFunc=%d\n",qPrint(root->name),isFunc);
7691 if (root->section.isMemberDoc())
7692 {
7693 //printf("Documentation for inline member '%s' found args='%s'\n",
7694 // qPrint(root->name),qPrint(args));
7695 //if (relates.length()) printf(" Relates %s\n",qPrint(relates));
7696 if (type.empty())
7697 {
7698 findMember(root,
7699 relates,
7700 type,
7701 args,
7702 root->name + args + root->exception,
7703 false,
7704 isFunc);
7705 }
7706 else
7707 {
7708 findMember(root,
7709 relates,
7710 type,
7711 args,
7712 type + " " + root->name + args + root->exception,
7713 false,
7714 isFunc);
7715 }
7716 }
7717 else if (root->section.isOverloadDoc())
7718 {
7719 //printf("Overloaded member %s found\n",qPrint(root->name));
7720 findMember(root,
7721 relates,
7722 type,
7723 args,
7724 root->name,
7725 true,
7726 isFunc);
7727 }
7728 else if
7729 ((root->section.isFunction() // function
7730 ||
7731 (root->section.isVariable() && // variable
7732 !type.empty() && // with a type
7733 g_compoundKeywords.find(type.str())==g_compoundKeywords.end() // that is not a keyword
7734 // (to skip forward declaration of class etc.)
7735 )
7736 )
7737 )
7738 {
7739 //printf("Documentation for member '%s' found args='%s' excp='%s'\n",
7740 // qPrint(root->name),qPrint(args),qPrint(root->exception));
7741 //if (relates.length()) printf(" Relates %s\n",qPrint(relates));
7742 //printf("Inside=%s\n Relates=%s\n",qPrint(root->inside),qPrint(relates));
7743 if (isTypeAClassFriend(type))
7744 {
7745 findMember(root,
7746 relates,
7747 type,
7748 args,
7749 type+" "+root->name,
7750 false,false);
7751
7752 }
7753 else if (!type.empty())
7754 {
7755 findMember(root,
7756 relates,
7757 type,
7758 args,
7759 type+" "+ root->inside + root->name + args + root->exception,
7760 false,isFunc);
7761 }
7762 else
7763 {
7764 findMember(root,
7765 relates,
7766 type,
7767 args,
7768 root->inside + root->name + args + root->exception,
7769 false,isFunc);
7770 }
7771 }
7772 else if (root->section.isDefine() && !relates.empty())
7773 {
7774 findMember(root,
7775 relates,
7776 type,
7777 args,
7778 root->name + args,
7779 false,
7780 !args.empty());
7781 }
7782 else if (root->section.isVariableDoc())
7783 {
7784 //printf("Documentation for variable %s found\n",qPrint(root->name));
7785 //if (!relates.empty()) printf(" Relates %s\n",qPrint(relates));
7786 findMember(root,
7787 relates,
7788 type,
7789 args,
7790 root->name,
7791 false,
7792 false);
7793 }
7794 else if (root->section.isExportedInterface() ||
7795 root->section.isIncludedService())
7796 {
7797 findMember(root,
7798 relates,
7799 type,
7800 args,
7801 type + " " + root->name,
7802 false,
7803 false);
7804 }
7805 else
7806 {
7807 // skip section
7808 //printf("skip section\n");
7809 }
7810}
DString inside
name of the class in which documents are found
Definition entry.h:222
static void findMember(const Entry *root, const DString &relates, const DString &type, const DString &args, DString funcDecl, bool overloaded, bool isFunc)
Definition doxygen.cpp:7031

References Entry::args, AUTO_TRACE, DString::empty(), Entry::exception, DString::find(), findFunctionPtr(), findMember(), g_compoundKeywords, Entry::inside, isTypeAClassFriend(), Entry::lang, DString::left(), Entry::mGrpId, DString::mid(), Entry::name, DString::npos, DString::prepend(), Entry::section, Entry::spec, DString::startsWith(), DString::str(), and Entry::type.

Referenced by findMemberDocumentation().

◆ findBaseClassesForClass()

void findBaseClassesForClass ( const Entry * root,
Definition * context,
ClassDefMutable * masterCd,
ClassDefMutable * instanceCd,
FindBaseClassRelation_Mode mode,
bool isArtificial,
const ArgumentList * actualArgs = nullptr,
const TemplateNameMap & templateNames = TemplateNameMap() )
static

Definition at line 4986 of file doxygen.cpp.

4996{
4997 AUTO_TRACE("name={}",root->name);
4998 // The base class could ofcouse also be a non-nested class
4999 const ArgumentList &formalArgs = masterCd->templateArguments();
5000 for (const BaseInfo &bi : root->extends)
5001 {
5002 //printf("masterCd=%s bi.name='%s' #actualArgs=%d\n",
5003 // qPrint(masterCd->localName()),qPrint(bi.name),actualArgs ? (int)actualArgs->size() : -1);
5004 TemplateNameMap formTemplateNames;
5005 if (templateNames.empty())
5006 {
5007 formTemplateNames = getTemplateArgumentsInName(formalArgs,bi.name.str());
5008 }
5009 BaseInfo tbi = bi;
5010 tbi.name = substituteTemplateArgumentsInString(bi.name,formalArgs,actualArgs);
5011 //printf("masterCd=%p instanceCd=%p bi->name=%s tbi.name=%s\n",(void*)masterCd,(void*)instanceCd,qPrint(bi.name),qPrint(tbi.name));
5012
5013 if (mode==DocumentedOnly)
5014 {
5015 // find a documented base class in the correct scope
5016 if (!findClassRelation(root,context,instanceCd,&tbi,formTemplateNames,DocumentedOnly,isArtificial))
5017 {
5018 // 1.8.2: decided to show inheritance relations even if not documented,
5019 // we do make them artificial, so they do not appear in the index
5020 //if (!Config_getBool(HIDE_UNDOC_RELATIONS))
5021 bool b = Config_getBool(HIDE_UNDOC_RELATIONS) ? true : isArtificial;
5022 //{
5023 // no documented base class -> try to find an undocumented one
5024 findClassRelation(root,context,instanceCd,&tbi,formTemplateNames,Undocumented,b);
5025 //}
5026 }
5027 }
5028 else if (mode==TemplateInstances)
5029 {
5030 findClassRelation(root,context,instanceCd,&tbi,formTemplateNames,TemplateInstances,isArtificial);
5031 }
5032 }
5033}

References AUTO_TRACE, Config_getBool, DocumentedOnly, Entry::extends, findClassRelation(), getTemplateArgumentsInName(), BaseInfo::name, Entry::name, DString::str(), substituteTemplateArgumentsInString(), ClassDef::templateArguments(), TemplateInstances, and Undocumented.

Referenced by computeClassRelations(), findInheritedTemplateInstances(), and findTemplateInstanceRelation().

◆ findClassDefinition()

const ClassDef * findClassDefinition ( FileDef * fd,
NamespaceDef * nd,
const DString & scopeName )
static

Definition at line 5996 of file doxygen.cpp.

5998{
5999 SymbolResolver resolver(fd);
6000 const ClassDef *tcd = resolver.resolveClass(nd,scopeName,true,true);
6001 //printf("findClassDefinition(fd=%s,ns=%s,scopeName=%s)='%s'\n",
6002 // qPrint(fd?fd->name():""),qPrint(nd?nd->name():""),
6003 // qPrint(scopeName),qPrint(tcd?tcd->name():""));
6004 return tcd;
6005}

References SymbolResolver::resolveClass().

Referenced by addMemberFunction().

◆ findClassEntries()

void findClassEntries ( const Entry * root)
static

Builds a dictionary of all entry nodes in the tree starting with root

Definition at line 5522 of file doxygen.cpp.

5523{
5524 if (isClassSection(root))
5525 {
5526 g_classEntries.emplace(root->name.str(),root);
5527 }
5528 for (const auto &e : root->children()) findClassEntries(e.get());
5529}
static void findClassEntries(const Entry *root)
Definition doxygen.cpp:5522
static bool isClassSection(const Entry *root)
Definition doxygen.cpp:5500

References Entry::children(), findClassEntries(), g_classEntries, isClassSection(), Entry::name, and DString::str().

Referenced by findClassEntries(), and parseInput().

◆ findClassRelation()

bool findClassRelation ( const Entry * root,
Definition * context,
ClassDefMutable * cd,
const BaseInfo * bi,
const TemplateNameMap & templateNames,
FindBaseClassRelation_Mode mode,
bool isArtificial )
static

Definition at line 5158 of file doxygen.cpp.

5167{
5168 AUTO_TRACE("name={} base={} isArtificial={} mode={}",cd->name(),bi->name,isArtificial,(int)mode);
5169
5170 DString biName=bi->name;
5171 bool explicitGlobalScope=false;
5172 if (biName.startsWith("::")) // explicit global scope
5173 {
5174 biName=biName.mid(2);
5175 explicitGlobalScope=true;
5176 }
5177
5178 Entry *parentNode=root->parent();
5179 bool lastParent=false;
5180 do // for each parent scope, starting with the largest scope
5181 // (in case of nested classes)
5182 {
5183 DString scopeName= parentNode ? parentNode->name : DString();
5184 int scopeOffset=explicitGlobalScope ? 0 : static_cast<int>(scopeName.length());
5185 do // try all parent scope prefixes, starting with the largest scope
5186 {
5187 //printf("scopePrefix='%s' biName='%s'\n",
5188 // qPrint(scopeName.left(scopeOffset)),qPrint(biName));
5189
5190 DString baseClassName=biName;
5191 if (scopeOffset>0)
5192 {
5193 baseClassName.prepend(scopeName.left(scopeOffset)+"::");
5194 }
5195 if (root->lang==SrcLangExt::CSharp)
5196 {
5197 baseClassName = mangleCSharpGenericName(baseClassName);
5198 }
5199 AUTO_TRACE_ADD("cd='{}' baseClassName='{}'",cd->name(),baseClassName);
5200 SymbolResolver resolver(cd->getFileDef());
5201 ClassDefMutable *baseClass = resolver.resolveClassMutable(explicitGlobalScope ? Doxygen::globalScope : context,
5202 baseClassName,
5203 mode==Undocumented,
5204 true
5205 );
5206 const MemberDef *baseClassTypeDef = resolver.getTypedef();
5207 DString templSpec = resolver.getTemplateSpec();
5208 //printf("baseClassName=%s baseClass=%p cd=%p explicitGlobalScope=%d\n",
5209 // qPrint(baseClassName),baseClass,cd,explicitGlobalScope);
5210 //printf(" scope='%s' baseClassName='%s' baseClass=%s templSpec=%s\n",
5211 // cd ? qPrint(cd->name()):"<none>",
5212 // qPrint(baseClassName),
5213 // baseClass?qPrint(baseClass->name()):"<none>",
5214 // qPrint(templSpec)
5215 // );
5216 //if (baseClassName.left(root->name.length())!=root->name ||
5217 // baseClassName.at(root->name.length())!='<'
5218 // ) // Check for base class with the same name.
5219 // // If found then look in the outer scope for a match
5220 // // and prevent recursion.
5221 if (!isRecursiveBaseClass(root->name,baseClassName)
5222 || explicitGlobalScope
5223 // sadly isRecursiveBaseClass always true for UNO IDL ifc/svc members
5224 // (i.e. this is needed for addInterfaceOrServiceToServiceOrSingleton)
5225 || (root->lang==SrcLangExt::IDL &&
5226 (root->section.isExportedInterface() ||
5227 root->section.isIncludedService()))
5228 )
5229 {
5230 AUTO_TRACE_ADD("class relation '{}' inherited/used by '{}' found prot={} virt={} templSpec='{}'",
5231 baseClassName, root->name, bi->prot, bi->virt, templSpec);
5232
5233 int i=findTemplateSpecializationPosition(baseClassName);
5234 size_t si=baseClassName.rfind("::",i);
5235 if (si==DString::npos) si=0;
5236 if (baseClass==nullptr && static_cast<size_t>(i)!=baseClassName.length())
5237 // base class has template specifiers
5238 {
5239 // TODO: here we should try to find the correct template specialization
5240 // but for now, we only look for the unspecialized base class.
5241 int e=findEndOfTemplate(baseClassName,i+1);
5242 //printf("baseClass==0 i=%d e=%d\n",i,e);
5243 if (e!=-1) // end of template was found at e
5244 {
5245 templSpec = removeRedundantWhiteSpace(baseClassName.mid(i,e-i));
5246 baseClassName = baseClassName.left(i)+baseClassName.mid(e);
5247 baseClass = resolver.resolveClassMutable(explicitGlobalScope ? Doxygen::globalScope : context,
5248 baseClassName,
5249 mode==Undocumented,
5250 true
5251 );
5252 baseClassTypeDef = resolver.getTypedef();
5253 //printf("baseClass=%p -> baseClass=%s templSpec=%s\n",
5254 // baseClass,qPrint(baseClassName),qPrint(templSpec));
5255 }
5256 }
5257 else if (baseClass && !templSpec.empty()) // we have a known class, but also
5258 // know it is a template, so see if
5259 // we can also link to the explicit
5260 // instance (for instance if a class
5261 // derived from a template argument)
5262 {
5263 //printf("baseClass=%s templSpec=%s\n",qPrint(baseClass->name()),qPrint(templSpec));
5264 ClassDefMutable *templClass=getClassMutable(baseClass->name()+templSpec);
5265 if (templClass)
5266 {
5267 // use the template instance instead of the template base.
5268 baseClass = templClass;
5269 templSpec.clear();
5270 }
5271 }
5272
5273 //printf("cd=%p baseClass=%p\n",cd,baseClass);
5274 bool found=baseClass!=nullptr && (baseClass!=cd || mode==TemplateInstances);
5275 AUTO_TRACE_ADD("1. found={}",found);
5276 if (!found && si!=DString::npos)
5277 {
5278 // replace any namespace aliases
5279 replaceNamespaceAliases(baseClassName);
5280 baseClass = resolver.resolveClassMutable(explicitGlobalScope ? Doxygen::globalScope : context,
5281 baseClassName,
5282 mode==Undocumented,
5283 true
5284 );
5285 baseClassTypeDef = resolver.getTypedef();
5286 found=baseClass!=nullptr && baseClass!=cd;
5287 if (found) templSpec = resolver.getTemplateSpec();
5288 }
5289 AUTO_TRACE_ADD("2. found={}",found);
5290
5291 if (!found)
5292 {
5293 baseClass=toClassDefMutable(findClassWithinClassContext(context,cd,baseClassName));
5294 //printf("findClassWithinClassContext(%s,%s)=%p\n",
5295 // qPrint(cd->name()),qPrint(baseClassName),baseClass);
5296 found = baseClass!=nullptr && baseClass!=cd;
5297
5298 }
5299 AUTO_TRACE_ADD("3. found={}",found);
5300 if (!found)
5301 {
5302 // for PHP the "use A\B as C" construct map class C to A::B, so we lookup
5303 // the class name also in the alias mapping.
5304 auto it = Doxygen::namespaceAliasMap.find(baseClassName.str());
5305 if (it!=Doxygen::namespaceAliasMap.end()) // see if it is indeed a class.
5306 {
5307 baseClass=getClassMutable(it->second.alias);
5308 found = baseClass!=nullptr && baseClass!=cd;
5309 }
5310 }
5311 bool isATemplateArgument = templateNames.find(biName.str())!=templateNames.end();
5312
5313 AUTO_TRACE_ADD("4. found={}",found);
5314 if (found)
5315 {
5316 AUTO_TRACE_ADD("Documented base class '{}' templSpec='{}'",biName,templSpec);
5317 // add base class to this class
5318
5319 // if templSpec is not empty then we should "instantiate"
5320 // the template baseClass. A new ClassDef should be created
5321 // to represent the instance. To be able to add the (instantiated)
5322 // members and documentation of a template class
5323 // (inserted in that template class at a later stage),
5324 // the template should know about its instances.
5325 // the instantiation process, should be done in a recursive way,
5326 // since instantiating a template may introduce new inheritance
5327 // relations.
5328 if (!templSpec.empty() && mode==TemplateInstances)
5329 {
5330 // if baseClass is actually a typedef then we should not
5331 // instantiate it, since typedefs are in a different namespace
5332 // see bug531637 for an example where this would otherwise hang
5333 // Doxygen
5334 if (baseClassTypeDef==nullptr)
5335 {
5336 //printf(" => findTemplateInstanceRelation: %s\n",qPrint(baseClass->name()));
5337 findTemplateInstanceRelation(root,context,baseClass,templSpec,templateNames,baseClass->isArtificial());
5338 }
5339 }
5340 else if (mode==DocumentedOnly || mode==Undocumented)
5341 {
5342 //printf(" => insert base class\n");
5343 DString usedName;
5344 if (baseClassTypeDef)
5345 {
5346 usedName=biName;
5347 //printf("***** usedName=%s templSpec=%s\n",qPrint(usedName),qPrint(templSpec));
5348 }
5349 Protection prot = bi->prot;
5350 if (Config_getBool(SIP_SUPPORT)) prot=Protection::Public;
5351 if (cd!=baseClass && !cd->isSubClass(baseClass) && baseClass->isBaseClass(cd,true,templSpec)==0) // check for recursion, see bug690787
5352 {
5353 AUTO_TRACE_ADD("insertBaseClass name={} prot={} virt={} templSpec={}",usedName,prot,bi->virt,templSpec);
5354 cd->insertBaseClass(baseClass,usedName,prot,bi->virt,templSpec);
5355 // add this class as super class to the base class
5356 baseClass->insertSubClass(cd,prot,bi->virt,templSpec);
5357 }
5358 else
5359 {
5360 warn(root->fileName,root->startLine,
5361 "Detected potential recursive class relation "
5362 "between class {} and base class {}!",
5363 cd->name(),baseClass->name()
5364 );
5365 }
5366 }
5367 return true;
5368 }
5369 else if (mode==Undocumented && (scopeOffset==0 || isATemplateArgument))
5370 {
5371 AUTO_TRACE_ADD("New undocumented base class '{}' baseClassName='{}' templSpec='{}' isArtificial={}",
5372 biName,baseClassName,templSpec,isArtificial);
5373 baseClass=nullptr;
5374 if (isATemplateArgument)
5375 {
5376 baseClass = toClassDefMutable(Doxygen::hiddenClassLinkedMap->find(baseClassName));
5377 if (baseClass==nullptr) // not found (or alias)
5378 {
5379 baseClass= toClassDefMutable(
5380 Doxygen::hiddenClassLinkedMap->add(baseClassName,
5381 createClassDef(root->fileName,root->startLine,root->startColumn,
5382 baseClassName,
5383 ClassDef::Class)));
5384 if (baseClass) // really added (not alias)
5385 {
5386 if (isArtificial) baseClass->setArtificial(true);
5387 baseClass->setLanguage(root->lang);
5388 }
5389 }
5390 }
5391 else
5392 {
5393 baseClass = toClassDefMutable(Doxygen::classLinkedMap->find(baseClassName));
5394 //printf("*** classDDict->find(%s)=%p biName=%s templSpec=%s\n",
5395 // qPrint(baseClassName),baseClass,qPrint(biName),qPrint(templSpec));
5396 if (baseClass==nullptr) // not found (or alias)
5397 {
5398 baseClass = toClassDefMutable(
5399 Doxygen::classLinkedMap->add(baseClassName,
5400 createClassDef(root->fileName,root->startLine,root->startColumn,
5401 baseClassName,
5402 ClassDef::Class)));
5403 if (baseClass) // really added (not alias)
5404 {
5405 if (isArtificial) baseClass->setArtificial(true);
5406 baseClass->setLanguage(root->lang);
5407 si = baseClassName.rfind("::");
5408 if (si!=DString::npos) // class is nested
5409 {
5410 Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),nullptr,root->tagInfo());
5411 if (sd==nullptr || sd==Doxygen::globalScope) // outer scope not found
5412 {
5413 baseClass->setArtificial(true); // see bug678139
5414 }
5415 }
5416 }
5417 }
5418 }
5419 if (baseClass)
5420 {
5421 if (biName.endsWith("-p"))
5422 {
5423 biName="<"+biName.left(biName.length()-2)+">";
5424 }
5425 if (!cd->isSubClass(baseClass) && cd!=baseClass && cd->isBaseClass(baseClass,true,templSpec)==0) // check for recursion
5426 {
5427 AUTO_TRACE_ADD("insertBaseClass name={} prot={} virt={} templSpec={}",biName,bi->prot,bi->virt,templSpec);
5428 // add base class to this class
5429 cd->insertBaseClass(baseClass,biName,bi->prot,bi->virt,templSpec);
5430 // add this class as super class to the base class
5431 baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec);
5432 }
5433 // the undocumented base was found in this file
5434 baseClass->insertUsedFile(root->fileDef());
5435
5436 Definition *scope = buildScopeFromQualifiedName(baseClass->name(),root->lang,nullptr);
5437 if (scope!=baseClass)
5438 {
5439 baseClass->setOuterScope(scope);
5440 }
5441
5442 if (baseClassName.endsWith("-p"))
5443 {
5445 }
5446 return true;
5447 }
5448 else
5449 {
5450 AUTO_TRACE_ADD("Base class '{}' not created (alias?)",biName);
5451 }
5452 }
5453 else
5454 {
5455 AUTO_TRACE_ADD("Base class '{}' not found",biName);
5456 }
5457 }
5458 else
5459 {
5460 if (mode!=TemplateInstances)
5461 {
5462 warn(root->fileName,root->startLine,
5463 "Detected potential recursive class relation "
5464 "between class {} and base class {}!",
5465 root->name,baseClassName
5466 );
5467 }
5468 // for mode==TemplateInstance this case is quite common and
5469 // indicates a relation between a template class and a template
5470 // instance with the same name.
5471 }
5472 if (scopeOffset==0)
5473 {
5474 scopeOffset=-1;
5475 }
5476 else
5477 {
5478 size_t o = scopeName.rfind("::",scopeOffset-1);
5479 scopeOffset = o!=DString::npos ? static_cast<int>(o) : 0;
5480 }
5481 //printf("new scopeOffset='%d'",scopeOffset);
5482 } while (scopeOffset>=0);
5483
5484 if (parentNode==nullptr)
5485 {
5486 lastParent=true;
5487 }
5488 else
5489 {
5490 parentNode=parentNode->parent();
5491 }
5492 } while (lastParent);
5493
5494 return false;
5495}
virtual int isBaseClass(const ClassDef *bcd, bool followInstances, const DString &templSpec=DString()) const =0
Returns true iff bcd is a direct or indirect base class of this class.
virtual bool isSubClass(ClassDef *bcd, int level=0) const =0
Returns true iff bcd is a direct or indirect sub class of this class.
virtual void insertSubClass(ClassDef *, Protection p, Specifier s, const DString &t=DString())=0
virtual void insertBaseClass(ClassDef *, const DString &name, Protection p, Specifier s, const DString &t=DString())=0
void clear()
Definition dstring.h:214
static NamespaceAliasInfoMap namespaceAliasMap
Definition doxygen.h:106
static int findTemplateSpecializationPosition(const DString &name)
Definition doxygen.cpp:5128
static ClassDef * findClassWithinClassContext(Definition *context, ClassDef *cd, const DString &name)
Definition doxygen.cpp:4795
static void findTemplateInstanceRelation(const Entry *root, Definition *context, ClassDefMutable *templateClass, const DString &templSpec, const TemplateNameMap &templateNames, bool isArtificial)
Definition doxygen.cpp:5037
static bool isRecursiveBaseClass(const DString &scope, const DString &name)
Definition doxygen.cpp:5117
void replaceNamespaceAliases(DString &name)
Protection prot
inheritance type
Definition entry.h:101
Specifier virt
virtualness
Definition entry.h:102
Protection
Definition types.h:32

References AUTO_TRACE, AUTO_TRACE_ADD, buildScopeFromQualifiedName(), ClassDef::Class, Doxygen::classLinkedMap, DString::clear(), Config_getBool, createClassDef(), DocumentedOnly, DString::empty(), end(), DString::endsWith(), Entry::fileDef(), Entry::fileName, findClassWithinClassContext(), findEndOfTemplate(), findScopeFromQualifiedName(), findTemplateInstanceRelation(), findTemplateSpecializationPosition(), getClassMutable(), ClassDef::getFileDef(), SymbolResolver::getTemplateSpec(), SymbolResolver::getTypedef(), Doxygen::globalScope, Doxygen::hiddenClassLinkedMap, ClassDefMutable::insertBaseClass(), ClassDefMutable::insertSubClass(), ClassDefMutable::insertUsedFile(), Definition::isArtificial(), ClassDef::isBaseClass(), isRecursiveBaseClass(), ClassDef::isSubClass(), Entry::lang, DString::left(), DString::length(), mangleCSharpGenericName(), DString::mid(), BaseInfo::name, Definition::name(), Entry::name, Doxygen::namespaceAliasMap, DString::npos, Entry::parent(), DString::prepend(), BaseInfo::prot, ClassDef::Protocol, removeRedundantWhiteSpace(), replaceNamespaceAliases(), SymbolResolver::resolveClassMutable(), DString::rfind(), Entry::section, DefinitionMutable::setArtificial(), ClassDefMutable::setCompoundType(), DefinitionMutable::setLanguage(), DefinitionMutable::setOuterScope(), Entry::startColumn, Entry::startLine, DString::startsWith(), DString::str(), Entry::tagInfo(), TemplateInstances, toClassDefMutable(), Undocumented, BaseInfo::virt, and warn.

Referenced by addInterfaceOrServiceToServiceOrSingleton(), computeTemplateClassRelations(), findBaseClassesForClass(), and findUsedClassesForClass().

◆ findClassWithinClassContext()

ClassDef * findClassWithinClassContext ( Definition * context,
ClassDef * cd,
const DString & name )
static

Searches a class from within context and cd and returns its definition if found (otherwise nullptr is returned).

Definition at line 4795 of file doxygen.cpp.

4796{
4797 ClassDef *result=nullptr;
4798 if (cd==nullptr)
4799 {
4800 return result;
4801 }
4802 FileDef *fd=cd->getFileDef();
4803 SymbolResolver resolver(fd);
4804 if (context && cd!=context)
4805 {
4806 result = const_cast<ClassDef*>(resolver.resolveClass(context,name,true,true));
4807 }
4808 //printf("1. result=%p\n",result);
4809 if (result==nullptr)
4810 {
4811 result = const_cast<ClassDef*>(resolver.resolveClass(cd,name,true,true));
4812 }
4813 //printf("2. result=%p\n",result);
4814 if (result==nullptr) // try direct class, needed for namespaced classes imported via tag files (see bug624095)
4815 {
4816 result = getClass(name);
4817 }
4818 //printf("3. result=%p\n",result);
4819 //printf("** Trying to find %s within context %s class %s result=%s lookup=%p\n",
4820 // qPrint(name),
4821 // context ? qPrint(context->name()) : "<none>",
4822 // cd ? qPrint(cd->name()) : "<none>",
4823 // result ? qPrint(result->name()) : "<none>",
4824 // Doxygen::classLinkedMap->find(name)
4825 // );
4826 return result;
4827}

References getClass(), ClassDef::getFileDef(), and SymbolResolver::resolveClass().

Referenced by findClassRelation(), and findUsedClassesForClass().

◆ findDefineDocumentation()

void findDefineDocumentation ( Entry * root)
static

Definition at line 9990 of file doxygen.cpp.

9991{
9992 if ((root->section.isDefineDoc() || root->section.isDefine()) && !root->name.empty())
9993 {
9994 //printf("found define '%s' '%s' brief='%s' doc='%s'\n",
9995 // qPrint(root->name),qPrint(root->args),qPrint(root->brief),qPrint(root->doc));
9996
9997 if (root->tagInfo() && !root->name.empty()) // define read from a tag file
9998 {
9999 auto md = createMemberDef(root->tagInfo()->tagName,1,1,
10000 "#define",root->name,root->args,DString(),
10001 Protection::Public,Specifier::Normal,false,Relationship::Member,MemberType::Define,
10002 ArgumentList(),ArgumentList(),"");
10003 auto mmd = toMemberDefMutable(md.get());
10004 mmd->setTagInfo(root->tagInfo());
10005 mmd->setLanguage(root->lang);
10006 mmd->addQualifiers(root->qualifiers);
10007 //printf("Searching for '%s' fd=%p\n",qPrint(filePathName),fd);
10008 mmd->setFileDef(root->parent()->fileDef());
10009 //printf("Adding member=%s\n",qPrint(md->name()));
10011 mn->push_back(std::move(md));
10012 }
10014 if (mn)
10015 {
10016 int count=0;
10017 for (const auto &md : *mn)
10018 {
10019 if (md->memberType()==MemberType::Define) count++;
10020 }
10021 if (count==1)
10022 {
10023 for (const auto &imd : *mn)
10024 {
10025 MemberDefMutable *md = toMemberDefMutable(imd.get());
10026 if (md && md->memberType()==MemberType::Define)
10027 {
10028 addDefineDoc(root,md);
10029 }
10030 }
10031 }
10032 else if (count>1 &&
10033 (!root->doc.empty() ||
10034 !root->brief.empty() ||
10035 root->bodyLine!=-1
10036 )
10037 )
10038 // multiple defines don't know where to add docs
10039 // but maybe they are in different files together with their documentation
10040 {
10041 for (const auto &imd : *mn)
10042 {
10043 MemberDefMutable *md = toMemberDefMutable(imd.get());
10044 if (md && md->memberType()==MemberType::Define)
10045 {
10046 if (haveEqualFileNames(root, md) || isEntryInGroupOfMember(root, md))
10047 // doc and define in the same file or group assume they belong together.
10048 {
10049 addDefineDoc(root,md);
10050 }
10051 }
10052 }
10053 //warn("define {} found in the following files:\n",root->name);
10054 //warn("Cannot determine where to add the documentation found "
10055 // "at line {} of file {}. \n",
10056 // root->startLine,root->fileName);
10057 }
10058 }
10059 else if (!root->doc.empty() || !root->brief.empty()) // define not found
10060 {
10061 bool preEnabled = Config_getBool(ENABLE_PREPROCESSING);
10062 if (preEnabled)
10063 {
10064 warn(root->fileName,root->startLine,"documentation for unknown define {} found.",root->name);
10065 }
10066 else
10067 {
10068 warn(root->fileName,root->startLine, "found documented #define {} but ignoring it because ENABLE_PREPROCESSING is NO.", root->name);
10069 }
10070 }
10071 }
10072 for (const auto &e : root->children()) findDefineDocumentation(e.get());
10073}
static void findDefineDocumentation(Entry *root)
Definition doxygen.cpp:9990
static void addDefineDoc(const Entry *root, MemberDefMutable *md)
Definition doxygen.cpp:9963
static bool haveEqualFileNames(const Entry *root, const MemberDef *md)
Definition doxygen.cpp:9952
static bool isEntryInGroupOfMember(const Entry *root, const MemberDef *md, bool allowNoGroup=false)
Definition doxygen.cpp:6011

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addDefineDoc(), Entry::args, Entry::bodyLine, Entry::brief, Entry::children(), Config_getBool, createMemberDef(), Entry::doc, DString::empty(), Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findDefineDocumentation(), Doxygen::functionNameLinkedMap, haveEqualFileNames(), isEntryInGroupOfMember(), Entry::lang, MemberDef::memberType(), Entry::name, Entry::parent(), MemberName::push_back(), Entry::qualifiers, Entry::section, Entry::startLine, Entry::tagInfo(), TagInfo::tagName, toMemberDefMutable(), and warn.

Referenced by findDefineDocumentation(), and parseInput().

◆ findDEV()

void findDEV ( const MemberNameLinkedMap & mnsd)
static

Definition at line 8548 of file doxygen.cpp.

8549{
8550 // for each member name
8551 for (const auto &mn : mnsd)
8552 {
8553 // for each member definition
8554 for (const auto &imd : *mn)
8555 {
8556 MemberDefMutable *md = toMemberDefMutable(imd.get());
8557 if (md && md->isEnumerate()) // member is an enum
8558 {
8559 int documentedEnumValues=0;
8560 // for each enum value
8561 for (const auto &fmd : md->enumFieldList())
8562 {
8563 if (fmd->isLinkableInProject()) documentedEnumValues++;
8564 }
8565 // at least one enum value is documented
8566 if (documentedEnumValues>0) md->setDocumentedEnumValues(true);
8567 }
8568 }
8569 }
8570}
virtual const MemberVector & enumFieldList() const =0
virtual void setDocumentedEnumValues(bool value)=0

References MemberDef::enumFieldList(), MemberDef::isEnumerate(), MemberDefMutable::setDocumentedEnumValues(), and toMemberDefMutable().

Referenced by findDocumentedEnumValues().

◆ findDirDocumentation()

void findDirDocumentation ( const Entry * root)
static

Definition at line 10077 of file doxygen.cpp.

10078{
10079 if (root->section.isDirDoc())
10080 {
10081 DString normalizedName = root->name;
10082 normalizedName = substitute(normalizedName,"\\","/");
10083 //printf("root->docFile=%s normalizedName=%s\n",
10084 // qPrint(root->docFile),qPrint(normalizedName));
10085 if (root->docFile==normalizedName) // current dir?
10086 {
10087 if (size_t lastSlashPos=normalizedName.rfind('/'); lastSlashPos!=DString::npos) // strip file name
10088 {
10089 normalizedName=normalizedName.left(lastSlashPos);
10090 }
10091 }
10092 if (normalizedName.at(normalizedName.length()-1)!='/')
10093 {
10094 normalizedName+='/';
10095 }
10096 DirDef *matchingDir=nullptr;
10097 for (const auto &dir : *Doxygen::dirLinkedMap)
10098 {
10099 //printf("Dir: %s<->%s\n",qPrint(dir->name()),qPrint(normalizedName));
10100 if (dir->name().right(normalizedName.length())==normalizedName)
10101 {
10102 if (matchingDir)
10103 {
10104 warn(root->fileName,root->startLine,
10105 "\\dir command matches multiple directories.\n"
10106 " Applying the command for directory {}\n"
10107 " Ignoring the command for directory {}",
10108 matchingDir->name(),dir->name()
10109 );
10110 }
10111 else
10112 {
10113 matchingDir=dir.get();
10114 }
10115 }
10116 }
10117 if (matchingDir)
10118 {
10119 //printf("Match for with dir %s #anchor=%zu\n",qPrint(matchingDir->name()),root->anchors.size());
10120 matchingDir->setBriefDescription(root->brief,root->briefFile,root->briefLine);
10121 matchingDir->setDocumentation(root->doc,root->docFile,root->docLine);
10122 matchingDir->setRefItems(root->sli);
10123 matchingDir->setRequirementReferences(root->rqli);
10124 matchingDir->addSectionsToDefinition(root->anchors);
10125 root->commandOverrides.apply_directoryGraph([&](bool b) { matchingDir->overrideDirectoryGraph(b); });
10126 addDirToGroups(root,matchingDir);
10127 }
10128 else
10129 {
10130 warn(root->fileName,root->startLine,"No matching directory found for command \\dir {}",normalizedName);
10131 }
10132 }
10133 for (const auto &e : root->children()) findDirDocumentation(e.get());
10134}
A model of a directory symbol.
Definition dirdef.h:108
virtual void overrideDirectoryGraph(bool e)=0
static void findDirDocumentation(const Entry *root)
void addDirToGroups(const Entry *root, DirDef *dd)

References addDirToGroups(), DefinitionMutable::addSectionsToDefinition(), Entry::anchors, DString::at(), Entry::brief, Entry::briefFile, Entry::briefLine, Entry::children(), Entry::commandOverrides, Doxygen::dirLinkedMap, Entry::doc, Entry::docFile, Entry::docLine, Entry::fileName, findDirDocumentation(), DString::left(), DString::length(), Definition::name(), Entry::name, DString::npos, DirDef::overrideDirectoryGraph(), DString::rfind(), Entry::rqli, Entry::section, DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, Entry::startLine, substitute(), and warn.

Referenced by findDirDocumentation(), and parseInput().

◆ findDocumentedEnumValues()

void findDocumentedEnumValues ( )
static

Definition at line 8574 of file doxygen.cpp.

8575{
8578}
static void findDEV(const MemberNameLinkedMap &mnsd)
Definition doxygen.cpp:8548

References findDEV(), Doxygen::functionNameLinkedMap, and Doxygen::memberNameLinkedMap.

Referenced by parseInput().

◆ findEndOfTemplate()

int findEndOfTemplate ( const DString & s,
size_t startPos )
static

Searches for the end of a template in prototype s starting from character position startPos. If the end was found the position of the closing > is returned, otherwise -1 is returned.

Handles exotic cases such as

Class<(id<0)>
Class<bits<<2>
Class<"<">
Class<'<'>
Class<(")<")>

Definition at line 3377 of file doxygen.cpp.

3378{
3379 // locate end of template
3380 size_t e=startPos;
3381 int brCount=1;
3382 int roundCount=0;
3383 size_t len = s.length();
3384 bool insideString=false;
3385 bool insideChar=false;
3386 char pc = 0;
3387 while (e<len && brCount!=0)
3388 {
3389 char c=s.at(e);
3390 switch(c)
3391 {
3392 case '<':
3393 if (!insideString && !insideChar)
3394 {
3395 if (e<len-1 && s.at(e+1)=='<')
3396 e++;
3397 else if (roundCount==0)
3398 brCount++;
3399 }
3400 break;
3401 case '>':
3402 if (!insideString && !insideChar)
3403 {
3404 if (e<len-1 && s.at(e+1)=='>')
3405 e++;
3406 else if (roundCount==0)
3407 brCount--;
3408 }
3409 break;
3410 case '(':
3411 if (!insideString && !insideChar)
3412 roundCount++;
3413 break;
3414 case ')':
3415 if (!insideString && !insideChar)
3416 roundCount--;
3417 break;
3418 case '"':
3419 if (!insideChar)
3420 {
3421 if (insideString && pc!='\\')
3422 insideString=false;
3423 else
3424 insideString=true;
3425 }
3426 break;
3427 case '\'':
3428 if (!insideString)
3429 {
3430 if (insideChar && pc!='\\')
3431 insideChar=false;
3432 else
3433 insideChar=true;
3434 }
3435 break;
3436 }
3437 pc = c;
3438 e++;
3439 }
3440 return brCount==0 ? static_cast<int>(e) : -1;
3441}

References DString::at(), and DString::length().

Referenced by addVariable(), and findClassRelation().

◆ findEnumDocumentation()

void findEnumDocumentation ( const Entry * root)
static

Definition at line 8463 of file doxygen.cpp.

8464{
8465 if (root->section.isEnumDoc() &&
8466 !root->name.empty() &&
8467 root->name.at(0)!='@' // skip anonymous enums
8468 )
8469 {
8470 DString name;
8471 DString scope;
8472 if (size_t i = root->name.rfind("::"); i!=DString::npos) // scope is specified as part of the name
8473 {
8474 name=root->name.mid(i+2); // extract name
8475 scope=root->name.left(i); // extract scope
8476 //printf("Scope='%s' Name='%s'\n",qPrint(scope),qPrint(name));
8477 }
8478 else // just the name
8479 {
8480 name=root->name;
8481 }
8482 if (root->parent()->section.isScope() && !root->parent()->name.empty()) // found enum docs inside a compound
8483 {
8484 if (!scope.empty()) scope.prepend("::");
8485 scope.prepend(root->parent()->name);
8486 }
8487 const ClassDef *cd = getClass(scope);
8489 const FileDef *fd = root->fileDef();
8490 AUTO_TRACE("Found docs for enum with name '{}' and scope '{}' in context '{}' cd='{}', nd='{}' fd='{}'",
8491 name,scope,root->parent()->name,
8492 cd ? cd->name() : DString("<none>"),
8493 nd ? nd->name() : DString("<none>"),
8494 fd ? fd->name() : DString("<none>"));
8495
8496 if (!name.empty())
8497 {
8498 bool found = tryAddEnumDocsToGroupMember(root, name);
8499 if (!found)
8500 {
8502 if (mn)
8503 {
8504 for (const auto &imd : *mn)
8505 {
8506 MemberDefMutable *md = toMemberDefMutable(imd.get());
8507 if (md && md->isEnumerate())
8508 {
8509 const ClassDef *mcd = md->getClassDef();
8510 const NamespaceDef *mnd = md->getNamespaceDef();
8511 const FileDef *mfd = md->getFileDef();
8512 if (cd && mcd==cd)
8513 {
8514 AUTO_TRACE_ADD("Match found for class scope");
8515 addEnumDocs(root,md);
8516 found = true;
8517 break;
8518 }
8519 else if (cd==nullptr && mcd==nullptr && nd!=nullptr && mnd==nd)
8520 {
8521 AUTO_TRACE_ADD("Match found for namespace scope");
8522 addEnumDocs(root,md);
8523 found = true;
8524 break;
8525 }
8526 else if (cd==nullptr && nd==nullptr && mcd==nullptr && mnd==nullptr && fd==mfd)
8527 {
8528 AUTO_TRACE_ADD("Match found for global scope");
8529 addEnumDocs(root,md);
8530 found = true;
8531 break;
8532 }
8533 }
8534 }
8535 }
8536 }
8537 if (!found)
8538 {
8539 warn(root->fileName,root->startLine, "Documentation for undefined enum '{}' found.", name);
8540 }
8541 }
8542 }
8543 for (const auto &e : root->children()) findEnumDocumentation(e.get());
8544}
static void addEnumDocs(const Entry *root, MemberDefMutable *md)
Definition doxygen.cpp:8388
static bool tryAddEnumDocsToGroupMember(const Entry *root, const DString &name)
Definition doxygen.cpp:8430
static void findEnumDocumentation(const Entry *root)
Definition doxygen.cpp:8463

References addEnumDocs(), DString::at(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::children(), DString::empty(), Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findEnumDocumentation(), Doxygen::functionNameLinkedMap, getClass(), MemberDef::getClassDef(), MemberDef::getFileDef(), MemberDef::getNamespaceDef(), MemberDef::isEnumerate(), EntryType::isScope(), DString::left(), Doxygen::memberNameLinkedMap, DString::mid(), Definition::name(), Entry::name, Doxygen::namespaceLinkedMap, DString::npos, Entry::parent(), DString::prepend(), DString::rfind(), Entry::section, Entry::startLine, toMemberDefMutable(), tryAddEnumDocsToGroupMember(), and warn.

Referenced by findEnumDocumentation(), and parseInput().

◆ findEnums()

void findEnums ( const Entry * root)
static

Definition at line 7964 of file doxygen.cpp.

7965{
7966 if (root->section.isEnum())
7967 {
7968 AUTO_TRACE("name={}",root->name);
7969 ClassDefMutable *cd = nullptr;
7970 FileDef *fd = nullptr;
7971 NamespaceDefMutable *nd = nullptr;
7972 MemberNameLinkedMap *mnsd = nullptr;
7973 bool isGlobal = false;
7974 bool isRelated = false;
7975 bool isMemberOf = false;
7976 //printf("Found enum with name '%s' relates=%s\n",qPrint(root->name),qPrint(root->relates));
7977
7978 DString name;
7979 DString scope;
7980
7981 if (size_t i = root->name.rfind("::"); i!=DString::npos) // scope is specified
7982 {
7983 scope=root->name.left(i); // extract scope
7984 if (root->lang==SrcLangExt::CSharp)
7985 {
7986 scope = mangleCSharpGenericName(scope);
7987 }
7988 name=root->name.right(root->name.length()-i-2); // extract name
7989 if ((cd=getClassMutable(scope))==nullptr)
7990 {
7992 }
7993 }
7994 else // no scope, check the scope in which the docs where found
7995 {
7996 if (root->parent()->section.isScope() && !root->parent()->name.empty()) // found enum docs inside a compound
7997 {
7998 scope=root->parent()->name;
7999 if ((cd=getClassMutable(scope))==nullptr) nd=getResolvedNamespaceMutable(scope);
8000 }
8001 name=root->name;
8002 }
8003
8004 if (!root->relates.empty())
8005 { // related member, prefix user specified scope
8006 isRelated=true;
8007 isMemberOf=(root->relatesType==RelatesType::MemberOf);
8008 if (getClass(root->relates)==nullptr && !scope.empty())
8009 scope=mergeScopes(scope,root->relates);
8010 else
8011 scope=root->relates;
8012 if ((cd=getClassMutable(scope))==nullptr) nd=getResolvedNamespaceMutable(scope);
8013 }
8014
8015 if (cd && !name.empty()) // found a enum inside a compound
8016 {
8017 //printf("Enum '%s'::'%s'\n",qPrint(cd->name()),qPrint(name));
8018 fd=nullptr;
8020 isGlobal=false;
8021 }
8022 else if (nd) // found enum inside namespace
8023 {
8025 isGlobal=true;
8026 }
8027 else // found a global enum
8028 {
8029 fd=root->fileDef();
8031 isGlobal=true;
8032 }
8033
8034 if (!name.empty())
8035 {
8036 // new enum type
8037 AUTO_TRACE_ADD("new enum {} at line {} of {}",name,root->bodyLine,root->fileName);
8038 auto md = createMemberDef(
8039 root->fileName,root->startLine,root->startColumn,
8040 DString(),name,DString(),DString(),
8041 root->protection,Specifier::Normal,false,
8042 isMemberOf ? Relationship::Foreign : isRelated ? Relationship::Related : Relationship::Member,
8043 MemberType::Enumeration,
8045 auto mmd = toMemberDefMutable(md.get());
8046 mmd->setTagInfo(root->tagInfo());
8047 mmd->setLanguage(root->lang);
8048 mmd->setId(root->id);
8049 if (!isGlobal) mmd->setMemberClass(cd); else mmd->setFileDef(fd);
8050 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
8051 mmd->setBodyDef(root->fileDef());
8052 mmd->setMemberSpecifiers(root->spec);
8053 mmd->setVhdlSpecifiers(root->vhdlSpec);
8054 mmd->setEnumBaseType(root->args);
8055 //printf("Enum %s definition at line %d of %s: protection=%d scope=%s\n",
8056 // qPrint(root->name),root->bodyLine,qPrint(root->fileName),root->protection,cd?qPrint(cd->name()):"<none>");
8057 mmd->addSectionsToDefinition(root->anchors);
8058 mmd->setMemberGroupId(root->mGrpId);
8060 mmd->addQualifiers(root->qualifiers);
8061 //printf("%s::setRefItems(%zu)\n",qPrint(md->name()),root->sli.size());
8062 mmd->setRefItems(root->sli);
8063 mmd->setRequirementReferences(root->rqli);
8064 //printf("found enum %s nd=%p\n",qPrint(md->name()),nd);
8065 bool defSet=false;
8066 addIncludeFile(mmd,root->fileDef(),root);
8067
8068 DString baseType = root->args;
8069 if (!baseType.empty())
8070 {
8071 baseType.prepend(" : ");
8072 }
8073
8074 if (nd)
8075 {
8076 if (isRelated || Config_getBool(HIDE_SCOPE_NAMES) || root->lang==SrcLangExt::Python)
8077 {
8078 mmd->setDefinition(name+baseType);
8079 }
8080 else
8081 {
8082 mmd->setDefinition(nd->name()+"::"+name+baseType);
8083 }
8084 //printf("definition=%s\n",md->definition());
8085 defSet=true;
8086 mmd->setNamespace(nd);
8087 nd->insertMember(md.get());
8088 }
8089
8090 // even if we have already added the enum to a namespace, we still
8091 // also want to add it to other appropriate places such as file
8092 // or class.
8093 if (isGlobal && (nd==nullptr || !nd->isAnonymous()))
8094 {
8095 if (!defSet) mmd->setDefinition(name+baseType);
8096 if (fd==nullptr && root->parent())
8097 {
8098 fd=root->parent()->fileDef();
8099 }
8100 if (fd)
8101 {
8102 mmd->setFileDef(fd);
8103 fd->insertMember(md.get());
8104 }
8105 }
8106 else if (cd)
8107 {
8108 if (isRelated || Config_getBool(HIDE_SCOPE_NAMES) || root->lang==SrcLangExt::Python)
8109 {
8110 mmd->setDefinition(name+baseType);
8111 }
8112 else
8113 {
8114 mmd->setDefinition(cd->name()+"::"+name+baseType);
8115 }
8116 cd->insertMember(md.get());
8117 cd->insertUsedFile(fd);
8118 }
8119 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
8120 mmd->setDocsForDefinition(!root->proto);
8121 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
8122 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
8123
8124 //printf("Adding member=%s\n",qPrint(md->name()));
8125 addMemberToGroups(root,md.get());
8127
8128 MemberName *mn = mnsd->add(name);
8129 mn->push_back(std::move(md));
8130 }
8131 }
8132 else
8133 {
8134 for (const auto &e : root->children()) findEnums(e.get());
8135 }
8136}
static void findEnums(const Entry *root)
Definition doxygen.cpp:7964

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addMemberToGroups(), ModuleManager::addMemberToModule(), Entry::anchors, applyMemberOverrideOptions(), Entry::args, AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, buildScopeFromQualifiedName(), Entry::children(), Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, Entry::fileDef(), Entry::fileName, findEnums(), Doxygen::functionNameLinkedMap, getClass(), getClassMutable(), getResolvedNamespaceMutable(), Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), FileDef::insertMember(), NamespaceDefMutable::insertMember(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), Definition::isAnonymous(), EntryType::isScope(), Entry::lang, DString::left(), DString::length(), mangleCSharpGenericName(), Doxygen::memberNameLinkedMap, mergeScopes(), Entry::metaData, Entry::mGrpId, Definition::name(), Entry::name, DString::npos, Entry::parent(), DString::prepend(), Entry::protection, Entry::proto, MemberName::push_back(), Entry::qualifiers, Entry::relates, Entry::relatesType, DString::rfind(), DString::right(), Entry::rqli, Entry::section, Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, Entry::tagInfo(), toMemberDefMutable(), toNamespaceDefMutable(), and Entry::vhdlSpec.

Referenced by findEnums(), and parseInput().

◆ findFieldDocumentation()

void findFieldDocumentation ( const Entry * root)
static

Definition at line 7842 of file doxygen.cpp.

7843{
7844 if (!root->fieldDocs.empty())
7845 {
7846 ClassDef *cd = nullptr;
7847 if ((root->section.isCompound() || root->section.isCompoundDoc()) && !root->name.empty())
7848 {
7850 if (root->parent() && root->parent()->section.isScope() &&
7851 !root->parent()->name.empty() && !leftScopeMatch(root->parent()->name,name))
7852 {
7853 name.prepend(root->parent()->name+"::");
7854 }
7855 cd = getClass(name);
7856 }
7857 for (const auto &fieldDoc : root->fieldDocs)
7858 {
7859 DString fieldName = fieldDoc.name;
7860 size_t separator = fieldName.rfind("::");
7861 const ClassDef *fieldClass = cd;
7862 if (root->section.isFieldDoc() && separator==DString::npos)
7863 {
7864 warn_doc_error(fieldDoc.file,fieldDoc.line,"\\field '{}' needs a qualified name outside class, struct or union documentation",fieldDoc.name);
7865 continue;
7866 }
7867 if (separator!=DString::npos)
7868 {
7869 DString scope = fieldName.left(separator);
7870 fieldName = fieldName.mid(separator+2);
7871 const ClassDef *target = nullptr;
7872 if (scope.left(2)=="::")
7873 {
7874 target = getClass(scope.mid(2));
7875 }
7876 else
7877 {
7878 SymbolResolver resolver(root->fileDef());
7879 const Definition *context = cd ? cd->getOuterScope() : Doxygen::globalScope;
7880 if (!cd && root->parent() && root->parent()->section.isScope())
7881 {
7882 const DString &parentName = root->parent()->name;
7883 if (const ClassDef *parentClass = getClass(parentName)) context = parentClass;
7884 else if (const NamespaceDef *parentNamespace = getResolvedNamespace(parentName)) context = parentNamespace;
7885 }
7886 target = resolver.resolveClass(context,scope,true,true);
7887 }
7888 if (root->section.isFieldDoc())
7889 {
7890 fieldClass = target;
7891 }
7892 else if (target!=cd)
7893 {
7894 if (cd)
7895 warn_doc_error(fieldDoc.file,fieldDoc.line,"\\field '{}' does not name an eligible variable of {}",fieldDoc.name,cd->name());
7896 else
7897 warn_doc_error(fieldDoc.file,fieldDoc.line,"\\field is only supported in documentation for a class, struct or union");
7898 continue;
7899 }
7900 }
7901 if (!fieldClass || (fieldClass->compoundType()!=ClassDef::Struct &&
7902 fieldClass->compoundType()!=ClassDef::Union &&
7903 fieldClass->compoundType()!=ClassDef::Class))
7904 {
7905 warn_doc_error(fieldDoc.file,fieldDoc.line,"\\field '{}' does not name an eligible class, struct or union variable",fieldDoc.name);
7906 continue;
7907 }
7908 MemberDefMutable *field = nullptr;
7909 if (MemberName *members = Doxygen::memberNameLinkedMap->find(fieldName))
7910 {
7911 for (const auto &member : *members)
7912 {
7913 if (member->getClassDef()==fieldClass && member->isVariable() &&
7914 (fieldClass->compoundType()==ClassDef::Class || !member->isStatic()))
7915 {
7916 field = toMemberDefMutable(member.get());
7917 break;
7918 }
7919 }
7920 }
7921 if (field)
7922 {
7923 field->setDocumentation(fieldDoc.doc,fieldDoc.file,fieldDoc.line);
7924 }
7925 else
7926 {
7927 warn_doc_error(fieldDoc.file,fieldDoc.line,"\\field '{}' does not name an eligible variable of {}",fieldDoc.name,fieldClass->name());
7928 }
7929 }
7930 }
7931 for (const auto &entry : root->children()) findFieldDocumentation(entry.get());
7932}
std::vector< FieldDocumentation > fieldDocs
documentation from \field commands
Definition entry.h:209
static void findFieldDocumentation(const Entry *root)
Definition doxygen.cpp:7842
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112

References Entry::children(), ClassDef::Class, ClassDef::compoundType(), DString::empty(), Entry::fieldDocs, Entry::fileDef(), findFieldDocumentation(), getClass(), Definition::getOuterScope(), getResolvedNamespace(), Doxygen::globalScope, EntryType::isCompound(), EntryType::isCompoundDoc(), EntryType::isScope(), DString::left(), leftScopeMatch(), Doxygen::memberNameLinkedMap, DString::mid(), Definition::name(), Entry::name, DString::npos, Entry::parent(), SymbolResolver::resolveClass(), DString::rfind(), Entry::section, DefinitionMutable::setDocumentation(), stripTemplateSpecifiersFromScope(), ClassDef::Struct, toMemberDefMutable(), ClassDef::Union, and warn_doc_error.

Referenced by findFieldDocumentation(), and parseInput().

◆ findFriends()

void findFriends ( )
static

Definition at line 4503 of file doxygen.cpp.

4504{
4505 AUTO_TRACE();
4506 for (const auto &fn : *Doxygen::functionNameLinkedMap) // for each global function name
4507 {
4508 MemberName *mn = Doxygen::memberNameLinkedMap->find(fn->memberName());
4509 if (mn)
4510 { // there are members with the same name
4511 // for each function with that name
4512 for (const auto &ifmd : *fn)
4513 {
4514 MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
4515 // for each member with that name
4516 for (const auto &immd : *mn)
4517 {
4518 MemberDefMutable *mmd = toMemberDefMutable(immd.get());
4519 //printf("Checking for matching arguments
4520 // mmd->isRelated()=%d mmd->isFriend()=%d mmd->isFunction()=%d\n",
4521 // mmd->isRelated(),mmd->isFriend(),mmd->isFunction());
4522 if (fmd && mmd &&
4523 (mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) &&
4524 matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), mmd->typeString(), &mmd->argumentList(),
4525 fmd->getOuterScope(), fmd->getFileDef(), fmd->typeString(), &fmd->argumentList(),
4526 true,mmd->getLanguage()
4527 )
4528
4529 ) // if the member is related and the arguments match then the
4530 // function is actually a friend.
4531 {
4532 AUTO_TRACE_ADD("Merging related global and member '{}' isFriend={} isRelated={} isFunction={}",
4533 mmd->name(),mmd->isFriend(),mmd->isRelated(),mmd->isFunction());
4534 const ArgumentList &mmdAl = mmd->argumentList();
4535 const ArgumentList &fmdAl = fmd->argumentList();
4536 mergeArguments(const_cast<ArgumentList&>(fmdAl),const_cast<ArgumentList&>(mmdAl));
4537
4538 // reset argument lists to add missing default parameters
4539 DString mmdAlStr = argListToString(mmdAl);
4540 DString fmdAlStr = argListToString(fmdAl);
4541 mmd->setArgsString(mmdAlStr);
4542 fmd->setArgsString(fmdAlStr);
4543 mmd->moveDeclArgumentList(std::make_unique<ArgumentList>(mmdAl));
4544 fmd->moveDeclArgumentList(std::make_unique<ArgumentList>(fmdAl));
4545 AUTO_TRACE_ADD("friend args='{}' member args='{}'",argListToString(fmd->argumentList()),argListToString(mmd->argumentList()));
4546
4547 if (!fmd->documentation().empty())
4548 {
4549 mmd->setDocumentation(fmd->documentation(),fmd->docFile(),fmd->docLine());
4550 }
4551 else if (!mmd->documentation().empty())
4552 {
4553 fmd->setDocumentation(mmd->documentation(),mmd->docFile(),mmd->docLine());
4554 }
4555 if (mmd->briefDescription().empty() && !fmd->briefDescription().empty())
4556 {
4557 mmd->setBriefDescription(fmd->briefDescription(),fmd->briefFile(),fmd->briefLine());
4558 }
4559 else if (!mmd->briefDescription().empty() && !fmd->briefDescription().empty())
4560 {
4561 fmd->setBriefDescription(mmd->briefDescription(),mmd->briefFile(),mmd->briefLine());
4562 }
4563 if (!fmd->inbodyDocumentation().empty())
4564 {
4566 }
4567 else if (!mmd->inbodyDocumentation().empty())
4568 {
4570 }
4571 //printf("body mmd %d fmd %d\n",mmd->getStartBodyLine(),fmd->getStartBodyLine());
4572 if (mmd->getStartBodyLine()==-1 && fmd->getStartBodyLine()!=-1)
4573 {
4574 mmd->setBodySegment(fmd->getDefLine(),fmd->getStartBodyLine(),fmd->getEndBodyLine());
4575 mmd->setBodyDef(fmd->getBodyDef());
4576 //mmd->setBodyMember(fmd);
4577 }
4578 else if (mmd->getStartBodyLine()!=-1 && fmd->getStartBodyLine()==-1)
4579 {
4580 fmd->setBodySegment(mmd->getDefLine(),mmd->getStartBodyLine(),mmd->getEndBodyLine());
4581 fmd->setBodyDef(mmd->getBodyDef());
4582 //fmd->setBodyMember(mmd);
4583 }
4585
4587
4588 mmd->addQualifiers(fmd->getQualifiers());
4589 fmd->addQualifiers(mmd->getQualifiers());
4590
4591 }
4592 }
4593 }
4594 }
4595 }
4596}
virtual bool isFriend() const =0
virtual bool isRelated() const =0
virtual StringVector getQualifiers() const =0
virtual bool isDocsForDefinition() const =0
void mergeMemberOverrideOptions(MemberDefMutable *md1, MemberDefMutable *md2)

References MemberDefMutable::addQualifiers(), argListToString(), MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), Definition::docFile(), Definition::docLine(), Definition::documentation(), DString::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, Definition::getBodyDef(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getFileDef(), Definition::getLanguage(), Definition::getOuterScope(), MemberDef::getQualifiers(), Definition::getStartBodyLine(), Definition::inbodyDocumentation(), Definition::inbodyFile(), Definition::inbodyLine(), MemberDef::isDocsForDefinition(), MemberDef::isFriend(), MemberDef::isFunction(), MemberDef::isRelated(), matchArguments2(), Doxygen::memberNameLinkedMap, mergeArguments(), mergeMemberOverrideOptions(), MemberDefMutable::moveDeclArgumentList(), Definition::name(), MemberDefMutable::setArgsString(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), toMemberDefMutable(), and MemberDef::typeString().

Referenced by parseInput().

◆ findFunctionPtr()

int findFunctionPtr ( const std::string & type,
SrcLangExt lang,
int * pLength = nullptr )
static

See if the return type string type is that of a function pointer

Returns
-1 if this is not a function pointer variable or the index at which the closing brace of (...*name) was found.

Definition at line 3174 of file doxygen.cpp.

3175{
3176 AUTO_TRACE("type='{}' lang={}",type,lang);
3177 if (lang == SrcLangExt::Fortran || lang == SrcLangExt::VHDL)
3178 {
3179 return -1; // Fortran and VHDL do not have function pointers
3180 }
3181
3182 static const reg::Ex re(R"(\‍([^)]*[*&^][^)]*\))");
3184 size_t i=std::string::npos;
3185 size_t l=0;
3186 if (reg::search(type,match,re)) // contains (...*...) or (...&...) or (...^...)
3187 {
3188 i = match.position();
3189 l = match.length();
3190 }
3191 if (i!=std::string::npos)
3192 {
3193 size_t di = type.find("decltype(");
3194 if (di!=std::string::npos && di<i)
3195 {
3196 i = std::string::npos;
3197 }
3198 }
3199 size_t bb=type.find('<');
3200 size_t be=type.rfind('>');
3201 bool templFp = false;
3202 if (be!=std::string::npos) {
3203 size_t cc_ast = type.find("::*");
3204 size_t cc_amp = type.find("::&");
3205 templFp = (cc_ast != std::string::npos && cc_ast>be) || (cc_amp != std::string::npos && cc_amp>be); // hack to find, e.g 'B<X>(A<int>::*)'
3206 }
3207
3208 if (!type.empty() && // return type is non-empty
3209 i!=std::string::npos && // contains (...*...)
3210 type.find("operator")==std::string::npos && // not an operator
3211 (type.find(")(")==std::string::npos || type.find("typedef ")!=std::string::npos) &&
3212 // not a function pointer return type
3213 (!((bb!=std::string::npos && bb<i) && (be!=std::string::npos && i<be)) || templFp) // bug665855: avoid treating "typedef A<void (T*)> type" as a function pointer
3214 )
3215 {
3216 if (pLength) *pLength=static_cast<int>(l);
3217 //printf("findFunctionPtr=%d\n",(int)i);
3218 AUTO_TRACE_EXIT("result={}",i);
3219 return static_cast<int>(i);
3220 }
3221 else
3222 {
3223 //printf("findFunctionPtr=%d\n",-1);
3224 AUTO_TRACE_EXIT("result=-1");
3225 return -1;
3226 }
3227}
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:55

References AUTO_TRACE, AUTO_TRACE_EXIT, and reg::search().

Referenced by addVariable(), buildVarList(), and filterMemberDocumentation().

◆ findGlobalMember()

bool findGlobalMember ( const Entry * root,
const DString & namespaceName,
const DString & type,
const DString & name,
const DString & tempArg,
const DString & ,
const DString & decl,
TypeSpecifier  )
static

Definition at line 6035 of file doxygen.cpp.

6043{
6044 AUTO_TRACE("namespace='{}' type='{}' name='{}' tempArg='{}' decl='{}'",namespaceName,type,name,tempArg,decl);
6045 DString n=name;
6046 if (n.empty()) return false;
6047 if (n.find("::")!=DString::npos) return false; // skip undefined class members
6048 MemberName *mn=Doxygen::functionNameLinkedMap->find(n+tempArg); // look in function dictionary
6049 if (mn==nullptr)
6050 {
6051 mn=Doxygen::functionNameLinkedMap->find(n); // try without template arguments
6052 }
6053 if (mn) // function name defined
6054 {
6055 AUTO_TRACE_ADD("Found symbol name");
6056 //int count=0;
6057 bool found=false;
6058 for (const auto &md : *mn)
6059 {
6060 // If the entry has groups, then restrict the search to members which are
6061 // in one of the groups of the entry. If md is not associated with a group yet,
6062 // allow this documentation entry to add the group info.
6063 if (!root->groups.empty() && !isEntryInGroupOfMember(root, md.get(), true))
6064 {
6065 continue;
6066 }
6067
6068 const NamespaceDef *nd=nullptr;
6069 if (md->isAlias() && md->getOuterScope() &&
6070 md->getOuterScope()->definitionType()==Definition::TypeNamespace)
6071 {
6072 nd = toNamespaceDef(md->getOuterScope());
6073 }
6074 else
6075 {
6076 nd = md->getNamespaceDef();
6077 }
6078
6079 // special case for strong enums
6080 size_t enumNamePos=0;
6081 if (nd && md->isEnumValue() && (enumNamePos=namespaceName.rfind("::"))!=DString::npos)
6082 { // md part of a strong enum in a namespace?
6083 DString enumName = namespaceName.mid(enumNamePos+2);
6084 if (namespaceName.left(enumNamePos)==nd->name())
6085 {
6087 if (enumMn)
6088 {
6089 for (const auto &emd : *enumMn)
6090 {
6091 found = emd->isStrong() && md->getEnumScope()==emd.get();
6092 if (found)
6093 {
6094 addMemberDocs(root,toMemberDefMutable(md->resolveAlias()),decl,nullptr,false,root->spec);
6095 break;
6096 }
6097 }
6098 }
6099 }
6100 if (found)
6101 {
6102 break;
6103 }
6104 }
6105 else if (nd==nullptr && md->isEnumValue()) // md part of global strong enum?
6106 {
6107 MemberName *enumMn=Doxygen::functionNameLinkedMap->find(namespaceName);
6108 if (enumMn)
6109 {
6110 for (const auto &emd : *enumMn)
6111 {
6112 found = emd->isStrong() && md->getEnumScope()==emd.get();
6113 if (found)
6114 {
6115 addMemberDocs(root,toMemberDefMutable(md->resolveAlias()),decl,nullptr,false,root->spec);
6116 break;
6117 }
6118 }
6119 }
6120 }
6121
6122 const FileDef *fd=root->fileDef();
6123 //printf("File %s\n",fd ? qPrint(fd->name()) : "<none>");
6125 if (fd)
6126 {
6127 nl = fd->getUsedNamespaces();
6128 }
6129 //printf("NamespaceList %p\n",nl);
6130
6131 // search in the list of namespaces that are imported via a
6132 // using declaration
6133 bool viaUsingDirective = nd && nl.find(nd->qualifiedName())!=nullptr;
6134
6135 if ((namespaceName.empty() && nd==nullptr) || // not in a namespace
6136 (nd && nd->name()==namespaceName) || // or in the same namespace
6137 viaUsingDirective // member in 'using' namespace
6138 )
6139 {
6140 AUTO_TRACE_ADD("Try to add member '{}' to scope '{}'",md->name(),namespaceName);
6141
6142 NamespaceDef *rnd = nullptr;
6143 if (!namespaceName.empty()) rnd = Doxygen::namespaceLinkedMap->find(namespaceName);
6144
6145 const ArgumentList &mdAl = md.get()->argumentList();
6146 bool matching=
6147 (mdAl.empty() && root->argList.empty()) ||
6148 md->isVariable() || md->isTypedef() || /* in case of function pointers */
6149 matchArguments2(md->getOuterScope(),md->getFileDef(),md->typeString(),&mdAl,
6150 rnd ? rnd : Doxygen::globalScope,fd,root->type,&root->argList,
6151 false,root->lang);
6152
6153 // for template members we need to check if the number of
6154 // template arguments is the same, otherwise we are dealing with
6155 // different functions.
6156 if (matching && !root->tArgLists.empty())
6157 {
6158 const ArgumentList &mdTempl = md->templateArguments();
6159 if (root->tArgLists.back().size()!=mdTempl.size())
6160 {
6161 matching=false;
6162 }
6163 }
6164
6165 //printf("%s<->%s\n",
6166 // qPrint(argListToString(md->argumentList())),
6167 // qPrint(argListToString(root->argList)));
6168
6169 // For static members we also check if the comment block was found in
6170 // the same file. This is needed because static members with the same
6171 // name can be in different files. Thus it would be wrong to just
6172 // put the comment block at the first syntactically matching member. If
6173 // the comment block belongs to a group of the static member, then add
6174 // the documentation even if it is in a different file.
6175 if (matching && md->isStatic() &&
6176 md->getDefFileName()!=root->fileName &&
6177 mn->size()>1 &&
6178 !isEntryInGroupOfMember(root,md.get()))
6179 {
6180 matching = false;
6181 }
6182
6183 // for template member we also need to check the return type and requires
6184 if (!md->templateArguments().empty() && !root->tArgLists.empty())
6185 {
6186 //printf("Comparing return types '%s'<->'%s'\n",
6187 // md->typeString(),type);
6188 //printf("%s: Comparing '%s'<=>'%s'\n",qPrint(md->name()),qPrint(md->requiresClause()),qPrint(root->req));
6189 if (md->templateArguments().size()!=root->tArgLists.back().size() ||
6190 md->typeString()!=type ||
6191 md->requiresClause()!=root->req)
6192 {
6193 //printf(" ---> no matching\n");
6194 matching = false;
6195 }
6196 }
6197
6198 if (matching) // add docs to the member
6199 {
6200 AUTO_TRACE_ADD("Match found");
6201 addMemberDocs(root,toMemberDefMutable(md->resolveAlias()),decl,&root->argList,false,root->spec);
6202 found=true;
6203 break;
6204 }
6205 }
6206 }
6207 if (!found && root->relatesType!=RelatesType::Duplicate && root->section.isFunction()) // no match
6208 {
6209 DString fullFuncDecl=decl;
6210 if (!root->argList.empty()) fullFuncDecl+=argListToString(root->argList,true);
6211 DString warnMsg = "no matching file member found for \n"+fullFuncDecl;
6212 if (mn->size()>0)
6213 {
6214 warnMsg+="\nPossible candidates:";
6215 for (const auto &md : *mn)
6216 {
6217 warnMsg+="\n '";
6218 warnMsg+=replaceAnonymousScopes(md->declaration());
6219 warnMsg+="' " + warn_line(md->getDefFileName(),md->getDefLine());
6220 }
6221 }
6222 warn(root->fileName,root->startLine, "{}", qPrint(warnMsg));
6223 }
6224 }
6225 else // got docs for an undefined member!
6226 {
6227 if (root->type!="friend class" &&
6228 root->type!="friend struct" &&
6229 root->type!="friend union" &&
6230 root->type!="friend" &&
6231 (!Config_getBool(TYPEDEF_HIDES_STRUCT) ||
6232 root->type.find("typedef ")==DString::npos)
6233 )
6234 {
6235 warn(root->fileName,root->startLine,
6236 "documented symbol '{}' was not declared or defined.",qPrint(decl)
6237 );
6238 }
6239 }
6240 return true;
6241}
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:154
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
Container class representing a vector of objects with keys.
Definition linkedmap.h:232
const T * find(const std::string &key) const
Definition linkedmap.h:243

References addMemberDocs(), Entry::argList, argListToString(), AUTO_TRACE, AUTO_TRACE_ADD, Config_getBool, ArgumentList::empty(), DString::empty(), Entry::fileDef(), Entry::fileName, DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), LinkedRefMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, FileDef::getUsedNamespaces(), Doxygen::globalScope, Entry::groups, isEntryInGroupOfMember(), Entry::lang, DString::left(), matchArguments2(), DString::mid(), Definition::name(), Doxygen::namespaceLinkedMap, DString::npos, qPrint(), Definition::qualifiedName(), Entry::relatesType, replaceAnonymousScopes(), Entry::req, DString::rfind(), Entry::section, ArgumentList::size(), DString::size(), Entry::spec, Entry::startLine, Entry::tArgLists, toMemberDefMutable(), toNamespaceDef(), Entry::type, Definition::TypeNamespace, warn, and warn_line().

Referenced by findMember().

◆ findGroupScope()

void findGroupScope ( const Entry * root)
static

Definition at line 555 of file doxygen.cpp.

556{
557 if (root->section.isGroupDoc() && !root->name.empty() &&
558 root->parent() && !root->parent()->name.empty())
559 {
561 if (gd)
562 {
563 DString scope = root->parent()->name;
564 if (root->parent()->section.isPackageDoc())
565 {
566 scope=substitute(scope,".","::");
567 }
568 scope = stripAnonymousNamespaceScope(scope);
569 scope+="::"+gd->name();
571 if (d)
572 {
573 gd->setGroupScope(d);
574 }
575 }
576 }
577 for (const auto &e : root->children()) findGroupScope(e.get());
578}
virtual void setGroupScope(Definition *d)=0
static void findGroupScope(const Entry *root)
Definition doxygen.cpp:555

References Entry::children(), DString::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), findGroupScope(), findScopeFromQualifiedName(), Doxygen::globalScope, Doxygen::groupLinkedMap, Definition::name(), Entry::name, Entry::parent(), Entry::section, GroupDef::setGroupScope(), stripAnonymousNamespaceScope(), substitute(), and Entry::tagInfo().

Referenced by findGroupScope(), and parseInput().

◆ findIncludedUsingDirectives()

void findIncludedUsingDirectives ( )
static

Definition at line 2733 of file doxygen.cpp.

2734{
2735 FileDefSet visitedFiles;
2736 // then recursively add using directives found in #include files
2737 // to files that have not been visited.
2738 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2739 {
2740 for (const auto &fd : *fn)
2741 {
2742 //printf("----- adding using directives for file %s\n",qPrint(fd->name()));
2743 fd->addIncludedUsingDirectives(visitedFiles);
2744 }
2745 }
2746}
std::unordered_set< const FileDef * > FileDefSet
Definition filedef.h:41

References Doxygen::inputNameLinkedMap.

Referenced by parseInput().

◆ findInheritedTemplateInstances()

void findInheritedTemplateInstances ( )
static

Using the dictionary build by findClassEntries(), this function will look for additional template specialization that exists as inheritance relations only. These instances will be added to the template they are derived from.

Definition at line 5557 of file doxygen.cpp.

5558{
5559 AUTO_TRACE();
5560 ClassDefSet visitedClasses;
5561 for (const auto &[name,root] : g_classEntries)
5562 {
5563 DString bName = extractClassName(root);
5564 ClassDefMutable *cdm = getClassMutable(bName);
5565 if (cdm)
5566 {
5567 findBaseClassesForClass(root,cdm,cdm,cdm,TemplateInstances,false);
5568 }
5569 }
5570}

References AUTO_TRACE, extractClassName(), findBaseClassesForClass(), g_classEntries, getClassMutable(), and TemplateInstances.

Referenced by parseInput().

◆ findMainPage()

void findMainPage ( Entry * root)
static

Definition at line 10176 of file doxygen.cpp.

10177{
10178 if (root->section.isMainpageDoc())
10179 {
10180 if (Doxygen::mainPage==nullptr && root->tagInfo()==nullptr)
10181 {
10182 //printf("mainpage: docLine=%d startLine=%d\n",root->docLine,root->startLine);
10183 //printf("Found main page! \n======\n%s\n=======\n",qPrint(root->doc));
10184 DString title=root->args.stripWhiteSpace();
10185 if (title.empty()) title = Config_getString(PROJECT_NAME);
10186 //DString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index";
10187 DString indexName="index";
10189 indexName, root->brief+root->doc+root->inbodyDocs,title);
10190 //setFileNameForSections(root->anchors,"index",Doxygen::mainPage);
10191 Doxygen::mainPage->setBriefDescription(root->brief,root->briefFile,root->briefLine);
10192 Doxygen::mainPage->setBodySegment(root->startLine,root->startLine,-1);
10193 Doxygen::mainPage->setFileName(indexName);
10194 Doxygen::mainPage->setLocalToc(root->localToc);
10196
10198 if (si)
10199 {
10200 if (!si->ref().empty()) // we are from a tag file
10201 {
10202 // a page name is a label as well! but should no be double either
10205 indexName,
10206 root->startLine,
10207 Doxygen::mainPage->title(),
10209 0); // level 0
10210 }
10211 else if (si->lineNr() != -1)
10212 {
10213 warn(root->fileName,root->startLine,"multiple use of section label '{}' for main page, (first occurrence: {}, line {})",
10214 Doxygen::mainPage->name(),si->fileName(),si->lineNr());
10215 }
10216 else
10217 {
10218 warn(root->fileName,root->startLine,"multiple use of section label '{}' for main page, (first occurrence: {})",
10219 Doxygen::mainPage->name(),si->fileName());
10220 }
10221 }
10222 else
10223 {
10224 // a page name is a label as well! but should no be double either
10227 indexName,
10228 root->startLine,
10229 Doxygen::mainPage->title(),
10231 0); // level 0
10232 }
10233 Doxygen::mainPage->addSectionsToDefinition(root->anchors);
10234 }
10235 else if (root->tagInfo()==nullptr)
10236 {
10237 warn(root->fileName,root->startLine,
10238 "found more than one \\mainpage comment block! (first occurrence: {}, line {}), Skipping current block!",
10239 Doxygen::mainPage->docFile(),Doxygen::mainPage->getStartBodyLine());
10240 }
10241 }
10242 for (const auto &e : root->children()) findMainPage(e.get());
10243}
class that provide information about a section.
Definition section.h:58
DString fileName() const
Definition section.h:74
int lineNr() const
Definition section.h:73
DString ref() const
Definition section.h:72
SectionInfo * replace(const DString &label, const DString &fileName, int lineNr, const DString &title, SectionType type, int level, const DString &ref=DString())
Definition section.h:157
SectionInfo * add(const SectionInfo &si)
Definition section.h:139
static constexpr int Page
Definition section.h:31
static void findMainPage(Entry *root)

References SectionManager::add(), addPageToContext(), Entry::anchors, Entry::args, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::children(), Config_getString, createPageDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::fileName, SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), findMainPage(), Entry::inbodyDocs, SectionManager::instance(), SectionInfo::lineNr(), Entry::localToc, Doxygen::mainPage, SectionType::Page, SectionInfo::ref(), SectionManager::replace(), Entry::section, Entry::startLine, DString::stripWhiteSpace(), Entry::tagInfo(), and warn.

Referenced by findMainPage(), and parseInput().

◆ findMainPageTagFiles()

void findMainPageTagFiles ( Entry * root)
static

Definition at line 10246 of file doxygen.cpp.

10247{
10248 if (root->section.isMainpageDoc())
10249 {
10250 if (Doxygen::mainPage && root->tagInfo())
10251 {
10252 Doxygen::mainPage->addSectionsToDefinition(root->anchors);
10253 }
10254 }
10255 for (const auto &e : root->children()) findMainPageTagFiles(e.get());
10256}
static void findMainPageTagFiles(Entry *root)

References Entry::anchors, Entry::children(), findMainPageTagFiles(), Doxygen::mainPage, Entry::section, and Entry::tagInfo().

Referenced by findMainPageTagFiles(), and parseInput().

◆ findMember()

void findMember ( const Entry * root,
const DString & relates,
const DString & type,
const DString & args,
DString funcDecl,
bool overloaded,
bool isFunc )
static

This function tries to find a member (in a documented class/file/namespace) that corresponds to the function/variable declaration given in funcDecl.

The boolean overloaded is used to specify whether or not a standard overload documentation line should be generated.

The boolean isFunc is a hint that indicates that this is a function instead of a variable or typedef.

Definition at line 7031 of file doxygen.cpp.

7039{
7040 AUTO_TRACE("root='{}' funcDecl='{}' related='{}' overload={} isFunc={} mGrpId={} #tArgList={} spec={} lang={}",
7041 root->name, funcDecl, relates, overloaded, isFunc, root->mGrpId, root->tArgLists.size(),
7042 root->spec, root->lang);
7043
7044 DString scopeName;
7045 DString className;
7046 DString namespaceName;
7047 DString funcType;
7048 DString funcName;
7049 DString funcArgs;
7050 DString funcTempList;
7051 DString exceptions;
7052 DString funcSpec;
7053 bool isRelated=false;
7054 bool isMemberOf=false;
7055 bool isFriend=false;
7056 bool done=false;
7057 TypeSpecifier spec = root->spec;
7058 while (!done)
7059 {
7060 done=true;
7061 if (funcDecl.stripPrefix("friend ")) // treat friends as related members
7062 {
7063 isFriend=true;
7064 done=false;
7065 }
7066 if (funcDecl.stripPrefix("inline "))
7067 {
7068 spec.setInline(true);
7069 done=false;
7070 }
7071 if (funcDecl.stripPrefix("explicit "))
7072 {
7073 spec.setExplicit(true);
7074 done=false;
7075 }
7076 if (funcDecl.stripPrefix("mutable "))
7077 {
7078 spec.setMutable(true);
7079 done=false;
7080 }
7081 if (funcDecl.stripPrefix("thread_local "))
7082 {
7083 spec.setThreadLocal(true);
7084 done=false;
7085 }
7086 if (funcDecl.stripPrefix("virtual "))
7087 {
7088 done=false;
7089 }
7090 }
7091
7092 // delete any ; from the function declaration
7093 size_t sep=0;
7094 while ((sep=funcDecl.find(';'))!=DString::npos)
7095 {
7096 funcDecl=(funcDecl.left(sep)+funcDecl.mid(sep+1)).stripWhiteSpace();
7097 }
7098
7099 // make sure the first character is a space to simplify searching.
7100 if (!funcDecl.empty() && funcDecl[0]!=' ') funcDecl.prepend(" ");
7101
7102 // remove some superfluous spaces
7103 funcDecl= substitute(
7104 substitute(
7105 substitute(funcDecl,"~ ","~"),
7106 ":: ","::"
7107 ),
7108 " ::","::"
7109 ).stripWhiteSpace();
7110
7111 //printf("funcDecl='%s'\n",qPrint(funcDecl));
7112 if (isFriend && funcDecl.startsWith("class "))
7113 {
7114 //printf("friend class\n");
7115 funcDecl=funcDecl.mid(6);
7116 funcName = funcDecl;
7117 }
7118 else if (isFriend && funcDecl.startsWith("struct "))
7119 {
7120 funcDecl=funcDecl.mid(7);
7121 funcName = funcDecl;
7122 }
7123 else if (isFriend && funcDecl.startsWith("record "))
7124 {
7125 funcDecl=funcDecl.mid(7);
7126 funcName = funcDecl;
7127 }
7128 else
7129 {
7130 // extract information from the declarations
7131 parseFuncDecl(funcDecl,root->lang,scopeName,funcType,funcName,
7132 funcArgs,funcTempList,exceptions
7133 );
7134 }
7135
7136 // the class name can also be a namespace name, we decide this later.
7137 // if a related class name is specified and the class name could
7138 // not be derived from the function declaration, then use the
7139 // related field.
7140 AUTO_TRACE_ADD("scopeName='{}' className='{}' namespaceName='{}' funcType='{}' funcName='{}' funcArgs='{}'",
7141 scopeName,className,namespaceName,funcType,funcName,funcArgs);
7142 if (!relates.empty())
7143 { // related member, prefix user specified scope
7144 isRelated=true;
7145 isMemberOf=(root->relatesType == RelatesType::MemberOf);
7146 if (getClass(relates)==nullptr && !scopeName.empty())
7147 {
7148 scopeName= mergeScopes(scopeName,relates);
7149 }
7150 else
7151 {
7152 scopeName = relates;
7153 }
7154 }
7155
7156 if (relates.empty() && root->parent() &&
7157 (root->parent()->section.isScope() || root->parent()->section.isObjcImpl()) &&
7158 !root->parent()->name.empty()) // see if we can combine scopeName
7159 // with the scope in which it was found
7160 {
7161 DString joinedName = root->parent()->name+"::"+scopeName;
7162 if (!scopeName.empty() &&
7163 (getClass(joinedName) || Doxygen::namespaceLinkedMap->find(joinedName)))
7164 {
7165 scopeName = joinedName;
7166 }
7167 else
7168 {
7169 scopeName = mergeScopes(root->parent()->name,scopeName);
7170 }
7171 }
7172 else // see if we can prefix a namespace or class that is used from the file
7173 {
7174 FileDef *fd=root->fileDef();
7175 if (fd)
7176 {
7177 for (const auto &fnd : fd->getUsedNamespaces())
7178 {
7179 DString joinedName = fnd->name()+"::"+scopeName;
7180 if (Doxygen::namespaceLinkedMap->find(joinedName))
7181 {
7182 scopeName=joinedName;
7183 break;
7184 }
7185 }
7186 }
7187 }
7189 removeRedundantWhiteSpace(scopeName),false,&funcSpec,DString(),false);
7190
7191 // funcSpec contains the last template specifiers of the given scope.
7192 // If this method does not have any template arguments or they are
7193 // empty while funcSpec is not empty we assume this is a
7194 // specialization of a method. If not, we clear the funcSpec and treat
7195 // this as a normal method of a template class.
7196 if (!(root->tArgLists.size()>0 &&
7197 root->tArgLists.front().size()==0
7198 )
7199 )
7200 {
7201 funcSpec.clear();
7202 }
7203
7204 //namespaceName=removeAnonymousScopes(namespaceName);
7205 if (!Config_getBool(EXTRACT_ANON_NSPACES) && scopeName.find('@')!=DString::npos) return; // skip stuff in anonymous namespace...
7206
7207 // split scope into a namespace and a class part
7208 extractNamespaceName(scopeName,className,namespaceName,true);
7209 AUTO_TRACE_ADD("scopeName='{}' className='{}' namespaceName='{}'",scopeName,className,namespaceName);
7210
7211 //printf("namespaceName='%s' className='%s'\n",qPrint(namespaceName),qPrint(className));
7212 // merge class and namespace scopes again
7213 scopeName.clear();
7214 if (!namespaceName.empty())
7215 {
7216 if (className.empty())
7217 {
7218 scopeName=namespaceName;
7219 }
7220 else if (!relates.empty() || // relates command with explicit scope
7221 !getClass(className)) // class name only exists in a namespace
7222 {
7223 scopeName=namespaceName+"::"+className;
7224 }
7225 else
7226 {
7227 scopeName=className;
7228 }
7229 }
7230 else if (!className.empty())
7231 {
7232 scopeName=className;
7233 }
7234 //printf("new scope='%s'\n",qPrint(scopeName));
7235
7236 DString tempScopeName=scopeName;
7237 ClassDefMutable *cd=getClassMutable(scopeName);
7238 if (cd)
7239 {
7240 if (funcSpec.empty())
7241 {
7242 uint32_t argListIndex=0;
7243 tempScopeName=cd->qualifiedNameWithTemplateParameters(&root->tArgLists,&argListIndex);
7244 }
7245 else
7246 {
7247 tempScopeName=scopeName+funcSpec;
7248 }
7249 }
7250 //printf("scopeName=%s cd=%p root->tArgLists=%p result=%s\n",
7251 // qPrint(scopeName),cd,root->tArgLists,qPrint(tempScopeName));
7252
7253 //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className));
7254 // rebuild the function declaration (needed to get the scope right).
7255 if (!scopeName.empty() && !isRelated && !isFriend && !Config_getBool(HIDE_SCOPE_NAMES) && root->lang!=SrcLangExt::Python)
7256 {
7257 if (!funcType.empty())
7258 {
7259 if (isFunc) // a function -> we use argList for the arguments
7260 {
7261 funcDecl=funcType+" "+tempScopeName+"::"+funcName+funcTempList;
7262 }
7263 else
7264 {
7265 funcDecl=funcType+" "+tempScopeName+"::"+funcName+funcArgs;
7266 }
7267 }
7268 else
7269 {
7270 if (isFunc) // a function => we use argList for the arguments
7271 {
7272 funcDecl=tempScopeName+"::"+funcName+funcTempList;
7273 }
7274 else // variable => add 'argument' list
7275 {
7276 funcDecl=tempScopeName+"::"+funcName+funcArgs;
7277 }
7278 }
7279 }
7280 else // build declaration without scope
7281 {
7282 if (!funcType.empty()) // but with a type
7283 {
7284 if (isFunc) // function => omit argument list
7285 {
7286 funcDecl=funcType+" "+funcName+funcTempList;
7287 }
7288 else // variable => add 'argument' list
7289 {
7290 funcDecl=funcType+" "+funcName+funcArgs;
7291 }
7292 }
7293 else // no type
7294 {
7295 if (isFunc)
7296 {
7297 funcDecl=funcName+funcTempList;
7298 }
7299 else
7300 {
7301 funcDecl=funcName+funcArgs;
7302 }
7303 }
7304 }
7305
7306 if (funcType=="template class" && !funcTempList.empty())
7307 return; // ignore explicit template instantiations
7308
7309 AUTO_TRACE_ADD("Parse results: namespaceName='{}' className=`{}` funcType='{}' funcSpec='{}' "
7310 " funcName='{}' funcArgs='{}' funcTempList='{}' funcDecl='{}' relates='{}'"
7311 " exceptions='{}' isRelated={} isMemberOf={} isFriend={} isFunc={}",
7312 namespaceName, className, funcType, funcSpec,
7313 funcName, funcArgs, funcTempList, funcDecl, relates,
7314 exceptions, isRelated, isMemberOf, isFriend, isFunc);
7315
7316 if (!funcName.empty()) // function name is valid
7317 {
7318 // check if 'className' is actually a scoped enum, in which case we need to
7319 // process it as a global, see issue #6471
7320 bool strongEnum = false;
7321 MemberName *mn=nullptr;
7322 if (!className.empty() && (mn=Doxygen::functionNameLinkedMap->find(className)))
7323 {
7324 for (const auto &imd : *mn)
7325 {
7326 MemberDefMutable *md = toMemberDefMutable(imd.get());
7327 Definition *mdScope = nullptr;
7328 if (md && md->isEnumerate() && md->isStrong() && (mdScope=md->getOuterScope()) &&
7329 // need filter for the correct scope, see issue #9668
7330 ((namespaceName.empty() && mdScope==Doxygen::globalScope) || (mdScope->name()==namespaceName)))
7331 {
7332 AUTO_TRACE_ADD("'{}' is a strong enum! (namespace={} md->getOuterScope()->name()={})",md->name(),namespaceName,md->getOuterScope()->name());
7333 strongEnum = true;
7334 // pass the scope name name as a 'namespace' to the findGlobalMember function
7335 if (!namespaceName.empty())
7336 {
7337 namespaceName+="::"+className;
7338 }
7339 else
7340 {
7341 namespaceName=className;
7342 }
7343 }
7344 }
7345 }
7346
7347 if (funcName.startsWith("operator ")) // strip class scope from cast operator
7348 {
7349 funcName = substitute(funcName,className+"::","");
7350 }
7351 mn = nullptr;
7352 if (!funcTempList.empty()) // try with member specialization
7353 {
7354 mn=Doxygen::memberNameLinkedMap->find(funcName+funcTempList);
7355 }
7356 if (mn==nullptr) // try without specialization
7357 {
7358 mn=Doxygen::memberNameLinkedMap->find(funcName);
7359 }
7360 if (!isRelated && !strongEnum && mn) // function name already found
7361 {
7362 AUTO_TRACE_ADD("member name exists ({} members with this name)",mn->size());
7363 if (!className.empty()) // class name is valid
7364 {
7365 if (funcSpec.empty()) // not a member specialization
7366 {
7367 addMemberFunction(root,mn,scopeName,namespaceName,className,funcType,funcName,
7368 funcArgs,funcTempList,exceptions,
7369 type,args,isFriend,spec,relates,funcDecl,overloaded,isFunc);
7370 }
7371 else if (cd) // member specialization
7372 {
7373 addMemberSpecialization(root,mn,cd,funcType,funcName,funcArgs,funcDecl,exceptions,spec);
7374 }
7375 else
7376 {
7377 //printf("*** Specialized member %s of unknown scope %s%s found!\n",
7378 // qPrint(scopeName),qPrint(funcName),qPrint(funcArgs));
7379 }
7380 }
7381 else if (overloaded) // check if the function belongs to only one class
7382 {
7383 addOverloaded(root,mn,funcType,funcName,funcArgs,funcDecl,exceptions,spec);
7384 }
7385 else // unrelated function with the same name as a member
7386 {
7387 if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec))
7388 {
7389 DString fullFuncDecl=funcDecl;
7390 if (isFunc) fullFuncDecl+=argListToString(root->argList,true);
7391 warn(root->fileName,root->startLine,
7392 "Cannot determine class for function\n{}",
7393 fullFuncDecl
7394 );
7395 }
7396 }
7397 }
7398 else if (isRelated && !relates.empty())
7399 {
7400 AUTO_TRACE_ADD("related function scopeName='{}' className='{}'",scopeName,className);
7401 if (className.empty()) className=relates;
7402 //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className));
7403 if ((cd=getClassMutable(scopeName)))
7404 {
7405 bool newMember=true; // assume we have a new member
7406 MemberDefMutable *mdDefine=nullptr;
7407 {
7408 mn = Doxygen::functionNameLinkedMap->find(funcName);
7409 if (mn)
7410 {
7411 for (const auto &imd : *mn)
7412 {
7413 MemberDefMutable *md = toMemberDefMutable(imd.get());
7414 if (md && md->isDefine())
7415 {
7416 mdDefine = md;
7417 break;
7418 }
7419 }
7420 }
7421 }
7422
7423 if (mdDefine) // macro definition is already created by the preprocessor and inserted as a file member
7424 {
7425 //printf("moving #define %s into class %s\n",qPrint(mdDefine->name()),qPrint(cd->name()));
7426
7427 // take mdDefine from the Doxygen::functionNameLinkedMap (without deleting the data)
7428 auto mdDefineTaken = Doxygen::functionNameLinkedMap->take(funcName,mdDefine);
7429 // insert it as a class member
7430 if ((mn=Doxygen::memberNameLinkedMap->find(funcName))==nullptr)
7431 {
7432 mn=Doxygen::memberNameLinkedMap->add(funcName);
7433 }
7434
7435 if (mdDefine->getFileDef())
7436 {
7437 mdDefine->getFileDef()->removeMember(mdDefine);
7438 }
7439 mdDefine->makeRelated();
7440 mdDefine->setMemberClass(cd);
7441 mdDefine->moveTo(cd);
7442 cd->insertMember(mdDefine);
7443 // also insert the member as an alias in the parent's scope, so it can be referenced also without cd's scope
7444 insertMemberAlias(cd->getOuterScope(),mdDefine);
7445 mn->push_back(std::move(mdDefineTaken));
7446 }
7447 else // normal member, needs to be created and added to the class
7448 {
7449 FileDef *fd=root->fileDef();
7450
7451 if ((mn=Doxygen::memberNameLinkedMap->find(funcName))==nullptr)
7452 {
7453 mn=Doxygen::memberNameLinkedMap->add(funcName);
7454 }
7455 else
7456 {
7457 // see if we got another member with matching arguments
7458 MemberDefMutable *rmd_found = nullptr;
7459 for (const auto &irmd : *mn)
7460 {
7461 MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
7462 if (rmd)
7463 {
7464 const ArgumentList &rmdAl = rmd->argumentList();
7465
7466 newMember=
7467 className!=rmd->getOuterScope()->name() ||
7468 !matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmd->typeString(),&rmdAl,
7469 cd,fd,root->type,&root->argList,
7470 true,root->lang);
7471 if (!newMember)
7472 {
7473 rmd_found = rmd;
7474 }
7475 }
7476 }
7477 if (rmd_found) // member already exists as rmd -> add docs
7478 {
7479 AUTO_TRACE_ADD("addMemberDocs for related member {}",root->name);
7480 addMemberDocs(root,rmd_found,funcDecl,nullptr,overloaded,spec);
7481 newMember=false;
7482 }
7483 }
7484
7485 if (newMember) // need to create a new member
7486 {
7487 MemberType mtype = MemberType::Function;
7488 switch (root->mtype)
7489 {
7490 case MethodTypes::Method: mtype = MemberType::Function; break;
7491 case MethodTypes::Signal: mtype = MemberType::Signal; break;
7492 case MethodTypes::Slot: mtype = MemberType::Slot; break;
7493 case MethodTypes::DCOP: mtype = MemberType::DCOP; break;
7494 case MethodTypes::Property: mtype = MemberType::Property; break;
7495 case MethodTypes::Event: mtype = MemberType::Event; break;
7496 }
7497
7498 //printf("New related name '%s' '%d'\n",qPrint(funcName),
7499 // root->argList ? (int)root->argList->count() : -1);
7500
7501 // first note that we pass:
7502 // (root->tArgLists ? root->tArgLists->last() : nullptr)
7503 // for the template arguments for the new "member."
7504 // this accurately reflects the template arguments of
7505 // the related function, which don't have to do with
7506 // those of the related class.
7507 auto md = createMemberDef(
7508 root->fileName,root->startLine,root->startColumn,
7509 funcType,funcName,funcArgs,exceptions,
7510 root->protection,root->virt,
7511 root->isStatic,
7512 isMemberOf ? Relationship::Foreign : Relationship::Related,
7513 mtype,
7514 (!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList()),
7515 funcArgs.empty() ? ArgumentList() : root->argList,
7516 root->metaData);
7517 auto mmd = toMemberDefMutable(md.get());
7518
7519 // also insert the member as an alias in the parent's scope, so it can be referenced also without cd's scope
7520 insertMemberAlias(cd->getOuterScope(),md.get());
7521
7522 // we still have the problem that
7523 // MemberDef::writeDocumentation() in memberdef.cpp
7524 // writes the template argument list for the class,
7525 // as if this member is a member of the class.
7526 // fortunately, MemberDef::writeDocumentation() has
7527 // a special mechanism that allows us to totally
7528 // override the set of template argument lists that
7529 // are printed. We use that and set it to the
7530 // template argument lists of the related function.
7531 //
7532 mmd->setDefinitionTemplateParameterLists(root->tArgLists);
7533
7534 mmd->setTagInfo(root->tagInfo());
7535
7536 addIncludeFile(mmd,root->fileDef(),root);
7537 //printf("Related member name='%s' decl='%s' bodyLine='%d'\n",
7538 // qPrint(funcName),qPrint(funcDecl),root->bodyLine);
7539
7540 // try to find the matching line number of the body from the
7541 // global function list
7542 bool found=false;
7543 if (root->bodyLine==-1)
7544 {
7546 if (rmn)
7547 {
7548 const MemberDefMutable *rmd_found=nullptr;
7549 for (const auto &irmd : *rmn)
7550 {
7551 MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
7552 if (rmd)
7553 {
7554 const ArgumentList &rmdAl = rmd->argumentList();
7555 // check for matching argument lists
7556 if (
7557 matchArguments2(rmd->getOuterScope(),rmd->getFileDef(),rmd->typeString(),&rmdAl,
7558 cd,fd,root->type,&root->argList,
7559 true,root->lang)
7560 )
7561 {
7562 found=true;
7563 rmd_found = rmd;
7564 break;
7565 }
7566 }
7567 }
7568 if (rmd_found) // member found -> copy line number info
7569 {
7570 mmd->setBodySegment(rmd_found->getDefLine(),rmd_found->getStartBodyLine(),rmd_found->getEndBodyLine());
7571 mmd->setBodyDef(rmd_found->getBodyDef());
7572 //md->setBodyMember(rmd);
7573 }
7574 }
7575 }
7576 if (!found) // line number could not be found or is available in this
7577 // entry
7578 {
7579 mmd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
7580 mmd->setBodyDef(fd);
7581 }
7582
7583 //if (root->mGrpId!=-1)
7584 //{
7585 // md->setMemberGroup(memberGroupDict[root->mGrpId]);
7586 //}
7587 mmd->setMemberClass(cd);
7588 mmd->setMemberSpecifiers(spec);
7589 mmd->setVhdlSpecifiers(root->vhdlSpec);
7590 mmd->setDefinition(funcDecl);
7592 mmd->addQualifiers(root->qualifiers);
7593 mmd->setDocumentation(root->doc,root->docFile,root->docLine);
7594 mmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
7595 mmd->setDocsForDefinition(!root->proto);
7596 mmd->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
7597 mmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
7598 mmd->addSectionsToDefinition(root->anchors);
7599 mmd->setMemberGroupId(root->mGrpId);
7600 mmd->setLanguage(root->lang);
7601 mmd->setId(root->id);
7602 //md->setMemberDefTemplateArguments(root->mtArgList);
7603 cd->insertMember(md.get());
7604 cd->insertUsedFile(fd);
7605 mmd->setRefItems(root->sli);
7606 mmd->setRequirementReferences(root->rqli);
7607 if (root->relatesType==RelatesType::Duplicate) mmd->setRelatedAlso(cd);
7608 addMemberToGroups(root,md.get());
7610 //printf("Adding member=%s\n",qPrint(md->name()));
7611 mn->push_back(std::move(md));
7612 }
7613 if (root->relatesType==RelatesType::Duplicate)
7614 {
7615 if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec))
7616 {
7617 DString fullFuncDecl=funcDecl;
7618 if (isFunc) fullFuncDecl+=argListToString(root->argList,true);
7619 warn(root->fileName,root->startLine,
7620 "Cannot determine file/namespace for relatedalso function\n{}",
7621 fullFuncDecl
7622 );
7623 }
7624 }
7625 }
7626 }
7627 else
7628 {
7629 warn_undoc(root->fileName,root->startLine, "class '{}' for related function '{}' is not documented.", className,funcName);
7630 }
7631 }
7632 else if (root->parent() && root->parent()->section.isObjcImpl())
7633 {
7634 addLocalObjCMethod(root,scopeName,funcType,funcName,funcArgs,exceptions,funcDecl,spec);
7635 }
7636 else // unrelated not overloaded member found
7637 {
7638 bool globMem = findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec);
7639 if (className.empty() && !globMem)
7640 {
7641 warn(root->fileName,root->startLine, "class for member '{}' cannot be found.", funcName);
7642 }
7643 else if (!className.empty() && !globMem)
7644 {
7645 warn(root->fileName,root->startLine,
7646 "member '{}' of class '{}' cannot be found",
7647 funcName,className);
7648 }
7649 }
7650 }
7651 else
7652 {
7653 // this should not be called
7654 warn(root->fileName,root->startLine,"member with no name found.");
7655 }
7656 return;
7657}
virtual void removeMember(MemberDef *md)=0
virtual void moveTo(Definition *)=0
virtual bool isStrong() const =0
MemberName::Ptr take(const DString &key, const MemberDef *value)
Definition membername.h:63
Wrapper class for a number of boolean properties.
Definition types.h:696
void parseFuncDecl(const DString &decl, const SrcLangExt lang, DString &clName, DString &type, DString &name, DString &args, DString &funcTempList, DString &exceptions)
Definition declinfo.l:330
static void insertMemberAlias(Definition *outerScope, const MemberDef *md)
Definition doxygen.cpp:6988
static void addMemberSpecialization(const Entry *root, MemberName *mn, ClassDefMutable *cd, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &funcDecl, const DString &exceptions, TypeSpecifier spec)
Definition doxygen.cpp:6855
static void addMemberFunction(const Entry *root, MemberName *mn, const DString &scopeName, const DString &namespaceName, const DString &className, const DString &funcTyp, const DString &funcName, const DString &funcArgs, const DString &funcTempList, const DString &exceptions, const DString &type, const DString &args, bool isFriend, TypeSpecifier spec, const DString &relates, const DString &funcDecl, bool overloaded, bool isFunc)
Definition doxygen.cpp:6456
static void addOverloaded(const Entry *root, MemberName *mn, const DString &funcType, const DString &funcName, const DString &funcArgs, const DString &funcDecl, const DString &exceptions, TypeSpecifier spec)
Definition doxygen.cpp:6919
static bool findGlobalMember(const Entry *root, const DString &namespaceName, const DString &type, const DString &name, const DString &tempArg, const DString &, const DString &decl, TypeSpecifier)
Definition doxygen.cpp:6035

References LinkedMap< T, Hash, KeyEqual, Map >::add(), addIncludeFile(), addLocalObjCMethod(), addMemberDocs(), addMemberFunction(), addMemberSpecialization(), addMemberToGroups(), ModuleManager::addMemberToModule(), addOverloaded(), Entry::anchors, applyMemberOverrideOptions(), Entry::argList, argListToString(), MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::bodyLine, Entry::brief, Entry::briefFile, Entry::briefLine, DString::clear(), Config_getBool, createMemberDef(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::endBodyLine, extractNamespaceName(), Entry::fileDef(), Entry::fileName, DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), findGlobalMember(), Doxygen::functionNameLinkedMap, Definition::getBodyDef(), getClass(), getClassMutable(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getFileDef(), Definition::getOuterScope(), Definition::getStartBodyLine(), FileDef::getUsedNamespaces(), Doxygen::globalScope, Entry::id, Entry::inbodyDocs, Entry::inbodyFile, Entry::inbodyLine, ClassDefMutable::insertMember(), insertMemberAlias(), ClassDefMutable::insertUsedFile(), ModuleManager::instance(), MemberDef::isDefine(), MemberDef::isEnumerate(), EntryType::isScope(), Entry::isStatic, MemberDef::isStrong(), Entry::lang, DString::left(), MemberDefMutable::makeRelated(), matchArguments2(), Doxygen::memberNameLinkedMap, mergeScopes(), Entry::metaData, Entry::mGrpId, DString::mid(), MemberDef::moveTo(), Entry::mtype, Definition::name(), Entry::name, Doxygen::namespaceLinkedMap, DString::npos, Entry::parent(), parseFuncDecl(), DString::prepend(), Entry::protection, Entry::proto, MemberName::push_back(), ClassDef::qualifiedNameWithTemplateParameters(), Entry::qualifiers, Entry::relatesType, FileDef::removeMember(), removeRedundantWhiteSpace(), Entry::rqli, Entry::section, MemberDefMutable::setMemberClass(), MemberName::size(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, DString::startsWith(), DString::stripPrefix(), stripTemplateSpecifiersFromScope(), DString::stripWhiteSpace(), substitute(), Entry::tagInfo(), MemberNameLinkedMap::take(), Entry::tArgLists, toMemberDefMutable(), Entry::type, MemberDef::typeString(), Entry::vhdlSpec, Entry::virt, warn, and warn_undoc.

Referenced by filterMemberDocumentation(), and findObjCMethodDefinitions().

◆ findMemberDocumentation()

void findMemberDocumentation ( const Entry * root)
static

Definition at line 7812 of file doxygen.cpp.

7813{
7814 if (root->section.isMemberDoc() ||
7815 root->section.isOverloadDoc() ||
7816 root->section.isFunction() ||
7817 root->section.isVariable() ||
7818 root->section.isVariableDoc() ||
7819 root->section.isDefine() ||
7820 root->section.isIncludedService() ||
7821 root->section.isExportedInterface()
7822 )
7823 {
7824 AUTO_TRACE();
7825 if (root->relatesType==RelatesType::Duplicate && !root->relates.empty())
7826 {
7828 }
7830 }
7831 for (const auto &e : root->children())
7832 {
7833 if (!e->section.isEnum())
7834 {
7835 findMemberDocumentation(e.get());
7836 }
7837 }
7838}
static void findMemberDocumentation(const Entry *root)
Definition doxygen.cpp:7812
static void filterMemberDocumentation(const Entry *root, const DString &relates)
Definition doxygen.cpp:7663

References AUTO_TRACE, Entry::children(), DString::empty(), filterMemberDocumentation(), findMemberDocumentation(), Entry::relates, Entry::relatesType, and Entry::section.

Referenced by findMemberDocumentation(), and parseInput().

◆ findModuleDocumentation()

void findModuleDocumentation ( const Entry * root)
static

Definition at line 1330 of file doxygen.cpp.

1331{
1332 if (root->section.isModuleDoc())
1333 {
1334 AUTO_TRACE();
1336 }
1337 for (const auto &e : root->children()) findModuleDocumentation(e.get());
1338}
void addDocs(const Entry *root)
static void findModuleDocumentation(const Entry *root)
Definition doxygen.cpp:1330

References ModuleManager::addDocs(), AUTO_TRACE, Entry::children(), findModuleDocumentation(), ModuleManager::instance(), and Entry::section.

Referenced by findModuleDocumentation(), and parseInput().

◆ findObjCMethodDefinitions()

void findObjCMethodDefinitions ( const Entry * root)
static

Definition at line 7936 of file doxygen.cpp.

7937{
7938 AUTO_TRACE();
7939 for (const auto &objCImpl : root->children())
7940 {
7941 if (objCImpl->section.isObjcImpl())
7942 {
7943 for (const auto &objCMethod : objCImpl->children())
7944 {
7945 if (objCMethod->section.isFunction())
7946 {
7947 //printf(" Found ObjC method definition %s\n",qPrint(objCMethod->name));
7948 findMember(objCMethod.get(),
7949 objCMethod->relates,
7950 objCMethod->type,
7951 objCMethod->args,
7952 objCMethod->type+" "+objCImpl->name+"::"+objCMethod->name+" "+objCMethod->args,
7953 false,true);
7954 objCMethod->section=EntryType::makeEmpty();
7955 }
7956 }
7957 }
7958 }
7959}

References AUTO_TRACE, Entry::children(), and findMember().

Referenced by parseInput().

◆ findScopeFromQualifiedName()

Definition * findScopeFromQualifiedName ( NamespaceDefMutable * startScope,
const DString & n,
FileDef * fileScope,
const TagInfo * tagInfo )
static

Definition at line 793 of file doxygen.cpp.

795{
796 //printf("<findScopeFromQualifiedName(%s,%s)\n",startScope ? qPrint(startScope->name()) : 0, qPrint(n));
797 Definition *resultScope=toDefinition(startScope);
798 if (resultScope==nullptr) resultScope=Doxygen::globalScope;
800 int l1 = 0;
801 int i1 = getScopeFragment(scope,0,&l1);
802 if (i1==-1)
803 {
804 //printf(">no fragments!\n");
805 return resultScope;
806 }
807 int p=i1+l1,l2=0,i2=0;
808 while ((i2=getScopeFragment(scope,p,&l2))!=-1)
809 {
810 DString nestedNameSpecifier = scope.mid(i1,l1);
811 Definition *orgScope = resultScope;
812 //printf(" nestedNameSpecifier=%s\n",qPrint(nestedNameSpecifier));
813 resultScope = const_cast<Definition*>(resultScope->findInnerCompound(nestedNameSpecifier));
814 //printf(" resultScope=%p\n",resultScope);
815 if (resultScope==nullptr)
816 {
817 if (orgScope==Doxygen::globalScope && fileScope && !fileScope->getUsedNamespaces().empty())
818 // also search for used namespaces
819 {
820 for (const auto &nd : fileScope->getUsedNamespaces())
821 {
823 if (mnd)
824 {
825 resultScope = findScopeFromQualifiedName(toNamespaceDefMutable(nd),n,fileScope,tagInfo);
826 if (resultScope!=nullptr) break;
827 }
828 }
829 if (resultScope)
830 {
831 // for a nested class A::I in used namespace N, we get
832 // N::A::I while looking for A, so we should compare
833 // resultScope->name() against scope.left(i2+l2)
834 //printf(" -> result=%s scope=%s\n",qPrint(resultScope->name()),qPrint(scope));
835 if (rightScopeMatch(resultScope->name(),scope.left(i2+l2)))
836 {
837 break;
838 }
839 goto nextFragment;
840 }
841 }
842
843 // also search for used classes. Complication: we haven't been able
844 // to put them in the right scope yet, because we are still resolving
845 // the scope relations!
846 // Therefore loop through all used classes and see if there is a right
847 // scope match between the used class and nestedNameSpecifier.
848 for (const auto &usedName : g_usingDeclarations)
849 {
850 //printf("Checking using class %s\n",qPrint(usedName));
851 if (rightScopeMatch(usedName,nestedNameSpecifier))
852 {
853 // ui.currentKey() is the fully qualified name of nestedNameSpecifier
854 // so use this instead.
855 DString fqn = usedName + scope.mid(p);
856 resultScope = buildScopeFromQualifiedName(fqn,startScope->getLanguage(),nullptr);
857 //printf("Creating scope from fqn=%s result %p\n",qPrint(fqn),resultScope);
858 if (resultScope)
859 {
860 //printf("> Match! resultScope=%s\n",qPrint(resultScope->name()));
861 return resultScope;
862 }
863 }
864 }
865
866 //printf("> name %s not found in scope %s\n",qPrint(nestedNameSpecifier),qPrint(orgScope->name()));
867 return nullptr;
868 }
869 nextFragment:
870 i1=i2;
871 l1=l2;
872 p=i2+l2;
873 }
874 //printf(">findScopeFromQualifiedName scope %s\n",qPrint(resultScope->name()));
875 return resultScope;
876}
virtual const Definition * findInnerCompound(const DString &name) const =0
bool empty() const
Definition linkedmap.h:374

References buildScopeFromQualifiedName(), LinkedRefMap< T, Hash, KeyEqual, Map >::empty(), Definition::findInnerCompound(), findScopeFromQualifiedName(), g_usingDeclarations, Definition::getLanguage(), getScopeFragment(), FileDef::getUsedNamespaces(), Doxygen::globalScope, DString::left(), DString::mid(), Definition::name(), rightScopeMatch(), stripTemplateSpecifiersFromScope(), toDefinition(), and toNamespaceDefMutable().

Referenced by addConceptToContext(), addPageToContext(), buildNamespaceList(), findClassRelation(), findGroupScope(), findScopeFromQualifiedName(), and resolveClassNestingRelations().

◆ findSectionsInDocumentation()

void findSectionsInDocumentation ( )
static

Definition at line 9818 of file doxygen.cpp.

9819{
9820 // for each class
9821 for (const auto &cd : *Doxygen::classLinkedMap)
9822 {
9823 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9824 if (cdm)
9825 {
9827 }
9828 }
9829 // for each concept
9830 for (const auto &cd : *Doxygen::conceptLinkedMap)
9831 {
9832 ConceptDefMutable *cdm = toConceptDefMutable(cd.get());
9833 if (cdm)
9834 {
9836 }
9837 }
9838 // for each file
9839 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9840 {
9841 for (const auto &fd : *fn)
9842 {
9843 fd->findSectionsInDocumentation();
9844 }
9845 }
9846 // for each namespace
9847 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9848 {
9850 if (ndm)
9851 {
9853 }
9854 }
9855 // for each group
9856 for (const auto &gd : *Doxygen::groupLinkedMap)
9857 {
9858 gd->findSectionsInDocumentation();
9859 }
9860 // for each page
9861 for (const auto &pd : *Doxygen::pageLinkedMap)
9862 {
9863 pd->findSectionsInDocumentation();
9864 }
9865 // for each directory
9866 for (const auto &dd : *Doxygen::dirLinkedMap)
9867 {
9868 dd->findSectionsInDocumentation();
9869 }
9871 if (Doxygen::mainPage) Doxygen::mainPage->findSectionsInDocumentation();
9872}
virtual void findSectionsInDocumentation()=0
virtual void findSectionsInDocumentation()=0
void findSectionsInDocumentation()
virtual void findSectionsInDocumentation()=0

References Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, Doxygen::dirLinkedMap, ClassDefMutable::findSectionsInDocumentation(), ConceptDefMutable::findSectionsInDocumentation(), ModuleManager::findSectionsInDocumentation(), NamespaceDefMutable::findSectionsInDocumentation(), Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::mainPage, Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, toClassDefMutable(), toConceptDefMutable(), and toNamespaceDefMutable().

Referenced by parseInput().

◆ findTagLessClasses() [1/2]

void findTagLessClasses ( )
static

Definition at line 1936 of file doxygen.cpp.

1937{
1938 std::set<const Definition *> candidates;
1939 for (auto &cd : *Doxygen::classLinkedMap)
1940 {
1941 if (cd->isAlias()) continue;
1942 Definition *scope = cd->getOuterScope();
1943 //printf(" scope=%s for class %s\n",qPrint(scope?scope->name():"<null>"),qPrint(cd->name()));
1944 if (scope && scope->definitionType()==Definition::TypeNamespace) // class that is not nested
1945 {
1946 const NamespaceDef *nd = toNamespaceDef(scope);
1947 if (nd && nd==Doxygen::globalScope) // class at global namespace
1948 {
1949 const FileDef *fd = cd->getFileDef();
1950 if (fd)
1951 {
1952 findTagLessClasses(candidates,fd);
1953 }
1954 }
1955 else if (nd) // class in a namespace
1956 {
1957 findTagLessClasses(candidates,nd);
1958 }
1959 }
1960 }
1961
1962 // since processTagLessClasses is potentially adding classes to Doxygen::classLinkedMap
1963 // we need to call it outside of the loop above, otherwise the iterator gets invalidated!
1964 for (const auto &d : candidates)
1965 {
1966 //printf("------ processing tag-less classes for %s\n",qPrint(d->name()));
1967 if (d->definitionType()==Definition::TypeNamespace)
1968 {
1969 const NamespaceDef *nd = toNamespaceDef(d);
1970 processTagLessClasses(nd,nd,nd,MemberListType::DecVarMembers(),MemberListType::DecEnumMembers(),"",0);
1971 }
1972 else if (d->definitionType()==Definition::TypeFile)
1973 {
1974 const FileDef *fd = toFileDef(d);
1975 processTagLessClasses(fd,fd,fd,MemberListType::DecVarMembers(),MemberListType::DecEnumMembers(),"",0);
1976 }
1977 else if (d->definitionType()==Definition::TypeClass)
1978 {
1979 const ClassDef *cd = toClassDef(d);
1980 processTagLessClasses(cd,cd,cd,MemberListType::PubAttribs(),MemberListType::PubTypes(),"",0);
1981 }
1982 }
1983}
ClassDef * toClassDef(Definition *d)
static void processTagLessClasses(const Definition *root, const Container *def, const TagContainer *tagParent, MemberListType varFilter, MemberListType typeFilter, const DString &prefix, int count)
Look through the members of class cd and its public members.
Definition doxygen.cpp:1901
static void findTagLessClasses()
Definition doxygen.cpp:1936

References Doxygen::classLinkedMap, Definition::definitionType(), findTagLessClasses(), Definition::getOuterScope(), Doxygen::globalScope, processTagLessClasses(), toClassDef(), toFileDef(), toNamespaceDef(), Definition::TypeClass, Definition::TypeFile, and Definition::TypeNamespace.

Referenced by findTagLessClasses(), findTagLessClasses(), and parseInput().

◆ findTagLessClasses() [2/2]

template<typename Container>
void findTagLessClasses ( std::set< const Definition * > & candidates,
const Container * cd )
static

Definition at line 1921 of file doxygen.cpp.

1922{
1923 for (const auto &icd : cd->getClasses())
1924 {
1925 // process all non-anonymous inner classes, but skip aliases (e.g. from inline namespaces),
1926 // as these share the members of the aliased class, which is processed already
1927 if (!icd->isAlias() && icd->name().find('@')==DString::npos)
1928 {
1929 findTagLessClasses(candidates,icd);
1930 }
1931 }
1932
1933 candidates.insert(cd);
1934}

References findTagLessClasses(), and DString::npos.

◆ findTemplateInstanceRelation()

void findTemplateInstanceRelation ( const Entry * root,
Definition * context,
ClassDefMutable * templateClass,
const DString & templSpec,
const TemplateNameMap & templateNames,
bool isArtificial )
static

Definition at line 5037 of file doxygen.cpp.

5042{
5043 AUTO_TRACE("Derived from template '{}' with parameters '{}' isArtificial={}",
5044 templateClass->name(),templSpec,isArtificial);
5045
5046 DString tempArgsStr = tempArgListToString(templateClass->templateArguments(),root->lang,false);
5047 bool existingClass = templSpec==tempArgsStr;
5048 if (existingClass) return; // avoid recursion
5049
5050 bool freshInstance=false;
5051 ClassDefMutable *instanceClass = toClassDefMutable(
5052 templateClass->insertTemplateInstance(
5053 root->fileName,root->startLine,root->startColumn,templSpec,freshInstance));
5054 if (instanceClass)
5055 {
5056 if (freshInstance)
5057 {
5058 instanceClass->setArtificial(true);
5059 instanceClass->setLanguage(root->lang);
5060
5061 AUTO_TRACE_ADD("found fresh instance '{}'",instanceClass->name());
5062 instanceClass->setTemplateBaseClassNames(templateNames);
5063
5064 // search for new template instances caused by base classes of
5065 // instanceClass
5066 auto it_pair = g_classEntries.equal_range(templateClass->name().str());
5067 for (auto it=it_pair.first ; it!=it_pair.second ; ++it)
5068 {
5069 const Entry *templateRoot = it->second;
5070 AUTO_TRACE_ADD("template root found '{}' templSpec='{}'",templateRoot->name,templSpec);
5071 std::unique_ptr<ArgumentList> templArgs = stringToArgumentList(root->lang,templSpec);
5072 findBaseClassesForClass(templateRoot,context,templateClass,instanceClass,
5073 TemplateInstances,isArtificial,templArgs.get(),templateNames);
5074
5075 findUsedClassesForClass(templateRoot,context,templateClass,instanceClass,
5076 isArtificial,templArgs.get(),templateNames);
5077 }
5078 }
5079 else
5080 {
5081 AUTO_TRACE_ADD("instance already exists");
5082 }
5083 }
5084}
virtual void setTemplateBaseClassNames(const TemplateNameMap &templateNames)=0
virtual ClassDef * insertTemplateInstance(const DString &fileName, int startLine, size_t startColumn, const DString &templSpec, bool &freshInstance)=0
static void findUsedClassesForClass(const Entry *root, Definition *context, ClassDefMutable *masterCd, ClassDefMutable *instanceCd, bool isArtificial, const ArgumentList *actualArgs=nullptr, const TemplateNameMap &templateNames=TemplateNameMap())
Definition doxygen.cpp:4830

References AUTO_TRACE, AUTO_TRACE_ADD, Entry::fileName, findBaseClassesForClass(), findUsedClassesForClass(), g_classEntries, ClassDefMutable::insertTemplateInstance(), Entry::lang, Definition::name(), Entry::name, DefinitionMutable::setArtificial(), DefinitionMutable::setLanguage(), ClassDefMutable::setTemplateBaseClassNames(), Entry::startColumn, Entry::startLine, DString::str(), stringToArgumentList(), tempArgListToString(), ClassDef::templateArguments(), TemplateInstances, and toClassDefMutable().

Referenced by findClassRelation(), and resolveTemplateInstanceInType().

◆ findTemplateSpecializationPosition()

int findTemplateSpecializationPosition ( const DString & name)
static

Definition at line 5128 of file doxygen.cpp.

5129{
5130 if (name.empty()) return 0;
5131 int l = static_cast<int>(name.length());
5132 if (name[l-1]=='>') // search backward to find the matching <, allowing nested <...> and strings.
5133 {
5134 int count=1;
5135 int i=l-2;
5136 char insideQuote=0;
5137 while (count>0 && i>=0)
5138 {
5139 char c = name[i--];
5140 switch (c)
5141 {
5142 case '>': if (!insideQuote) count++; break;
5143 case '<': if (!insideQuote) count--; break;
5144 case '\'': if (!insideQuote) insideQuote=c;
5145 else if (insideQuote==c && (i<0 || name[i]!='\\')) insideQuote=0;
5146 break;
5147 case '"': if (!insideQuote) insideQuote=c;
5148 else if (insideQuote==c && (i<0 || name[i]!='\\')) insideQuote=0;
5149 break;
5150 default: break;
5151 }
5152 }
5153 if (i>=0) l=i+1;
5154 }
5155 return l;
5156}

Referenced by findClassRelation().

◆ findUsedClassesForClass()

void findUsedClassesForClass ( const Entry * root,
Definition * context,
ClassDefMutable * masterCd,
ClassDefMutable * instanceCd,
bool isArtificial,
const ArgumentList * actualArgs = nullptr,
const TemplateNameMap & templateNames = TemplateNameMap() )
static

Definition at line 4830 of file doxygen.cpp.

4838{
4839 AUTO_TRACE();
4840 const ArgumentList &formalArgs = masterCd->templateArguments();
4841 for (auto &mni : masterCd->memberNameInfoLinkedMap())
4842 {
4843 for (auto &mi : *mni)
4844 {
4845 const MemberDef *md=mi->memberDef();
4846 if (md->isVariable() || md->isObjCProperty()) // for each member variable in this class
4847 {
4848 AUTO_TRACE_ADD("Found variable '{}' in class '{}'",md->name(),masterCd->name());
4849 DString type = normalizeNonTemplateArgumentsInString(md->typeString(),masterCd,formalArgs);
4850 DString typedefValue = md->getLanguage()==SrcLangExt::Java ? type : resolveTypeDef(masterCd,type);
4851 if (!typedefValue.empty())
4852 {
4853 type = typedefValue;
4854 }
4855 int pos=0;
4856 DString usedClassName;
4857 DString templSpec;
4858 bool found=false;
4859 // the type can contain template variables, replace them if present
4860 type = substituteTemplateArgumentsInString(type,formalArgs,actualArgs);
4861
4862 //printf(" template substitution gives=%s\n",qPrint(type));
4863 while (!found && extractClassNameFromType(type,pos,usedClassName,templSpec,root->lang)!=-1)
4864 {
4865 // find the type (if any) that matches usedClassName
4866 SymbolResolver resolver(masterCd->getFileDef());
4867 const ClassDefMutable *typeCd = resolver.resolveClassMutable(masterCd,usedClassName,false,true);
4868 //printf("====> usedClassName=%s -> typeCd=%s\n",
4869 // qPrint(usedClassName),typeCd?qPrint(typeCd->name()):"<none>");
4870 if (typeCd)
4871 {
4872 usedClassName = typeCd->name();
4873 }
4874
4875 // replace any namespace aliases
4876 replaceNamespaceAliases(usedClassName);
4877 // add any template arguments to the class
4878 DString usedName = removeRedundantWhiteSpace(usedClassName+templSpec);
4879 //printf(" usedName=%s usedClassName=%s templSpec=%s\n",qPrint(usedName),qPrint(usedClassName),qPrint(templSpec));
4880
4881 TemplateNameMap formTemplateNames;
4882 if (templateNames.empty())
4883 {
4884 formTemplateNames = getTemplateArgumentsInName(formalArgs,usedName.str());
4885 }
4886 BaseInfo bi(usedName,Protection::Public,Specifier::Normal);
4887 findClassRelation(root,context,instanceCd,&bi,formTemplateNames,TemplateInstances,isArtificial);
4888
4889 for (const Argument &arg : masterCd->templateArguments())
4890 {
4891 if (arg.name==usedName) // type is a template argument
4892 {
4893 ClassDef *usedCd = Doxygen::hiddenClassLinkedMap->find(usedName);
4894 ClassDefMutable *usedCdm = toClassDefMutable(usedCd);
4895 if (usedCd==nullptr)
4896 {
4897 usedCdm = toClassDefMutable(
4898 Doxygen::hiddenClassLinkedMap->add(usedName,
4900 masterCd->getDefFileName(),masterCd->getDefLine(),
4901 masterCd->getDefColumn(),
4902 usedName,
4903 ClassDef::Class)));
4904 if (usedCdm)
4905 {
4906 //printf("making %s a template argument!!!\n",qPrint(usedCd->name()));
4907 usedCdm->makeTemplateArgument();
4908 usedCdm->setUsedOnly(true);
4909 usedCdm->setLanguage(masterCd->getLanguage());
4910 usedCd = usedCdm;
4911 }
4912 }
4913 if (usedCd)
4914 {
4915 found=true;
4916 AUTO_TRACE_ADD("case 1: adding used class '{}'", usedCd->name());
4917 instanceCd->addUsedClass(usedCd,md->name(),md->protection());
4918 if (usedCdm)
4919 {
4920 if (isArtificial) usedCdm->setArtificial(true);
4921 usedCdm->addUsedByClass(instanceCd,md->name(),md->protection());
4922 }
4923 }
4924 }
4925 }
4926
4927 if (!found)
4928 {
4929 ClassDef *usedCd=findClassWithinClassContext(context,masterCd,usedName);
4930 //printf("Looking for used class %s: result=%s master=%s\n",
4931 // qPrint(usedName),usedCd?qPrint(usedCd->name()):"<none>",masterCd?qPrint(masterCd->name()):"<none>");
4932
4933 if (usedCd)
4934 {
4935 found=true;
4936 AUTO_TRACE_ADD("case 2: adding used class '{}'", usedCd->name());
4937 instanceCd->addUsedClass(usedCd,md->name(),md->protection()); // class exists
4938 ClassDefMutable *usedCdm = toClassDefMutable(usedCd);
4939 if (usedCdm)
4940 {
4941 usedCdm->addUsedByClass(instanceCd,md->name(),md->protection());
4942 }
4943 }
4944 }
4945 }
4946 if (!found && !type.empty()) // used class is not documented in any scope
4947 {
4949 ClassDefMutable *usedCdm = toClassDefMutable(usedCd);
4950 if (usedCd==nullptr && !Config_getBool(HIDE_UNDOC_RELATIONS))
4951 {
4952 if (type.endsWith("(*") || type.endsWith("(^")) // type is a function pointer
4953 {
4954 type+=md->argsString();
4955 }
4956 AUTO_TRACE_ADD("New undocumented used class '{}'", type);
4957 usedCdm = toClassDefMutable(
4960 masterCd->getDefFileName(),masterCd->getDefLine(),
4961 masterCd->getDefColumn(),
4962 type,ClassDef::Class)));
4963 if (usedCdm)
4964 {
4965 usedCdm->setUsedOnly(true);
4966 usedCdm->setLanguage(masterCd->getLanguage());
4967 usedCd = usedCdm;
4968 }
4969 }
4970 if (usedCd)
4971 {
4972 AUTO_TRACE_ADD("case 3: adding used class '{}'", usedCd->name());
4973 instanceCd->addUsedClass(usedCd,md->name(),md->protection());
4974 if (usedCdm)
4975 {
4976 if (isArtificial) usedCdm->setArtificial(true);
4977 usedCdm->addUsedByClass(instanceCd,md->name(),md->protection());
4978 }
4979 }
4980 }
4981 }
4982 }
4983 }
4984}
virtual void addUsedClass(ClassDef *cd, const DString &accessName, Protection prot)=0
virtual void makeTemplateArgument(bool b=true)=0
virtual void setUsedOnly(bool b)=0
virtual void addUsedByClass(ClassDef *cd, const DString &accessName, Protection prot)=0
virtual bool isObjCProperty() const =0
DString resolveTypeDef(const Definition *context, const DString &qualifiedName, const Definition **typedefContext)
Definition util.cpp:232
DString normalizeNonTemplateArgumentsInString(const DString &name, const Definition *context, const ArgumentList &formalArgs)
Definition util.cpp:3597
int extractClassNameFromType(const DString &type, int &pos, DString &name, DString &templSpec, SrcLangExt lang)
Definition util.cpp:3512

References ClassDefMutable::addUsedByClass(), ClassDefMutable::addUsedClass(), MemberDef::argsString(), AUTO_TRACE, AUTO_TRACE_ADD, ClassDef::Class, Config_getBool, createClassDef(), DString::empty(), DString::endsWith(), extractClassNameFromType(), LinkedMap< T, Hash, KeyEqual, Map >::find(), findClassRelation(), findClassWithinClassContext(), Definition::getDefColumn(), Definition::getDefFileName(), Definition::getDefLine(), ClassDef::getFileDef(), Definition::getLanguage(), getTemplateArgumentsInName(), Doxygen::hiddenClassLinkedMap, MemberDef::isObjCProperty(), MemberDef::isVariable(), Entry::lang, ClassDefMutable::makeTemplateArgument(), ClassDef::memberNameInfoLinkedMap(), Definition::name(), normalizeNonTemplateArgumentsInString(), MemberDef::protection(), removeRedundantWhiteSpace(), replaceNamespaceAliases(), SymbolResolver::resolveClassMutable(), resolveTypeDef(), DefinitionMutable::setArtificial(), DefinitionMutable::setLanguage(), ClassDefMutable::setUsedOnly(), DString::str(), substituteTemplateArgumentsInString(), ClassDef::templateArguments(), TemplateInstances, toClassDefMutable(), and MemberDef::typeString().

Referenced by findTemplateInstanceRelation(), and findUsedTemplateInstances().

◆ findUsedNamespace()

NamespaceDef * findUsedNamespace ( const LinkedRefMap< NamespaceDef > & unl,
const DString & name )
static

Definition at line 2160 of file doxygen.cpp.

2162{
2163 NamespaceDef *usingNd =nullptr;
2164 for (auto &und : unl)
2165 {
2166 DString uScope=und->name()+"::";
2167 usingNd = getResolvedNamespace(uScope+name);
2168 if (usingNd!=nullptr) break;
2169 }
2170 return usingNd;
2171}

References getResolvedNamespace().

Referenced by findUsingDirectives().

◆ findUsedTemplateInstances()

void findUsedTemplateInstances ( )
static

Definition at line 5590 of file doxygen.cpp.

5591{
5592 AUTO_TRACE();
5593 for (const auto &[name,root] : g_classEntries)
5594 {
5595 DString bName = extractClassName(root);
5596 ClassDefMutable *cdm = getClassMutable(bName);
5597 if (cdm)
5598 {
5599 findUsedClassesForClass(root,cdm,cdm,cdm,true);
5601 cdm->addTypeConstraints();
5602 }
5603 }
5604}
virtual void addTypeConstraints()=0
static void makeTemplateInstanceRelation(const Entry *root, ClassDefMutable *cd)
Definition doxygen.cpp:5572

References ClassDefMutable::addTypeConstraints(), AUTO_TRACE, extractClassName(), findUsedClassesForClass(), g_classEntries, getClassMutable(), and makeTemplateInstanceRelation().

Referenced by parseInput().

◆ findUsingDeclarations()

void findUsingDeclarations ( const Entry * root,
bool filterPythonPackages )
static

Definition at line 2330 of file doxygen.cpp.

2331{
2332 if (root->section.isUsingDecl() &&
2333 !root->parent()->section.isCompound() && // not a class/struct member
2334 (!filterPythonPackages || (root->lang==SrcLangExt::Python && root->fileName.endsWith("__init__.py")))
2335 )
2336 {
2337 AUTO_TRACE("Found using declaration '{}' at line {} of {} inside section {}",
2338 root->name,root->startLine,root->fileName,root->parent()->section);
2339 if (!root->name.empty())
2340 {
2341 const Definition *usingDef = nullptr;
2342 NamespaceDefMutable *nd = nullptr;
2343 FileDef *fd = root->fileDef();
2344 DString scName;
2345
2346 // see if the using statement was found inside a namespace or inside
2347 // the global file scope.
2348 if (root->parent()->section.isNamespace())
2349 {
2350 scName=root->parent()->name;
2351 if (!scName.empty())
2352 {
2353 nd = getResolvedNamespaceMutable(scName);
2354 }
2355 }
2356
2357 // Assume the using statement was used to import a class.
2358 // Find the scope in which the 'using' namespace is defined by prepending
2359 // the possible scopes in which the using statement was found, starting
2360 // with the most inner scope and going to the most outer scope (i.e.
2361 // file scope).
2362
2363 DString name = substitute(root->name,".","::"); //Java/C# scope->internal
2364
2365 SymbolResolver resolver;
2366 const Definition *scope = nd;
2367 if (nd==nullptr) scope = fd;
2368 usingDef = resolver.resolveSymbol(scope,name);
2369
2370 //printf("usingDef(scope=%s,name=%s)=%s\n",qPrint(nd?nd->qualifiedName():""),qPrint(name),usingDef?qPrint(usingDef->qualifiedName()):"nullptr");
2371
2372 if (!usingDef)
2373 {
2374 usingDef = getClass(name); // try direct lookup, this is needed to get
2375 // builtin STL classes to properly resolve, e.g.
2376 // vector -> std::vector
2377 }
2378 if (!usingDef)
2379 {
2380 usingDef = Doxygen::hiddenClassLinkedMap->find(name); // check if it is already hidden
2381 }
2382#if 0
2383 if (!usingDef)
2384 {
2385 AUTO_TRACE_ADD("New using class '{}' (sec={})! #tArgLists={}",
2386 name,root->section,root->tArgLists.size());
2389 createClassDef( "<using>",1,1, name, ClassDef::Class)));
2390 if (usingCd)
2391 {
2392 usingCd->setArtificial(true);
2393 usingCd->setLanguage(root->lang);
2394 usingDef = usingCd;
2395 }
2396 }
2397#endif
2398 else
2399 {
2400 AUTO_TRACE_ADD("Found used type '{}' in scope='{}'",
2401 usingDef->name(), nd ? nd->name(): fd ? fd->name() : DString("<unknown>"));
2402 }
2403
2404 if (usingDef)
2405 {
2406 if (nd)
2407 {
2408 nd->addUsingDeclaration(usingDef);
2409 }
2410 else if (fd)
2411 {
2412 fd->addUsingDeclaration(usingDef);
2413 }
2414 }
2415 }
2416 }
2417 for (const auto &e : root->children()) findUsingDeclarations(e.get(),filterPythonPackages);
2418}
virtual void addUsingDeclaration(const Definition *d)=0
virtual void addUsingDeclaration(const Definition *d)=0
const Definition * resolveSymbol(const Definition *scope, const DString &name, const DString &args=DString(), bool checkCV=false, bool insideCode=false, bool onlyLinkable=false)
Find the symbool definition matching name within the scope set.
static void findUsingDeclarations(const Entry *root, bool filterPythonPackages)
Definition doxygen.cpp:2330

References FileDef::addUsingDeclaration(), NamespaceDefMutable::addUsingDeclaration(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::children(), ClassDef::Class, createClassDef(), DString::empty(), DString::endsWith(), Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findUsingDeclarations(), getClass(), getResolvedNamespaceMutable(), Doxygen::hiddenClassLinkedMap, EntryType::isCompound(), Entry::lang, Definition::name(), Entry::name, Entry::parent(), SymbolResolver::resolveSymbol(), Entry::section, DefinitionMutable::setArtificial(), DefinitionMutable::setLanguage(), Entry::startLine, substitute(), Entry::tArgLists, and toClassDefMutable().

Referenced by findUsingDeclarations(), and parseInput().

◆ findUsingDeclImports()

void findUsingDeclImports ( const Entry * root)
static

Definition at line 2483 of file doxygen.cpp.

2484{
2485 if (root->section.isUsingDecl() &&
2486 root->parent()->section.isCompound() // in a class/struct member
2487 )
2488 {
2489 AUTO_TRACE("Found using declaration '{}' inside section {}", root->name, root->parent()->section);
2490 DString fullName=removeRedundantWhiteSpace(root->parent()->name);
2491 fullName=stripAnonymousNamespaceScope(fullName);
2492 fullName=stripTemplateSpecifiersFromScope(fullName);
2493 ClassDefMutable *cd = getClassMutable(fullName);
2494 if (cd)
2495 {
2496 AUTO_TRACE_ADD("found class '{}'",cd->name());
2497 size_t i=root->name.rfind("::");
2498 if (i!=DString::npos)
2499 {
2500 DString scope=root->name.left(i);
2501 DString memName=root->name.mid(i+2);
2502 SymbolResolver resolver;
2503 const ClassDef *bcd = resolver.resolveClass(cd,scope); // todo: file in fileScope parameter
2504 AUTO_TRACE_ADD("name={} scope={} bcd={}",scope,cd?cd->name():"<none>",bcd?bcd->name():"<none>");
2505 if (bcd && bcd!=cd)
2506 {
2507 AUTO_TRACE_ADD("found class '{}' memName='{}'",bcd->name(),memName);
2509 const MemberNameInfo *mni = mnlm.find(memName);
2510 if (mni)
2511 {
2512 for (auto &mi : *mni)
2513 {
2514 const MemberDef *md = mi->memberDef();
2515 if (md && md->protection()!=Protection::Private)
2516 {
2517 AUTO_TRACE_ADD("found member '{}'",mni->memberName());
2518 DString fileName = root->fileName;
2519 if (fileName.empty() && root->tagInfo())
2520 {
2521 fileName = root->tagInfo()->tagName;
2522 }
2523 if (!cd->containsOverload(md))
2524 {
2525 createUsingMemberImportForClass(root,cd,md,fileName,memName);
2526 // also insert the member into copies of the class
2527 auto it = g_usingClassMap.find(cd->qualifiedName().str());
2528 if (it != g_usingClassMap.end())
2529 {
2530 for (const auto &copyCd : it->second)
2531 {
2532 createUsingMemberImportForClass(root,copyCd,md,fileName,memName);
2533 }
2534 }
2535 }
2536 }
2537 }
2538 }
2539 }
2540 }
2541 }
2542 }
2543 else if (root->section.isUsingDecl() &&
2544 (root->parent()->section.isNamespace() || root->parent()->section.isEmpty()) && // namespace or global member
2545 root->lang==SrcLangExt::Cpp // do we also want this for e.g. Fortran? (see test case 095)
2546 )
2547 {
2548 AUTO_TRACE("Found using declaration '{}' inside section {}", root->name, root->parent()->section);
2549 Definition *scope = nullptr;
2550 NamespaceDefMutable *nd = nullptr;
2551 FileDef *fd = root->parent()->fileDef();
2552 if (!root->parent()->name.empty())
2553 {
2554 DString fullName=removeRedundantWhiteSpace(root->parent()->name);
2555 fullName=stripAnonymousNamespaceScope(fullName);
2557 scope = nd;
2558 }
2559 else
2560 {
2561 scope = fd;
2562 }
2563 if (scope)
2564 {
2565 AUTO_TRACE_ADD("found scope '{}'",scope->name());
2566 SymbolResolver resolver;
2567 const Definition *def = resolver.resolveSymbol(root->name.startsWith("::") ? nullptr : scope,root->name);
2568 if (def && def->definitionType()==Definition::TypeMember)
2569 {
2570 size_t i=root->name.rfind("::");
2571 DString memName;
2572 if (i!=DString::npos)
2573 {
2574 memName = root->name.right(root->name.length()-i-2);
2575 }
2576 else
2577 {
2578 memName = root->name;
2579 }
2580 const MemberDef *md = toMemberDef(def);
2581 AUTO_TRACE_ADD("found member '{}' for name '{}'",md->qualifiedName(),root->name);
2582 DString fileName = root->fileName;
2583 if (fileName.empty() && root->tagInfo())
2584 {
2585 fileName = root->tagInfo()->tagName;
2586 }
2587 const ArgumentList &templAl = md->templateArguments();
2588 const ArgumentList &al = md->argumentList();
2589
2590 auto newMd = createMemberDef(
2591 fileName,root->startLine,root->startColumn,
2592 md->typeString(),memName,md->argsString(),
2593 md->excpString(),root->protection,root->virt,
2594 md->isStatic(),Relationship::Member,md->memberType(),
2595 templAl,al,root->metaData
2596 );
2597 auto newMmd = toMemberDefMutable(newMd.get());
2598 if (nd)
2599 {
2600 newMmd->setNamespace(nd);
2601 nd->insertMember(newMd.get());
2602 }
2603 if (fd)
2604 {
2605 newMmd->setFileDef(fd);
2606 fd->insertMember(newMd.get());
2607 }
2608 if (!root->doc.empty() || !root->brief.empty())
2609 {
2610 newMmd->setDocumentation(root->doc,root->docFile,root->docLine);
2611 newMmd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2612 newMmd->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
2613 }
2614 else
2615 {
2616 newMmd->setDocumentation(md->documentation(),md->docFile(),md->docLine());
2617 newMmd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine());
2618 newMmd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine());
2619 }
2620 newMmd->setDefinition(md->definition());
2621 applyMemberOverrideOptions(root,newMmd);
2622 newMmd->addQualifiers(root->qualifiers);
2623 newMmd->setBitfields(md->bitfieldString());
2624 newMmd->addSectionsToDefinition(root->anchors);
2625 newMmd->setBodySegment(md->getDefLine(),md->getStartBodyLine(),md->getEndBodyLine());
2626 newMmd->setBodyDef(md->getBodyDef());
2627 newMmd->setInitializer(md->initializer());
2628 newMmd->setRequiresClause(md->requiresClause());
2629 newMmd->setMaxInitLines(md->initializerLines());
2630 newMmd->setMemberGroupId(root->mGrpId);
2631 newMmd->setMemberSpecifiers(md->getMemberSpecifiers());
2632 newMmd->setVhdlSpecifiers(md->getVhdlSpecifiers());
2633 newMmd->setLanguage(root->lang);
2634 newMmd->setId(root->id);
2636 mn->push_back(std::move(newMd));
2637#if 0 // insert an alias instead of a copy
2638 const MemberDef *md = toMemberDef(def);
2639 AUTO_TRACE_ADD("found member '{}' for name '{}'",md->qualifiedName(),root->name);
2640 auto aliasMd = createMemberDefAlias(nd,md);
2641 DString aliasFullName = nd->qualifiedName()+"::"+aliasMd->localName();
2642 if (nd && aliasMd.get())
2643 {
2644 nd->insertMember(aliasMd.get());
2645 }
2646 if (fd && aliasMd.get())
2647 {
2648 fd->insertMember(aliasMd.get());
2649 }
2650 MemberName *mn = Doxygen::memberNameLinkedMap->add(aliasFullName);
2651 mn->push_back(std::move(aliasMd));
2652#endif
2653 }
2654 else if (def && def->definitionType()==Definition::TypeClass)
2655 {
2656 const ClassDef *cd = toClassDef(def);
2657 DString copyFullName;
2658 if (nd==nullptr)
2659 {
2660 copyFullName = cd->localName();
2661 }
2662 else
2663 {
2664 copyFullName = nd->qualifiedName()+"::"+cd->localName();
2665 }
2666 if (Doxygen::classLinkedMap->find(copyFullName)==nullptr)
2667 {
2669 Doxygen::classLinkedMap->add(copyFullName,
2670 cd->deepCopy(copyFullName)));
2671 AUTO_TRACE_ADD("found class '{}' for name '{}' copy '{}' obj={}",cd->qualifiedName(),root->name,copyFullName,(void*)ncdm);
2672 g_usingClassMap[cd->qualifiedName().str()].push_back(ncdm);
2673 if (ncdm)
2674 {
2675 if (nd) ncdm->moveTo(nd);
2676 if ((!root->doc.empty() || !root->brief.empty())) // use docs at using statement
2677 {
2678 ncdm->setDocumentation(root->doc,root->docFile,root->docLine);
2679 ncdm->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2680 }
2681 else // use docs from used class
2682 {
2683 ncdm->setDocumentation(cd->documentation(),cd->docFile(),cd->docLine());
2685 }
2686 if (nd)
2687 {
2688 nd->addInnerCompound(ncdm);
2689 nd->addUsingDeclaration(ncdm);
2690 }
2691 if (fd)
2692 {
2693 if (ncdm) ncdm->setFileDef(fd);
2694 fd->insertClass(ncdm);
2695 fd->addUsingDeclaration(ncdm);
2696 }
2697 }
2698 }
2699#if 0 // insert an alias instead of a copy
2700 auto aliasCd = createClassDefAlias(nd,cd);
2701 DString aliasFullName;
2702 if (nd==nullptr)
2703 {
2704 aliasFullName = aliasCd->localName();
2705 }
2706 else
2707 {
2708 aliasFullName = nd->qualifiedName()+"::"+aliasCd->localName();
2709 }
2710 AUTO_TRACE_ADD("found class '{}' for name '{}' aliasFullName='{}'",cd->qualifiedName(),root->name,aliasFullName);
2711 auto acd = Doxygen::classLinkedMap->add(aliasFullName,std::move(aliasCd));
2712 if (nd && acd)
2713 {
2714 nd->addInnerCompound(acd);
2715 }
2716 if (fd && acd)
2717 {
2718 fd->insertClass(acd);
2719 }
2720#endif
2721 }
2722 else if (scope)
2723 {
2724 AUTO_TRACE_ADD("no symbol with name '{}' in scope {}",root->name,scope->name());
2725 }
2726 }
2727 }
2728 for (const auto &e : root->children()) findUsingDeclImports(e.get());
2729}
virtual std::unique_ptr< ClassDef > deepCopy(const DString &name) const =0
virtual void moveTo(Definition *)=0
virtual bool containsOverload(const MemberDef *md) const =0
virtual const DString & localName() const =0
const ClassDef * resolveClass(const Definition *scope, const DString &name, bool maybeUnlinkable=false, bool mayBeHidden=false)
Find the class definition matching name within the scope set.
std::unique_ptr< ClassDef > createClassDefAlias(const Definition *newScope, const ClassDef *cd)
Definition classdef.cpp:817
static void findUsingDeclImports(const Entry *root)
Definition doxygen.cpp:2483
static void createUsingMemberImportForClass(const Entry *root, ClassDefMutable *cd, const MemberDef *md, const DString &fileName, const DString &memName)
Definition doxygen.cpp:2434
static std::unordered_map< std::string, std::vector< ClassDefMutable * > > g_usingClassMap
Definition doxygen.cpp:2481
std::unique_ptr< MemberDef > createMemberDefAlias(const Definition *newScope, const MemberDef *aliasMd)

References LinkedMap< T, Hash, KeyEqual, Map >::add(), DefinitionMutable::addInnerCompound(), FileDef::addUsingDeclaration(), NamespaceDefMutable::addUsingDeclaration(), Entry::anchors, applyMemberOverrideOptions(), MemberDef::argsString(), MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, MemberDef::bitfieldString(), Entry::brief, Definition::briefDescription(), Definition::briefFile(), Entry::briefFile, Definition::briefLine(), Entry::briefLine, Entry::children(), Doxygen::classLinkedMap, ClassDef::containsOverload(), createClassDefAlias(), createMemberDef(), createMemberDefAlias(), createUsingMemberImportForClass(), ClassDef::deepCopy(), MemberDef::definition(), Definition::definitionType(), Entry::doc, Definition::docFile(), Entry::docFile, Definition::docLine(), Entry::docLine, Definition::documentation(), DString::empty(), MemberDef::excpString(), Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findUsingDeclImports(), Doxygen::functionNameLinkedMap, g_usingClassMap, Definition::getBodyDef(), getClassMutable(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getMemberSpecifiers(), getResolvedNamespace(), Definition::getStartBodyLine(), MemberDef::getVhdlSpecifiers(), Entry::id, Entry::inbodyDocs, Definition::inbodyDocumentation(), Definition::inbodyFile(), Entry::inbodyFile, Definition::inbodyLine(), Entry::inbodyLine, MemberDef::initializer(), MemberDef::initializerLines(), FileDef::insertClass(), FileDef::insertMember(), NamespaceDefMutable::insertMember(), EntryType::isCompound(), MemberDef::isStatic(), Entry::lang, DString::left(), DString::length(), Definition::localName(), ClassDef::memberNameInfoLinkedMap(), Doxygen::memberNameLinkedMap, MemberDef::memberType(), Entry::metaData, Entry::mGrpId, DString::mid(), ClassDef::moveTo(), Definition::name(), Entry::name, DString::npos, Entry::parent(), Entry::protection, MemberDef::protection(), MemberName::push_back(), Definition::qualifiedName(), Entry::qualifiers, removeRedundantWhiteSpace(), MemberDef::requiresClause(), SymbolResolver::resolveClass(), SymbolResolver::resolveSymbol(), DString::rfind(), DString::right(), Entry::section, DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), ClassDefMutable::setFileDef(), Entry::startColumn, Entry::startLine, DString::startsWith(), DString::str(), stripAnonymousNamespaceScope(), stripTemplateSpecifiersFromScope(), Entry::tagInfo(), TagInfo::tagName, MemberDef::templateArguments(), toClassDef(), toClassDefMutable(), toMemberDef(), toMemberDefMutable(), toNamespaceDefMutable(), Definition::TypeClass, Definition::TypeMember, MemberDef::typeString(), and Entry::virt.

Referenced by findUsingDeclImports(), and parseInput().

◆ findUsingDirectives()

void findUsingDirectives ( const Entry * root)
static

Definition at line 2173 of file doxygen.cpp.

2174{
2175 if (root->section.isUsingDir())
2176 {
2177 AUTO_TRACE("Found using directive {} at line {} of {}",root->name,root->startLine,root->fileName);
2178 DString name=substitute(root->name,".","::");
2179 if (name.endsWith("::"))
2180 {
2181 name=name.left(name.length()-2);
2182 }
2183 if (!name.empty())
2184 {
2185 NamespaceDef *usingNd = nullptr;
2186 NamespaceDefMutable *nd = nullptr;
2187 FileDef *fd = root->fileDef();
2188 DString nsName;
2189
2190 // see if the using statement was found inside a namespace or inside
2191 // the global file scope.
2192 if (root->parent() && root->parent()->section.isNamespace() &&
2193 (fd==nullptr || fd->getLanguage()!=SrcLangExt::Java) // not a .java file
2194 )
2195 {
2196 nsName=stripAnonymousNamespaceScope(root->parent()->name);
2197 if (!nsName.empty())
2198 {
2199 nd = getResolvedNamespaceMutable(nsName);
2200 }
2201 }
2202
2203 // find the scope in which the 'using' namespace is defined by prepending
2204 // the possible scopes in which the using statement was found, starting
2205 // with the most inner scope and going to the most outer scope (i.e.
2206 // file scope).
2207 int scopeOffset = static_cast<int>(nsName.length());
2208 do
2209 {
2210 DString scope=scopeOffset>0 ?
2211 nsName.left(scopeOffset)+"::" : DString();
2212 usingNd = getResolvedNamespace(scope+name);
2213 //printf("Trying with scope='%s' usingNd=%p\n",(scope+qPrint(name)),usingNd);
2214 if (scopeOffset==0)
2215 {
2216 scopeOffset=-1;
2217 }
2218 else
2219 {
2220 size_t o = nsName.rfind("::",scopeOffset-1);
2221 scopeOffset = o!=DString::npos ? static_cast<int>(o) : 0;
2222 }
2223 } while (scopeOffset>=0 && usingNd==nullptr);
2224
2225 if (usingNd==nullptr && nd) // not found, try used namespaces in this scope
2226 // or in one of the parent namespace scopes
2227 {
2228 const NamespaceDefMutable *pnd = nd;
2229 while (pnd && usingNd==nullptr)
2230 {
2231 // also try with one of the used namespaces found earlier
2233
2234 // goto the parent
2235 Definition *s = pnd->getOuterScope();
2237 {
2239 }
2240 else
2241 {
2242 pnd = nullptr;
2243 }
2244 }
2245 }
2246 if (usingNd==nullptr && fd) // still nothing, also try used namespace in the
2247 // global scope
2248 {
2249 usingNd = findUsedNamespace(fd->getUsedNamespaces(),name);
2250 }
2251
2252 //printf("%s -> %s\n",qPrint(name),usingNd?qPrint(usingNd->name()):"<none>");
2253
2254 // add the namespace the correct scope
2255 if (usingNd)
2256 {
2257 //printf("using fd=%p nd=%p\n",fd,nd);
2258 if (nd)
2259 {
2260 //printf("Inside namespace %s\n",qPrint(nd->name()));
2261 nd->addUsingDirective(usingNd);
2262 }
2263 else if (fd)
2264 {
2265 //printf("Inside file %s\n",qPrint(fd->name()));
2266 fd->addUsingDirective(usingNd);
2267 }
2268 }
2269 else // unknown namespace, but add it anyway.
2270 {
2271 AUTO_TRACE_ADD("new unknown namespace {} lang={} hidden={}",name,root->lang,root->hidden);
2272 // add namespace to the list
2275 createNamespaceDef(root->fileName,root->startLine,root->startColumn,name)));
2276 if (nd)
2277 {
2278 nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
2279 nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2281 nd->setHidden(root->hidden);
2282 nd->setArtificial(true);
2283 nd->setLanguage(root->lang);
2284 nd->setId(root->id);
2285 nd->setMetaData(root->metaData);
2286 nd->setInline(root->spec.isInline());
2287 nd->setExported(root->exported);
2288
2289 for (const Grouping &g : root->groups)
2290 {
2291 GroupDef *gd=nullptr;
2293 gd->addNamespace(nd);
2294 }
2295
2296 // insert the namespace in the file definition
2297 if (fd)
2298 {
2299 fd->insertNamespace(nd);
2300 fd->addUsingDirective(nd);
2301 }
2302
2303 // the empty string test is needed for extract all case
2304 nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
2305 nd->insertUsedFile(fd);
2306 nd->setRefItems(root->sli);
2307 nd->setRequirementReferences(root->rqli);
2308 }
2309 }
2310 }
2311 }
2312 for (const auto &e : root->children()) findUsingDirectives(e.get());
2313}
virtual void addUsingDirective(NamespaceDef *nd)=0
virtual bool addNamespace(NamespaceDef *def)=0
virtual const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const =0
virtual void addUsingDirective(NamespaceDef *nd)=0
static NamespaceDef * findUsedNamespace(const LinkedRefMap< NamespaceDef > &unl, const DString &name)
Definition doxygen.cpp:2160
static void findUsingDirectives(const Entry *root)
Definition doxygen.cpp:2173

References GroupDef::addNamespace(), DefinitionMutable::addSectionsToDefinition(), FileDef::addUsingDirective(), NamespaceDefMutable::addUsingDirective(), Entry::anchors, AUTO_TRACE, AUTO_TRACE_ADD, Entry::brief, Entry::briefFile, Entry::briefLine, Entry::children(), createNamespaceDef(), Definition::definitionType(), Entry::doc, Entry::docFile, Entry::docLine, DString::empty(), Entry::exported, Entry::fileDef(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), findUsedNamespace(), findUsingDirectives(), Definition::getLanguage(), Definition::getOuterScope(), getResolvedNamespace(), getResolvedNamespaceMutable(), FileDef::getUsedNamespaces(), NamespaceDef::getUsedNamespaces(), Doxygen::groupLinkedMap, Grouping::groupname, Entry::groups, Entry::hidden, Entry::id, FileDef::insertNamespace(), NamespaceDefMutable::insertUsedFile(), Entry::lang, DString::left(), DString::length(), Entry::metaData, Entry::name, Doxygen::namespaceLinkedMap, DString::npos, Entry::parent(), DString::rfind(), Entry::rqli, Entry::section, DefinitionMutable::setArtificial(), DefinitionMutable::setBriefDescription(), DefinitionMutable::setDocumentation(), DefinitionMutable::setExported(), DefinitionMutable::setHidden(), DefinitionMutable::setId(), NamespaceDefMutable::setInline(), DefinitionMutable::setLanguage(), NamespaceDefMutable::setMetaData(), DefinitionMutable::setRefItems(), DefinitionMutable::setRequirementReferences(), Entry::sli, Entry::spec, Entry::startColumn, Entry::startLine, stripAnonymousNamespaceScope(), substitute(), toNamespaceDef(), toNamespaceDefMutable(), and Definition::TypeNamespace.

Referenced by findUsingDirectives(), and parseInput().

◆ flushCachedTemplateRelations()

void flushCachedTemplateRelations ( )
static

Definition at line 9877 of file doxygen.cpp.

9878{
9879 // remove all references to classes from the cache
9880 // as there can be new template instances in the inheritance path
9881 // to this class. Optimization: only remove those classes that
9882 // have inheritance instances as direct or indirect sub classes.
9884
9885 // remove all cached typedef resolutions whose target is a
9886 // template class as this may now be a template instance
9887 // for each global function name
9888 for (const auto &fn : *Doxygen::functionNameLinkedMap)
9889 {
9890 // for each function with that name
9891 for (const auto &ifmd : *fn)
9892 {
9893 MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
9894 if (fmd && fmd->isTypedefValCached())
9895 {
9896 const ClassDef *cd = fmd->getCachedTypedefVal();
9897 if (cd->isTemplate()) fmd->invalidateTypedefValCache();
9898 }
9899 }
9900 }
9901 // for each class method name
9902 for (const auto &nm : *Doxygen::memberNameLinkedMap)
9903 {
9904 // for each function with that name
9905 for (const auto &imd : *nm)
9906 {
9907 MemberDefMutable *md = toMemberDefMutable(imd.get());
9908 if (md && md->isTypedefValCached())
9909 {
9910 const ClassDef *cd = md->getCachedTypedefVal();
9911 if (cd->isTemplate()) md->invalidateTypedefValCache();
9912 }
9913 }
9914 }
9915}
virtual bool isTemplate() const =0
Returns true if this class is a template.
virtual const ClassDef * getCachedTypedefVal() const =0
virtual bool isTypedefValCached() const =0
virtual void invalidateTypedefValCache()=0
static void clearTypeLookupCache(ClearScope scope)

References SymbolResolver::Classes, SymbolResolver::clearTypeLookupCache(), Doxygen::functionNameLinkedMap, MemberDef::getCachedTypedefVal(), MemberDefMutable::invalidateTypedefValCache(), ClassDef::isTemplate(), MemberDef::isTypedefValCached(), Doxygen::memberNameLinkedMap, and toMemberDefMutable().

Referenced by parseInput().

◆ flushUnresolvedRelations()

void flushUnresolvedRelations ( )
static

Definition at line 9919 of file doxygen.cpp.

9920{
9921 // Remove all unresolved references to classes from the cache.
9922 // This is needed before resolving the inheritance relations, since
9923 // it would otherwise not find the inheritance relation
9924 // for C in the example below, as B::I was already found to be unresolvable
9925 // (which is correct if you ignore the inheritance relation between A and B).
9926 //
9927 // class A { class I {} };
9928 // class B : public A {};
9929 // class C : public B::I {};
9931
9932 // for each class method name
9933 for (const auto &nm : *Doxygen::memberNameLinkedMap)
9934 {
9935 // for each function with that name
9936 for (const auto &imd : *nm)
9937 {
9938 MemberDefMutable *md = toMemberDefMutable(imd.get());
9939 if (md)
9940 {
9942 }
9943 }
9944 }
9945
9946}
virtual void invalidateCachedArgumentTypes()=0

References SymbolResolver::clearTypeLookupCache(), MemberDefMutable::invalidateCachedArgumentTypes(), Doxygen::memberNameLinkedMap, toMemberDefMutable(), and SymbolResolver::Unresolved.

Referenced by parseInput().

◆ g_pathsVisited()

StringUnorderedSet g_pathsVisited ( 1009 )
static

Referenced by readDir(), and readFileOrDirectory().

◆ generateClassDocs()

void generateClassDocs ( )
static

Definition at line 9635 of file doxygen.cpp.

9636{
9637 std::vector<ClassDefMutable*> classList;
9638 for (const auto &cdi : *Doxygen::classLinkedMap)
9639 {
9640 ClassDefMutable *cd = toClassDefMutable(cdi.get());
9641 if (cd && (cd->getOuterScope()==nullptr ||
9643 {
9644 addClassAndNestedClasses(classList,cd);
9645 }
9646 }
9647 for (const auto &cdi : *Doxygen::hiddenClassLinkedMap)
9648 {
9649 ClassDefMutable *cd = toClassDefMutable(cdi.get());
9650 if (cd && (cd->getOuterScope()==nullptr ||
9652 {
9653 addClassAndNestedClasses(classList,cd);
9654 }
9655 }
9656 generateDocsForClassList(classList);
9657}
static void generateDocsForClassList(const std::vector< ClassDefMutable * > &classList)
Definition doxygen.cpp:9537

References addClassAndNestedClasses(), Doxygen::classLinkedMap, Definition::definitionType(), generateDocsForClassList(), Definition::getOuterScope(), Doxygen::hiddenClassLinkedMap, toClassDefMutable(), and Definition::TypeClass.

Referenced by generateOutput().

◆ generateConceptDocs()

void generateConceptDocs ( )
static

Definition at line 9661 of file doxygen.cpp.

9662{
9663 for (const auto &cdi : *Doxygen::conceptLinkedMap)
9664 {
9666
9667 //printf("cd=%s getOuterScope=%p global=%p\n",qPrint(cd->name()),cd->getOuterScope(),Doxygen::globalScope);
9668 if (cd &&
9669 (cd->getOuterScope()==nullptr || // <-- should not happen, but can if we read an old tag file
9670 cd->getOuterScope()==Doxygen::globalScope // only look at global concepts
9671 ) && !cd->isHidden() && cd->isLinkableInProject()
9672 )
9673 {
9674 msg("Generating docs for concept {}...\n",cd->displayName());
9676 }
9677 }
9678}
virtual void writeDocumentation(OutputList &ol)=0
virtual DString displayName(bool includeScope=true) const =0
virtual bool isHidden() const =0

References Doxygen::conceptLinkedMap, Definition::displayName(), g_outputList, Definition::getOuterScope(), Doxygen::globalScope, Definition::isHidden(), Definition::isLinkableInProject(), msg, toConceptDefMutable(), and ConceptDefMutable::writeDocumentation().

Referenced by generateOutput().

◆ generateConfigFile()

void generateConfigFile ( const DString & configFile,
bool shortList,
bool updateOnly = false )
static

Generate a template version of the configuration file. If the shortList parameter is true a configuration file without comments will be generated.

Definition at line 10758 of file doxygen.cpp.

10760{
10761 std::ofstream f;
10762 bool fileOpened=openOutputFile(configFile,f);
10763 bool writeToStdout=configFile=="-";
10764 if (fileOpened)
10765 {
10766 TextStream t(&f);
10767 Config::writeTemplate(t,shortList,updateOnly);
10768 if (!writeToStdout)
10769 {
10770 if (!updateOnly)
10771 {
10772 msg("\n\nConfiguration file '{}' created.\n\n",configFile);
10773 msg("Now edit the configuration file and enter\n\n");
10774 if (configFile!="Doxyfile" && configFile!="doxyfile")
10775 msg(" doxygen {}\n\n",configFile);
10776 else
10777 msg(" doxygen\n\n");
10778 msg("to generate the documentation for your project\n\n");
10779 }
10780 else
10781 {
10782 msg("\n\nConfiguration file '{}' updated.\n\n",configFile);
10783 }
10784 }
10785 }
10786 else
10787 {
10788 term("Cannot open file {} for writing\n",configFile);
10789 }
10790}
void writeTemplate(TextStream &t, bool shortList, bool updateOnly=false)

References msg, openOutputFile(), term, and Config::writeTemplate().

Referenced by readConfiguration().

◆ generateDiskNames()

void generateDiskNames ( )
static

Definition at line 11012 of file doxygen.cpp.

11013{
11014 for (const auto &fn : *Doxygen::inputNameLinkedMap)
11015 {
11016 struct FileEntry
11017 {
11018 FileEntry(const DString &p,FileDef *fd) : path(p), fileDef(fd) {}
11019 DString path;
11020 FileDef *fileDef;
11021 };
11022
11023 // collect the entry for which to compute the longest common prefix (LCP) of the path
11024 std::vector<FileEntry> fileEntries;
11025 for (const auto &fd : *fn)
11026 {
11027 if (!fd->isReference()) // skip external references
11028 {
11029 fileEntries.emplace_back(fd->getPath(),fd.get());
11030 }
11031 }
11032
11033 size_t size = fileEntries.size();
11034
11035 if (size==1) // name if unique, so diskname is simply the name
11036 {
11037 FileDef *fd = fileEntries[0].fileDef;
11038 fd->setDiskName(fn->fileName());
11039 }
11040 else if (size>1) // multiple occurrences of the same file name
11041 {
11042 // sort the array
11043 std::stable_sort(fileEntries.begin(),
11044 fileEntries.end(),
11045 [](const FileEntry &fe1,const FileEntry &fe2)
11046 { return dstricmp_sort(fe1.path,fe2.path)<0; }
11047 );
11048
11049 // since the entries are sorted, the common prefix of the whole array is same
11050 // as the common prefix between the first and last entry
11051 const FileEntry &first = fileEntries[0];
11052 const FileEntry &last = fileEntries[size-1];
11053 int first_path_size = static_cast<int>(first.path.size())-1; // -1 to skip trailing slash
11054 int last_path_size = static_cast<int>(last.path.size())-1; // -1 to skip trailing slash
11055 int j=0;
11056 int i=0;
11057 for (i=0;i<first_path_size && i<last_path_size;i++)
11058 {
11059 if (first.path[i]=='/') j=i;
11060 if (first.path[i]!=last.path[i]) break;
11061 }
11062 if (i==first_path_size && i<last_path_size && last.path[i]=='/')
11063 {
11064 // case first='some/path' and last='some/path/more' => match is 'some/path'
11065 j=first_path_size;
11066 }
11067 else if (i==last_path_size && i<first_path_size && first.path[i]=='/')
11068 {
11069 // case first='some/path/more' and last='some/path' => match is 'some/path'
11070 j=last_path_size;
11071 }
11072
11073 // add non-common part of the path to the name
11074 for (auto &fileEntry : fileEntries)
11075 {
11076 DString prefix = fileEntry.path.right(fileEntry.path.length()-j-1);
11077 fileEntry.fileDef->setName(prefix+fn->fileName());
11078 //printf("!!!!!!!! non unique disk name=%s:%s\n",qPrint(prefix),fn->fileName());
11079 fileEntry.fileDef->setDiskName(prefix+fn->fileName());
11080 }
11081 }
11082 }
11083}
constexpr auto prefix
Definition anchor.cpp:47
virtual void setDiskName(const DString &name)=0

References Doxygen::inputNameLinkedMap, prefix, and FileDef::setDiskName().

Referenced by parseInput().

◆ generateDocsForClassList()

void generateDocsForClassList ( const std::vector< ClassDefMutable * > & classList)
static

Definition at line 9537 of file doxygen.cpp.

9538{
9539 AUTO_TRACE();
9540 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9541 if (numThreads>1) // multi threaded processing
9542 {
9543 struct DocContext
9544 {
9545 DocContext(ClassDefMutable *cd_,const OutputList &ol_)
9546 : cd(cd_), ol(ol_) {}
9547 ClassDefMutable *cd;
9548 OutputList ol;
9549 };
9550 ThreadPool threadPool(numThreads);
9551 std::vector< std::future< std::shared_ptr<DocContext> > > results;
9552 for (const auto &cd : classList)
9553 {
9554 //printf("cd=%s getOuterScope=%p global=%p\n",qPrint(cd->name()),cd->getOuterScope(),Doxygen::globalScope);
9555 if (cd->getOuterScope()==nullptr || // <-- should not happen, but can if we read an old tag file
9556 cd->getOuterScope()==Doxygen::globalScope // only look at global classes
9557 )
9558 {
9559 auto ctx = std::make_shared<DocContext>(cd,*g_outputList);
9560 auto processFile = [ctx]()
9561 {
9562 msg("Generating docs for compound {}...\n",ctx->cd->displayName());
9563
9564 // skip external references, anonymous compounds and
9565 // template instances
9566 if (!ctx->cd->isHidden() && !ctx->cd->isEmbeddedInOuterScope() &&
9567 ctx->cd->isLinkableInProject() && !ctx->cd->isImplicitTemplateInstance())
9568 {
9569 ctx->cd->writeDocumentation(ctx->ol);
9570 ctx->cd->writeMemberList(ctx->ol);
9571 }
9572
9573 // even for undocumented classes, the inner classes can be documented.
9574 ctx->cd->writeDocumentationForInnerClasses(ctx->ol);
9575 return ctx;
9576 };
9577 results.emplace_back(threadPool.queue(processFile));
9578 }
9579 }
9580 for (auto &f : results)
9581 {
9582 auto ctx = f.get();
9583 }
9584 }
9585 else // single threaded processing
9586 {
9587 for (const auto &cd : classList)
9588 {
9589 //printf("cd=%s getOuterScope=%p global=%p hidden=%d embeddedInOuterScope=%d\n",
9590 // qPrint(cd->name()),cd->getOuterScope(),Doxygen::globalScope,cd->isHidden(),cd->isEmbeddedInOuterScope());
9591 if (cd->getOuterScope()==nullptr || // <-- should not happen, but can if we read an old tag file
9592 cd->getOuterScope()==Doxygen::globalScope // only look at global classes
9593 )
9594 {
9595 // skip external references, anonymous compounds and
9596 // template instances
9597 if ( !cd->isHidden() && !cd->isEmbeddedInOuterScope() &&
9598 cd->isLinkableInProject() && !cd->isImplicitTemplateInstance())
9599 {
9600 msg("Generating docs for compound {}...\n",cd->displayName());
9601
9602 cd->writeDocumentation(*g_outputList);
9603 cd->writeMemberList(*g_outputList);
9604 }
9605 // even for undocumented classes, the inner classes can be documented.
9606 cd->writeDocumentationForInnerClasses(*g_outputList);
9607 }
9608 }
9609 }
9610}

References AUTO_TRACE, Config_getInt, g_outputList, Doxygen::globalScope, msg, and ThreadPool::queue().

Referenced by generateClassDocs().

◆ generateExampleDocs()

void generateExampleDocs ( )
static

Definition at line 10461 of file doxygen.cpp.

10462{
10464 for (const auto &pd : *Doxygen::exampleLinkedMap)
10465 {
10466 msg("Generating docs for example {}...\n",pd->name());
10467 SrcLangExt lang = getLanguageFromFileName(pd->name(), SrcLangExt::Unknown);
10468 if (lang != SrcLangExt::Unknown)
10469 {
10470 DString ext = getFileNameExtension(pd->name());
10471 auto intf = Doxygen::parserManager->getCodeParser(ext);
10472 intf->resetCodeParserState();
10473 }
10474 DString n=pd->getOutputFileBase();
10475 startFile(*g_outputList,n,false,n,pd->name());
10477 g_outputList->docify(pd->name());
10480 DString lineNoOptStr;
10481 if (pd->showLineNo())
10482 {
10483 lineNoOptStr="{lineno}";
10484 }
10485 g_outputList->generateDoc(pd->docFile(), // file
10486 pd->docLine(), // startLine
10487 pd.get(), // context
10488 nullptr, // memberDef
10489 (pd->briefDescription().empty()?"":pd->briefDescription()+"\n\n")+
10490 pd->documentation()+"\n\n\\include"+lineNoOptStr+" "+pd->name(), // docs
10491 DocOptions()
10492 .setIndexWords(true)
10493 .setExample(pd->name()));
10494 endFile(*g_outputList); // contains g_outputList->endContents()
10495 }
10497}
void disable(OutputType o)
void enable(OutputType o)
void docify(const DString &s)
Definition outputlist.h:433
void generateDoc(const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &docStr, const DocOptions &options)
void startContents()
Definition outputlist.h:614
std::unique_ptr< CodeParserInterface > getCodeParser(const DString &extension)
Gets the interface to the parser associated with a given extension.
Definition parserintf.h:253
void endTitle(OutputList &ol, const DString &fileName, const DString &name)
Definition index.cpp:404
void endFile(OutputList &ol, bool skipNavIndex, bool skipEndContents, const DString &navPath)
Definition index.cpp:437
void startTitle(OutputList &ol, const DString &fileName, const DefinitionMutable *def)
Definition index.cpp:394
void startFile(OutputList &ol, const DString &name, bool isSource, const DString &manName, const DString &title, HighlightedItem hli, bool additionalIndices, const DString &altSidebarName, int hierarchyLevel, const DString &allMembersFile)
Definition index.cpp:411
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
DString getFileNameExtension(const DString &fn)
Definition util.cpp:4342
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4300

References OutputList::disable(), OutputList::docify(), OutputList::enable(), endFile(), endTitle(), Doxygen::exampleLinkedMap, g_outputList, OutputList::generateDoc(), ParserManager::getCodeParser(), getFileNameExtension(), getLanguageFromFileName(), Man, msg, Doxygen::parserManager, OutputList::startContents(), startFile(), and startTitle().

Referenced by generateOutput().

◆ generateFileDocs()

void generateFileDocs ( )
static

Definition at line 9200 of file doxygen.cpp.

9201{
9202 if (Index::instance().numDocumentedFiles()==0) return;
9203
9204 if (!Doxygen::inputNameLinkedMap->empty())
9205 {
9206 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9207 if (numThreads>1) // multi threaded processing
9208 {
9209 struct DocContext
9210 {
9211 DocContext(FileDef *fd_,const OutputList &ol_)
9212 : fd(fd_), ol(ol_) {}
9213 FileDef *fd;
9214 OutputList ol;
9215 };
9216 ThreadPool threadPool(numThreads);
9217 std::vector< std::future< std::shared_ptr<DocContext> > > results;
9218 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9219 {
9220 for (const auto &fd : *fn)
9221 {
9222 bool doc = fd->isLinkableInProject();
9223 if (doc)
9224 {
9225 auto ctx = std::make_shared<DocContext>(fd.get(),*g_outputList);
9226 auto processFile = [ctx]() {
9227 msg("Generating docs for file {}...\n",ctx->fd->docName());
9228 ctx->fd->writeDocumentation(ctx->ol);
9229 return ctx;
9230 };
9231 results.emplace_back(threadPool.queue(processFile));
9232 }
9233 }
9234 }
9235 for (auto &f : results)
9236 {
9237 auto ctx = f.get();
9238 }
9239 }
9240 else // single threaded processing
9241 {
9242 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9243 {
9244 for (const auto &fd : *fn)
9245 {
9246 bool doc = fd->isLinkableInProject();
9247 if (doc)
9248 {
9249 msg("Generating docs for file {}...\n",fd->docName());
9250 fd->writeDocumentation(*g_outputList);
9251 }
9252 }
9253 }
9254 }
9255 }
9256}

References Config_getInt, g_outputList, Doxygen::inputNameLinkedMap, Index::instance(), msg, and ThreadPool::queue().

Referenced by generateOutput().

◆ generateFileSources()

void generateFileSources ( )
static

Definition at line 9030 of file doxygen.cpp.

9031{
9032 auto processSourceFile = [](FileDef *fd,OutputList &ol,ClangTUParser *parser)
9033 {
9034 bool showSources = fd->generateSourceFile() && !Htags::useHtags; // sources need to be shown in the output
9035 bool parseSources = !fd->isReference() && Doxygen::parseSourcesNeeded; // we needed to parse the sources even if we do not show them
9036 if (showSources)
9037 {
9038 msg("Generating code for file {}...\n",fd->docName());
9039 fd->writeSourceHeader(ol);
9040 fd->writeSourceBody(ol,parser);
9041 fd->writeSourceFooter(ol);
9042 }
9043 else if (parseSources)
9044 {
9045 msg("Parsing code for file {}...\n",fd->docName());
9046 fd->parseSource(parser);
9047 }
9048 };
9049 if (!Doxygen::inputNameLinkedMap->empty())
9050 {
9051#if USE_LIBCLANG
9053 {
9054 StringUnorderedSet processedFiles;
9055
9056 // create a dictionary with files to process
9057 StringUnorderedSet filesToProcess;
9058
9059 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9060 {
9061 for (const auto &fd : *fn)
9062 {
9063 filesToProcess.insert(fd->absFilePath().str());
9064 }
9065 }
9066 // process source files (and their include dependencies)
9067 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9068 {
9069 for (const auto &fd : *fn)
9070 {
9071 if (fd->isSource() && !fd->isReference() && fd->getLanguage()==SrcLangExt::Cpp &&
9072 (fd->generateSourceFile() ||
9074 )
9075 )
9076 {
9077 auto clangParser = ClangParser::instance()->createTUParser(fd.get());
9078 clangParser->parse();
9079 processSourceFile(fd.get(),*g_outputList,clangParser.get());
9080
9081 for (auto incFile : clangParser->filesInSameTU())
9082 {
9083 if (filesToProcess.find(incFile)!=filesToProcess.end() && // part of input
9084 fd->absFilePath()!=incFile && // not same file
9085 processedFiles.find(incFile)==processedFiles.end()) // not yet marked as processed
9086 {
9087 StringVector moreFiles;
9088 bool ambig = false;
9089 FileDef *ifd=Doxygen::inputNameLinkedMap->findFileDef(incFile,ambig);
9090 if (ifd && !ifd->isReference())
9091 {
9092 processSourceFile(ifd,*g_outputList,clangParser.get());
9093 processedFiles.insert(incFile);
9094 }
9095 }
9096 }
9097 processedFiles.insert(fd->absFilePath().str());
9098 }
9099 }
9100 }
9101 // process remaining files
9102 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9103 {
9104 for (const auto &fd : *fn)
9105 {
9106 if (processedFiles.find(fd->absFilePath().str())==processedFiles.end()) // not yet processed
9107 {
9108 if (fd->isReference())
9109 {
9110 processedFiles.insert(fd->absFilePath().str());
9111 }
9112 else if (fd->getLanguage()==SrcLangExt::Cpp) // C/C++ file, use clang parser
9113 {
9114 auto clangParser = ClangParser::instance()->createTUParser(fd.get());
9115 clangParser->parse();
9116 processSourceFile(fd.get(),*g_outputList,clangParser.get());
9117 }
9118 else // non C/C++ file, use built-in parser
9119 {
9120 processSourceFile(fd.get(),*g_outputList,nullptr);
9121 }
9122 }
9123 }
9124 }
9125 }
9126 else
9127#endif
9128 {
9129 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9130 if (numThreads>1)
9131 {
9132 msg("Generating code files using {} threads.\n",numThreads);
9133 struct SourceContext
9134 {
9135 SourceContext(FileDef *fd_,bool gen_,const OutputList &ol_)
9136 : fd(fd_), generateSourceFile(gen_), ol(ol_) {}
9137 FileDef *fd;
9138 bool generateSourceFile;
9139 OutputList ol;
9140 };
9141 ThreadPool threadPool(numThreads);
9142 std::vector< std::future< std::shared_ptr<SourceContext> > > results;
9143 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9144 {
9145 for (const auto &fd : *fn)
9146 {
9147 bool generateSourceFile = fd->generateSourceFile() && !Htags::useHtags;
9148 auto ctx = std::make_shared<SourceContext>(fd.get(),generateSourceFile,*g_outputList);
9149 auto processFile = [ctx]()
9150 {
9151 if (ctx->generateSourceFile)
9152 {
9153 msg("Generating code for file {}...\n",ctx->fd->docName());
9154 }
9155 else
9156 {
9157 msg("Parsing code for file {}...\n",ctx->fd->docName());
9158 }
9159 StringVector filesInSameTu;
9160 ctx->fd->getAllIncludeFilesRecursively(filesInSameTu);
9161 if (ctx->generateSourceFile) // sources need to be shown in the output
9162 {
9163 ctx->fd->writeSourceHeader(ctx->ol);
9164 ctx->fd->writeSourceBody(ctx->ol,nullptr);
9165 ctx->fd->writeSourceFooter(ctx->ol);
9166 }
9167 else if (!ctx->fd->isReference() && Doxygen::parseSourcesNeeded)
9168 // we needed to parse the sources even if we do not show them
9169 {
9170 ctx->fd->parseSource(nullptr);
9171 }
9172 return ctx;
9173 };
9174 results.emplace_back(threadPool.queue(processFile));
9175 }
9176 }
9177 for (auto &f : results)
9178 {
9179 auto ctx = f.get();
9180 }
9181 }
9182 else // single threaded version
9183 {
9184 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9185 {
9186 for (const auto &fd : *fn)
9187 {
9188 StringVector filesInSameTu;
9189 fd->getAllIncludeFilesRecursively(filesInSameTu);
9190 processSourceFile(fd.get(),*g_outputList,nullptr);
9191 }
9192 }
9193 }
9194 }
9195 }
9196}
std::unique_ptr< ClangTUParser > createTUParser(const FileDef *fd) const
static ClangParser * instance()
Returns the one and only instance of the class.
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition clangparser.h:25
static bool clangAssistedParsing
Definition doxygen.h:129
virtual void writeSourceHeader(OutputList &ol)=0
virtual const DString & docName() const =0
virtual bool isSource() const =0
virtual void parseSource(ClangTUParser *clangParser)=0
virtual void getAllIncludeFilesRecursively(StringVector &incFiles) const =0
virtual void writeSourceFooter(OutputList &ol)=0
virtual void writeSourceBody(OutputList &ol, ClangTUParser *clangParser)=0
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:311
std::unordered_set< std::string > StringUnorderedSet
Definition containers.h:29
static bool useHtags
Definition htags.h:23

References FileDef::absFilePath(), Doxygen::clangAssistedParsing, Config_getInt, ClangParser::createTUParser(), FileDef::docName(), DString::find(), FileNameLinkedMap::findFileDef(), g_outputList, FileDef::generateSourceFile(), FileDef::getAllIncludeFilesRecursively(), Definition::getLanguage(), Doxygen::inputNameLinkedMap, ClangParser::instance(), Definition::isReference(), FileDef::isSource(), msg, FileDef::parseSource(), Doxygen::parseSourcesNeeded, ThreadPool::queue(), DString::str(), Htags::useHtags, FileDef::writeSourceBody(), FileDef::writeSourceFooter(), and FileDef::writeSourceHeader().

Referenced by generateOutput().

◆ generateGroupDocs()

void generateGroupDocs ( )
static

Definition at line 10502 of file doxygen.cpp.

10503{
10504 for (const auto &gd : *Doxygen::groupLinkedMap)
10505 {
10506 if (!gd->isReference())
10507 {
10508 gd->writeDocumentation(*g_outputList);
10509 }
10510 }
10511}

References g_outputList, and Doxygen::groupLinkedMap.

Referenced by generateOutput().

◆ generateNamespaceClassDocs()

void generateNamespaceClassDocs ( const ClassLinkedRefMap & classList)
static

Definition at line 10516 of file doxygen.cpp.

10517{
10518 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
10519 if (numThreads>1) // multi threaded processing
10520 {
10521 struct DocContext
10522 {
10523 DocContext(ClassDefMutable *cdm_,const OutputList &ol_)
10524 : cdm(cdm_), ol(ol_) {}
10525 ClassDefMutable *cdm;
10526 OutputList ol;
10527 };
10528 ThreadPool threadPool(numThreads);
10529 std::vector< std::future< std::shared_ptr<DocContext> > > results;
10530 // for each class in the namespace...
10531 for (const auto &cd : classList)
10532 {
10534 if (cdm)
10535 {
10536 auto ctx = std::make_shared<DocContext>(cdm,*g_outputList);
10537 auto processFile = [ctx]()
10538 {
10539 if ( ( ctx->cdm->isLinkableInProject() &&
10540 !ctx->cdm->isImplicitTemplateInstance()
10541 ) // skip external references, anonymous compounds and
10542 // template instances and nested classes
10543 && !ctx->cdm->isHidden() && !ctx->cdm->isEmbeddedInOuterScope()
10544 )
10545 {
10546 msg("Generating docs for compound {}...\n",ctx->cdm->displayName());
10547 ctx->cdm->writeDocumentation(ctx->ol);
10548 ctx->cdm->writeMemberList(ctx->ol);
10549 }
10550 ctx->cdm->writeDocumentationForInnerClasses(ctx->ol);
10551 return ctx;
10552 };
10553 results.emplace_back(threadPool.queue(processFile));
10554 }
10555 }
10556 // wait for the results
10557 for (auto &f : results)
10558 {
10559 auto ctx = f.get();
10560 }
10561 }
10562 else // single threaded processing
10563 {
10564 // for each class in the namespace...
10565 for (const auto &cd : classList)
10566 {
10568 if (cdm)
10569 {
10570 if ( ( cd->isLinkableInProject() &&
10571 !cd->isImplicitTemplateInstance()
10572 ) // skip external references, anonymous compounds and
10573 // template instances and nested classes
10574 && !cd->isHidden() && !cd->isEmbeddedInOuterScope()
10575 )
10576 {
10577 msg("Generating docs for compound {}...\n",cd->displayName());
10578
10581 }
10583 }
10584 }
10585 }
10586}
virtual void writeDocumentation(OutputList &ol) const =0
virtual void writeMemberList(OutputList &ol) const =0
virtual void writeDocumentationForInnerClasses(OutputList &ol) const =0

References Config_getInt, g_outputList, msg, ThreadPool::queue(), toClassDefMutable(), ClassDef::writeDocumentation(), ClassDef::writeDocumentationForInnerClasses(), and ClassDef::writeMemberList().

Referenced by generateNamespaceDocs().

◆ generateNamespaceConceptDocs()

void generateNamespaceConceptDocs ( const ConceptLinkedRefMap & conceptList)
static

Definition at line 10588 of file doxygen.cpp.

10589{
10590 // for each concept in the namespace...
10591 for (const auto &cd : conceptList)
10592 {
10594 if ( cdm && cd->isLinkableInProject() && !cd->isHidden())
10595 {
10596 msg("Generating docs for concept {}...\n",cd->name());
10598 }
10599 }
10600}

References g_outputList, Definition::isLinkableInProject(), msg, toConceptDefMutable(), and ConceptDefMutable::writeDocumentation().

Referenced by generateNamespaceDocs().

◆ generateNamespaceDocs()

void generateNamespaceDocs ( )
static

Definition at line 10602 of file doxygen.cpp.

10603{
10604 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
10605
10606 //writeNamespaceIndex(*g_outputList);
10607
10608 // for each namespace...
10609 for (const auto &nd : *Doxygen::namespaceLinkedMap)
10610 {
10611 if (nd->isLinkableInProject())
10612 {
10614 if (ndm)
10615 {
10616 msg("Generating docs for namespace {}\n",nd->displayName());
10618 }
10619 }
10620
10621 generateNamespaceClassDocs(nd->getClasses());
10622 if (sliceOpt)
10623 {
10624 generateNamespaceClassDocs(nd->getInterfaces());
10625 generateNamespaceClassDocs(nd->getStructs());
10626 generateNamespaceClassDocs(nd->getRecords());
10627 generateNamespaceClassDocs(nd->getExceptions());
10628 }
10629 generateNamespaceConceptDocs(nd->getConcepts());
10630 }
10631}
virtual void writeDocumentation(OutputList &ol)=0
static void generateNamespaceConceptDocs(const ConceptLinkedRefMap &conceptList)
static void generateNamespaceClassDocs(const ClassLinkedRefMap &classList)

References Config_getBool, g_outputList, generateNamespaceClassDocs(), generateNamespaceConceptDocs(), msg, Doxygen::namespaceLinkedMap, toNamespaceDefMutable(), and NamespaceDefMutable::writeDocumentation().

Referenced by generateOutput().

◆ generateOutput()

void generateOutput ( )

add extra languages for which we can only produce syntax highlighted code

Definition at line 13574 of file doxygen.cpp.

13575{
13576 AUTO_TRACE();
13577 /**************************************************************************
13578 * Initialize output generators *
13579 **************************************************************************/
13580
13581 /// add extra languages for which we can only produce syntax highlighted code
13583
13584 //// dump all symbols
13585 if (g_dumpSymbolMap)
13586 {
13587 dumpSymbolMap();
13588 exit(0);
13589 }
13590
13591 bool generateHtml = Config_getBool(GENERATE_HTML);
13592 bool generateLatex = Config_getBool(GENERATE_LATEX);
13593 bool generateMan = Config_getBool(GENERATE_MAN);
13594 bool generateRtf = Config_getBool(GENERATE_RTF);
13595 bool generateDocbook = Config_getBool(GENERATE_DOCBOOK);
13596
13597
13599 if (generateHtml)
13600 {
13604 }
13605 if (generateLatex)
13606 {
13609 }
13610 if (generateDocbook)
13611 {
13614 }
13615 if (generateMan)
13616 {
13619 }
13620 if (generateRtf)
13621 {
13624 }
13625 if (Config_getBool(USE_HTAGS))
13626 {
13627 Htags::useHtags = true;
13628 DString htmldir = Config_getString(HTML_OUTPUT);
13629 if (!Htags::execute(htmldir))
13630 err("USE_HTAGS is YES but htags(1) failed. \n");
13631 else if (!Htags::loadFilemap(htmldir))
13632 err("htags(1) ended normally but failed to load the filemap. \n");
13633 }
13634
13635 /**************************************************************************
13636 * Generate documentation *
13637 **************************************************************************/
13638
13639 g_s.begin("Generating style sheet...\n");
13640 //printf("writing style info\n");
13641 g_outputList->writeStyleInfo(0); // write first part
13642 g_s.end();
13643
13644 bool searchEngine = Config_getBool(SEARCHENGINE);
13645 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
13646
13647 g_s.begin("Generating search indices...\n");
13648 if (searchEngine && !serverBasedSearch && generateHtml)
13649 {
13651 }
13652
13653 // generate search indices (need to do this before writing other HTML
13654 // pages as these contain a drop down menu with options depending on
13655 // what categories we find in this function.
13656 if (generateHtml && searchEngine)
13657 {
13658 DString searchDirName = Config_getString(HTML_OUTPUT)+"/search";
13659 Dir searchDir(searchDirName.str());
13660 if (!searchDir.exists() && !searchDir.mkdir(searchDirName.str()))
13661 {
13662 term("Could not create search results directory '{}' $PWD='{}'\n",
13663 searchDirName,Dir::currentDirPath());
13664 }
13665 HtmlGenerator::writeSearchData(searchDirName);
13666 if (!serverBasedSearch) // client side search index
13667 {
13669 }
13670 }
13671 g_s.end();
13672
13673 // copy static stuff
13674 if (generateHtml)
13675 {
13677 copyLogo(Config_getString(HTML_OUTPUT),true);
13678 copyIcon(Config_getString(HTML_OUTPUT),true);
13679 copyExtraFiles(Config_getList(HTML_EXTRA_FILES),"HTML_EXTRA_FILES",Config_getString(HTML_OUTPUT),true);
13680 }
13681 if (generateLatex)
13682 {
13684 copyLogo(Config_getString(LATEX_OUTPUT),false);
13685 copyIcon(Config_getString(LATEX_OUTPUT),false);
13686 copyExtraFiles(Config_getList(LATEX_EXTRA_FILES),"LATEX_EXTRA_FILES",Config_getString(LATEX_OUTPUT),false);
13687 }
13688 if (generateDocbook)
13689 {
13690 copyLogo(Config_getString(DOCBOOK_OUTPUT),false);
13691 copyIcon(Config_getString(DOCBOOK_OUTPUT),false);
13692 }
13693 if (generateRtf)
13694 {
13695 copyLogo(Config_getString(RTF_OUTPUT),false);
13696 copyIcon(Config_getString(RTF_OUTPUT),false);
13697 copyExtraFiles(Config_getList(RTF_EXTRA_FILES),"RTF_EXTRA_FILES",Config_getString(RTF_OUTPUT),false);
13698 }
13699
13701 if (fm.hasFormulas() && generateHtml
13702 && !Config_getBool(USE_MATHJAX))
13703 {
13704 g_s.begin("Generating images for formulas in HTML...\n");
13705 fm.generateImages(Config_getString(HTML_OUTPUT), true, Config_getEnum(HTML_FORMULA_FORMAT)==HTML_FORMULA_FORMAT_t::svg ?
13707 g_s.end();
13708 }
13709 if (fm.hasFormulas() && generateRtf)
13710 {
13711 g_s.begin("Generating images for formulas in RTF...\n");
13713 g_s.end();
13714 }
13715
13716 if (fm.hasFormulas() && generateDocbook)
13717 {
13718 g_s.begin("Generating images for formulas in Docbook...\n");
13720 g_s.end();
13721 }
13722
13723 g_s.begin("Generating example documentation...\n");
13725 g_s.end();
13726
13727 g_s.begin("Generating file sources...\n");
13729 g_s.end();
13730
13731 g_s.begin("Counting members...\n");
13732 // needs to be done after generating the sources
13733 // but before generating the compound documentation, see bug #12233
13734 countMembers();
13735 g_s.end();
13736
13737 g_s.begin("Generating file documentation...\n");
13739 g_s.end();
13740
13741 g_s.begin("Generating page documentation...\n");
13743 g_s.end();
13744
13745 g_s.begin("Generating group documentation...\n");
13747 g_s.end();
13748
13749 g_s.begin("Generating class documentation...\n");
13751 g_s.end();
13752
13753 g_s.begin("Generating concept documentation...\n");
13755 g_s.end();
13756
13757 g_s.begin("Generating module documentation...\n");
13759 g_s.end();
13760
13761 g_s.begin("Generating namespace documentation...\n");
13763 g_s.end();
13764
13765 if (Config_getBool(GENERATE_LEGEND))
13766 {
13767 g_s.begin("Generating graph info page...\n");
13769 g_s.end();
13770 }
13771
13772 g_s.begin("Generating directory documentation...\n");
13774 g_s.end();
13775
13776 if (g_outputList->size()>0)
13777 {
13779 }
13780
13781 g_s.begin("finalizing index lists...\n");
13783 g_s.end();
13784
13785 g_s.begin("writing tag file...\n");
13786 writeTagFile();
13787 g_s.end();
13788
13789 if (Config_getBool(GENERATE_XML))
13790 {
13791 g_s.begin("Generating XML output...\n");
13793 generateXML();
13795 g_s.end();
13796 }
13797 if (Config_getBool(GENERATE_SQLITE3))
13798 {
13799 g_s.begin("Generating SQLITE3 output...\n");
13801 g_s.end();
13802 }
13803
13804 if (Config_getBool(GENERATE_AUTOGEN_DEF))
13805 {
13806 g_s.begin("Generating AutoGen DEF output...\n");
13807 generateDEF();
13808 g_s.end();
13809 }
13810 if (Config_getBool(GENERATE_PERLMOD))
13811 {
13812 g_s.begin("Generating Perl module output...\n");
13814 g_s.end();
13815 }
13816 if (generateHtml && searchEngine && serverBasedSearch)
13817 {
13818 g_s.begin("Generating search index\n");
13819 if (Doxygen::searchIndex.kind()==SearchIndexIntf::Internal) // write own search index
13820 {
13822 Doxygen::searchIndex.write(Config_getString(HTML_OUTPUT)+"/search/search.idx");
13823 }
13824 else // write data for external search index
13825 {
13827 DString searchDataFile = Config_getString(SEARCHDATA_FILE);
13828 if (searchDataFile.empty())
13829 {
13830 searchDataFile="searchdata.xml";
13831 }
13832 if (!Portable::isAbsolutePath(searchDataFile.data()))
13833 {
13834 searchDataFile.prepend(Config_getString(OUTPUT_DIRECTORY)+"/");
13835 }
13836 Doxygen::searchIndex.write(searchDataFile);
13837 }
13838 g_s.end();
13839 }
13840
13841 if (generateRtf)
13842 {
13843 g_s.begin("Combining RTF output...\n");
13844 if (!RTFGenerator::preProcessFileInplace(Config_getString(RTF_OUTPUT),"refman.rtf"))
13845 {
13846 err("An error occurred during post-processing the RTF files!\n");
13847 }
13848 g_s.end();
13849 }
13850
13851 if (PlantumlManager::instance().needToRun())
13852 {
13853 g_s.begin("Running plantuml with JAVA...\n");
13855 g_s.end();
13856 }
13857
13858 if (MermaidManager::instance().needToRun())
13859 {
13860 g_s.begin("Running mermaid (mmdc)...\n");
13862 g_s.end();
13863 }
13864
13865 if (Config_getBool(HAVE_DOT) && DotManager::instance()->needToRun())
13866 {
13867 g_s.begin("Running dot...\n");
13869 g_s.end();
13870 }
13871
13872 if (generateHtml &&
13873 Config_getBool(GENERATE_HTMLHELP) &&
13874 !Config_getString(HHC_LOCATION).empty())
13875 {
13876 g_s.begin("Running html help compiler...\n");
13878 g_s.end();
13879 }
13880
13881 if ( generateHtml &&
13882 Config_getBool(GENERATE_QHP) &&
13883 !Config_getString(QHG_LOCATION).empty())
13884 {
13885 g_s.begin("Running qhelpgenerator...\n");
13887 g_s.end();
13888 }
13889
13892
13894
13896 {
13897
13898 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
13899 if (numThreads<1) numThreads=1;
13900 msg("Total elapsed time: {:.6f} seconds\n(of which an average of {:.6f} seconds per thread waiting for external tools to finish)\n",
13901 (static_cast<double>(Debug::elapsedTime())),
13902 Portable::getSysElapsedTime()/static_cast<double>(numThreads)
13903 );
13904 g_s.print();
13905
13907 msg("finished...\n");
13909 }
13910 else
13911 {
13912 msg("finished...\n");
13913 }
13914
13915
13916 /**************************************************************************
13917 * Start cleaning up *
13918 **************************************************************************/
13919
13921
13923 Dir thisDir;
13924 thisDir.remove(Doxygen::filterDBFileName.str());
13926 exitTracing();
13928 delete Doxygen::clangUsrMap;
13929 g_successfulRun=true;
13930
13931 //dumpDocNodeSizes();
13932}
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
static double elapsedTime()
Definition debug.cpp:200
static void setFlag(const DebugMask mask)
Definition debug.cpp:117
static std::string currentDirPath()
Definition dir.cpp:347
static void init()
bool run()
Definition dot.cpp:119
static DotManager * instance()
Definition dot.cpp:78
static bool generatingXmlOutput
Definition doxygen.h:127
static ClangUsrMap * clangUsrMap
Definition doxygen.h:119
bool hasFormulas() const
Definition formula.cpp:720
void generateImages(const DString &outputDir, bool toIndex, Format format, HighDPI hd=HighDPI::Off)
Definition formula.cpp:635
Generator for HTML output.
Definition htmlgen.h:93
static void writeSearchData(const DString &dir)
Definition htmlgen.cpp:1461
static void init()
Definition htmlgen.cpp:1281
static void writeSearchPage()
Definition htmlgen.cpp:3291
static void writeTabData()
Additional initialization after indices have been created.
Definition htmlgen.cpp:1445
static void writeExternalSearchPage()
Definition htmlgen.cpp:3390
void finalize()
Definition indexlist.h:104
Generator for LaTeX output.
Definition latexgen.h:96
static void init()
Definition latexgen.cpp:632
Generator for Man page output.
Definition mangen.h:69
static void init()
Definition mangen.cpp:275
void run()
Run mmdc tool for all collected diagrams.
Definition mermaid.cpp:255
static MermaidManager & instance()
Definition mermaid.cpp:38
void writeDocumentation(OutputList &ol)
void add()
Definition outputlist.h:348
size_t size() const
Definition outputlist.h:357
void writeStyleInfo(int part)
Definition outputlist.h:391
void cleanup()
Definition outputlist.h:748
static PlantumlManager & instance()
Definition plantuml.cpp:236
void run()
Run plant UML tool for all images.
Definition plantuml.cpp:432
Generator for RTF output.
Definition rtfgen.h:80
static void init()
Definition rtfgen.cpp:464
static bool preProcessFileInplace(const DString &path, const DString &name)
This is an API to a VERY brittle RTF preprocessor that combines nested RTF files.
Definition rtfgen.cpp:2468
void write(const DString &file)
void print()
Definition doxygen.cpp:250
void begin(const char *name)
Definition doxygen.cpp:237
void end()
Definition doxygen.cpp:243
static void showCacheUsage()
Show usage of the type lookup cache.
void generateDEF()
Definition defgen.cpp:463
void generateDirDocs(OutputList &ol)
Definition dirdef.cpp:1190
static void copyLatexStyleSheet()
static void runQHelpGenerator()
class Statistics g_s
static void copyStyleSheet()
static void generateGroupDocs()
static void generateExampleDocs()
static void copyLogo(const DString &outputOption, bool toIndex)
static void dumpSymbolMap()
static void generateFileDocs()
Definition doxygen.cpp:9200
static void generatePageDocs()
static void copyIcon(const DString &outputOption, bool toIndex)
static void generateFileSources()
Definition doxygen.cpp:9030
static void copyExtraFiles(StringVector files, const DString &filesOption, const DString &outputOption, bool toIndex)
static void generateClassDocs()
Definition doxygen.cpp:9635
static void countMembers()
Definition doxygen.cpp:9496
static void runHtmlHelpCompiler()
static bool g_dumpSymbolMap
Definition doxygen.cpp:195
static void generateNamespaceDocs()
static void writeTagFile()
void cleanUpDoxygen()
static void generateConceptDocs()
Definition doxygen.cpp:9661
void writeGraphInfo(OutputList &ol)
Definition index.cpp:4153
void writeIndexHierarchy(OutputList &ol)
Definition index.cpp:5905
void finishWarnExit()
Definition message.cpp:291
void deinit()
double getSysElapsedTime()
Definition portable.cpp:113
bool isAbsolutePath(const DString &fileName)
Definition portable.cpp:513
void generatePerlMod()
void finalizeSearchIndexer()
void createJavaScriptSearchIndex()
void writeJavaScriptSearchIndex()
void generateSqlite3()
static bool execute(const DString &htmldir)
Definition htags.cpp:41
static bool loadFilemap(const DString &htmldir)
Definition htags.cpp:110
void exitTracing()
Definition trace.cpp:55
void addCodeOnlyMappings()
Definition util.cpp:4294
void cleanupInlineGraphs()
Definition util.cpp:5558
void generateXML()
Definition xmlgen.cpp:2379

References OutputList::add(), addCodeOnlyMappings(), AUTO_TRACE, Statistics::begin(), FormulaManager::Bitmap, Doxygen::clangUsrMap, OutputList::cleanup(), cleanUpDoxygen(), cleanupInlineGraphs(), Debug::clearFlag(), Config_getBool, Config_getEnum, Config_getInt, Config_getList, Config_getString, copyExtraFiles(), copyIcon(), copyLatexStyleSheet(), copyLogo(), copyStyleSheet(), countMembers(), createJavaScriptSearchIndex(), Dir::currentDirPath(), DString::data(), Config::deinit(), dumpSymbolMap(), Debug::elapsedTime(), DString::empty(), Statistics::end(), err, Htags::execute(), Dir::exists(), exitTracing(), Doxygen::filterDBFileName, IndexList::finalize(), finalizeSearchIndexer(), finishWarnExit(), g_dumpSymbolMap, g_outputList, g_s, g_successfulRun, generateClassDocs(), generateConceptDocs(), generateDEF(), generateDirDocs(), generateExampleDocs(), generateFileDocs(), generateFileSources(), generateGroupDocs(), FormulaManager::generateImages(), generateNamespaceDocs(), generatePageDocs(), generatePerlMod(), generateSqlite3(), generateXML(), Doxygen::generatingXmlOutput, Portable::getSysElapsedTime(), FormulaManager::hasFormulas(), Doxygen::indexList, DocbookGenerator::init(), HtmlGenerator::init(), LatexGenerator::init(), ManGenerator::init(), RTFGenerator::init(), DotManager::instance(), FormulaManager::instance(), MermaidManager::instance(), ModuleManager::instance(), PlantumlManager::instance(), SearchIndexIntf::Internal, Portable::isAbsolutePath(), Debug::isFlagSet(), Htags::loadFilemap(), Dir::mkdir(), msg, FormulaManager::On, DString::prepend(), RTFGenerator::preProcessFileInplace(), Statistics::print(), Dir::remove(), DotManager::run(), MermaidManager::run(), PlantumlManager::run(), runHtmlHelpCompiler(), runQHelpGenerator(), Doxygen::searchIndex, Debug::setFlag(), SymbolResolver::showCacheUsage(), OutputList::size(), DString::str(), term, Debug::Time, Htags::useHtags, FormulaManager::Vector, SearchIndexIntf::write(), ModuleManager::writeDocumentation(), HtmlGenerator::writeExternalSearchPage(), writeGraphInfo(), writeIndexHierarchy(), writeJavaScriptSearchIndex(), HtmlGenerator::writeSearchData(), HtmlGenerator::writeSearchPage(), OutputList::writeStyleInfo(), HtmlGenerator::writeTabData(), and writeTagFile().

Referenced by main().

◆ generatePageDocs()

void generatePageDocs ( )
static

Definition at line 10376 of file doxygen.cpp.

10377{
10378 //printf("documentedPages=%d real=%d\n",documentedPages,Doxygen::pageLinkedMap->count());
10379 if (Index::instance().numDocumentedPages()==0) return;
10380 for (const auto &pd : *Doxygen::pageLinkedMap)
10381 {
10382 if (!pd->getGroupDef() && !pd->isReference())
10383 {
10384 msg("Generating docs for page {}...\n",pd->name());
10385 pd->writeDocumentation(*g_outputList);
10386 }
10387 }
10388}

References g_outputList, Index::instance(), msg, and Doxygen::pageLinkedMap.

Referenced by generateOutput().

◆ generateXRefPages()

void generateXRefPages ( )
static

Definition at line 5830 of file doxygen.cpp.

5831{
5832 AUTO_TRACE();
5834 {
5835 rl->generatePage();
5836 }
5837}
std::unique_ptr< RefList > Ptr
Definition linkedmap.h:38
static RefListManager & instance()
Definition reflist.h:122

References AUTO_TRACE, and RefListManager::instance().

Referenced by parseInput().

◆ getArg()

const char * getArg ( int argc,
char ** argv,
int & optInd )
static

Definition at line 11821 of file doxygen.cpp.

11822{
11823 char *s=nullptr;
11824 if (dstrlen(&argv[optInd][2])>0)
11825 s=&argv[optInd][2];
11826 else if (optInd+1<argc && argv[optInd+1][0]!='-')
11827 s=argv[++optInd];
11828 return s;
11829}
uint32_t dstrlen(const char *str)
Returns the length of string str, or 0 if a null pointer is passed.
Definition dstring.h:39

References dstrlen().

Referenced by readConfiguration().

◆ getParserForFile()

std::unique_ptr< OutlineParserInterface > getParserForFile ( const DString & fn)
static

Definition at line 11089 of file doxygen.cpp.

11090{
11091 DString fileName=fn;
11092 DString extension;
11093 size_t sep = fileName.rfind('/');
11094 size_t ei = fileName.rfind('.');
11095 if (ei!=DString::npos && (sep==DString::npos || ei>sep)) // matches dir/file.ext but not dir.1/file
11096 {
11097 extension=fileName.mid(ei);
11098 }
11099 else
11100 {
11101 extension = ".no_extension";
11102 }
11103
11104 return Doxygen::parserManager->getOutlineParser(extension);
11105}
std::unique_ptr< OutlineParserInterface > getOutlineParser(const DString &extension)
Gets the interface to the parser associated with a given extension.
Definition parserintf.h:244

References ParserManager::getOutlineParser(), DString::mid(), DString::npos, Doxygen::parserManager, and DString::rfind().

Referenced by parseFilesMultiThreading(), and parseFilesSingleThreading().

◆ getTemplateArgumentsFromName()

std::unique_ptr< ArgumentList > getTemplateArgumentsFromName ( const DString & name,
const ArgumentLists & tArgLists )

Definition at line 878 of file doxygen.cpp.

881{
882 // for each scope fragment, check if it is a template and advance through
883 // the list if so.
884 size_t i=0, p=0;
885 auto alIt = tArgLists.begin();
886 while ((i=name.find("::",p))!=DString::npos && alIt!=tArgLists.end())
887 {
889 if (nd==nullptr)
890 {
891 ClassDef *cd = getClass(name.left(i));
892 if (cd)
893 {
894 if (!cd->templateArguments().empty())
895 {
896 ++alIt;
897 }
898 }
899 }
900 p=i+2;
901 }
902 return alIt!=tArgLists.end() ?
903 std::make_unique<ArgumentList>(*alIt) :
904 std::unique_ptr<ArgumentList>();
905}
Definition dstring.h:913

References ArgumentList::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), getClass(), Doxygen::namespaceLinkedMap, DString::npos, and ClassDef::templateArguments().

Referenced by addClassToContext(), addConceptToContext(), and addOverloaded().

◆ getTemplateArgumentsInName()

TemplateNameMap getTemplateArgumentsInName ( const ArgumentList & templateArguments,
const std::string & name )
static

make a dictionary of all template arguments of class cd that are part of the base class name. Example: A template class A with template arguments <R,S,T> that inherits from B<T,T,S> will have T and S in the dictionary.

Definition at line 4767 of file doxygen.cpp.

4768{
4769 std::map<std::string,int> templateNames;
4770 int count=0;
4771 for (const Argument &arg : templateArguments)
4772 {
4773 static const reg::Ex re(R"(\a[\w:]*)");
4774 reg::Iterator it(name,re);
4776 for (; it!=end ; ++it)
4777 {
4778 const auto &match = *it;
4779 std::string n = match.str();
4780 if (n==arg.name.str())
4781 {
4782 if (templateNames.find(n)==templateNames.end())
4783 {
4784 templateNames.emplace(n,count);
4785 }
4786 }
4787 }
4788 }
4789 return templateNames;
4790}

References end().

Referenced by computeTemplateClassRelations(), findBaseClassesForClass(), findUsedClassesForClass(), and resolveTemplateInstanceInType().

◆ haveEqualFileNames()

bool haveEqualFileNames ( const Entry * root,
const MemberDef * md )
static

Definition at line 9952 of file doxygen.cpp.

9953{
9954 if (const FileDef *fd = md->getFileDef())
9955 {
9956 return fd->absFilePath() == root->fileName;
9957 }
9958 return false;
9959}

References Entry::fileName, and MemberDef::getFileDef().

Referenced by findDefineDocumentation().

◆ inheritDocumentation()

void inheritDocumentation ( )
static

Definition at line 9682 of file doxygen.cpp.

9683{
9684 for (const auto &mn : *Doxygen::memberNameLinkedMap)
9685 {
9686 for (const auto &imd : *mn)
9687 {
9688 MemberDefMutable *md = toMemberDefMutable(imd.get());
9689 //static int count=0;
9690 //printf("%04d Member '%s'\n",count++,qPrint(md->qualifiedName()));
9691 if (md && md->documentation().empty() && md->briefDescription().empty())
9692 { // no documentation yet
9693 const MemberDef *bmd = md->reimplements();
9694 while (bmd && bmd->documentation().empty() &&
9695 bmd->briefDescription().empty()
9696 )
9697 { // search up the inheritance tree for a documentation member
9698 //printf("bmd=%s class=%s\n",qPrint(bmd->name()),qPrint(bmd->getClassDef()->name()));
9699 bmd = bmd->reimplements();
9700 }
9701 if (bmd) // copy the documentation from the reimplemented member
9702 {
9703 md->setInheritsDocsFrom(bmd);
9704 md->setDocumentation(bmd->documentation(),bmd->docFile(),bmd->docLine());
9706 md->setBriefDescription(bmd->briefDescription(),bmd->briefFile(),bmd->briefLine());
9707 md->copyArgumentNames(bmd);
9709 }
9710 }
9711 }
9712 }
9713}
virtual void setInheritsDocsFrom(const MemberDef *md)=0
virtual void copyArgumentNames(const MemberDef *bmd)=0

References Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), MemberDefMutable::copyArgumentNames(), Definition::docFile(), Definition::docLine(), Definition::documentation(), DString::empty(), Definition::inbodyDocumentation(), Definition::inbodyFile(), Definition::inbodyLine(), MemberDef::isDocsForDefinition(), Doxygen::memberNameLinkedMap, MemberDef::reimplements(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setInheritsDocsFrom(), and toMemberDefMutable().

Referenced by parseInput().

◆ initDoxygen()

void initDoxygen ( )

Definition at line 11848 of file doxygen.cpp.

11849{
11850 initResources();
11851 DString lang = Portable::getenv("LC_ALL");
11852 if (!lang.empty()) Portable::setenv("LANG",lang);
11853 std::setlocale(LC_ALL,"");
11854 std::setlocale(LC_CTYPE,"C"); // to get isspace(0xA0)==0, needed for UTF-8
11855 std::setlocale(LC_NUMERIC,"C");
11856
11858
11882
11883 // register any additional parsers here...
11884
11886
11887#if USE_LIBCLANG
11889#endif
11898 Doxygen::pageLinkedMap = new PageLinkedMap; // all doc pages
11899 Doxygen::exampleLinkedMap = new PageLinkedMap; // all examples
11900 //Doxygen::tagDestinationDict.setAutoDelete(true);
11902
11903 // initialization of these globals depends on
11904 // configuration switches so we need to postpone these
11905 Doxygen::globalScope = nullptr;
11915
11916}
static void startTimer()
Definition debug.cpp:195
A linked map of directories.
Definition dirdef.h:173
A list of index interfaces.
Definition indexlist.h:65
Manages programming language parsers.
Definition parserintf.h:182
void registerParser(const DString &name, const OutlineParserFactory &outlineParserFactory, const CodeParserFactory &codeParserFactory)
Registers an additional parser.
Definition parserintf.h:215
std::function< std::unique_ptr< T >() > make_parser_factory()
void initResources()
std::unordered_map< std::string, const Definition * > ClangUsrMap
Definition doxygen.h:75
void setenv(const DString &variable, const DString &value)
Definition portable.cpp:302
DString getenv(const DString &variable)
Definition portable.cpp:337
void initDefaultExtensionMapping()
Definition util.cpp:4227

References Doxygen::clangUsrMap, Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, Doxygen::diaFileNameLinkedMap, Doxygen::dirLinkedMap, Doxygen::dotFileNameLinkedMap, DString::empty(), Doxygen::exampleLinkedMap, Doxygen::exampleNameLinkedMap, Doxygen::functionNameLinkedMap, Portable::getenv(), Doxygen::globalScope, Doxygen::groupLinkedMap, Doxygen::hiddenClassLinkedMap, Doxygen::imageNameLinkedMap, Doxygen::includeNameLinkedMap, Doxygen::indexList, initDefaultExtensionMapping(), initResources(), Doxygen::inputNameLinkedMap, make_parser_factory(), Doxygen::memberNameLinkedMap, Doxygen::mermaidFileNameLinkedMap, Doxygen::mscFileNameLinkedMap, Doxygen::namespaceLinkedMap, Doxygen::pageLinkedMap, Doxygen::parserManager, Doxygen::plantUmlFileNameLinkedMap, ParserManager::registerParser(), Portable::setenv(), Debug::startTimer(), and Doxygen::symbolMap.

Referenced by main().

◆ initResources()

void initResources ( )
extern

Referenced by initDoxygen().

◆ insertMemberAlias()

void insertMemberAlias ( Definition * outerScope,
const MemberDef * md )
static

Definition at line 6988 of file doxygen.cpp.

6989{
6990 if (outerScope && outerScope!=Doxygen::globalScope)
6991 {
6992 auto aliasMd = createMemberDefAlias(outerScope,md);
6993 if (outerScope->definitionType()==Definition::TypeClass)
6994 {
6995 ClassDefMutable *cdm = toClassDefMutable(outerScope);
6996 if (cdm)
6997 {
6998 cdm->insertMember(aliasMd.get());
6999 }
7000 }
7001 else if (outerScope->definitionType()==Definition::TypeNamespace)
7002 {
7003 NamespaceDefMutable *ndm = toNamespaceDefMutable(outerScope);
7004 if (ndm)
7005 {
7006 ndm->insertMember(aliasMd.get());
7007 }
7008 }
7009 else if (outerScope->definitionType()==Definition::TypeFile)
7010 {
7011 toFileDef(outerScope)->insertMember(aliasMd.get());
7012 }
7013 if (aliasMd)
7014 {
7015 Doxygen::functionNameLinkedMap->add(md->name())->push_back(std::move(aliasMd));
7016 }
7017 }
7018}

References LinkedMap< T, Hash, KeyEqual, Map >::add(), createMemberDefAlias(), Definition::definitionType(), Doxygen::functionNameLinkedMap, Doxygen::globalScope, ClassDefMutable::insertMember(), FileDef::insertMember(), NamespaceDefMutable::insertMember(), Definition::name(), MemberName::push_back(), toClassDefMutable(), toFileDef(), toNamespaceDefMutable(), Definition::TypeClass, Definition::TypeFile, and Definition::TypeNamespace.

Referenced by findMember().

◆ isClassSection()

bool isClassSection ( const Entry * root)
static

Definition at line 5500 of file doxygen.cpp.

5501{
5502 if ( !root->name.empty() )
5503 {
5504 if (root->section.isCompound())
5505 // is it a compound (class, struct, record, union, interface ...)
5506 {
5507 return true;
5508 }
5509 else if (root->section.isCompoundDoc())
5510 // is it a documentation block with inheritance info.
5511 {
5512 bool hasExtends = !root->extends.empty();
5513 if (hasExtends) return true;
5514 }
5515 }
5516 return false;
5517}

References DString::empty(), Entry::extends, EntryType::isCompound(), EntryType::isCompoundDoc(), Entry::name, and Entry::section.

Referenced by findClassEntries().

◆ isEntryInGroupOfMember()

bool isEntryInGroupOfMember ( const Entry * root,
const MemberDef * md,
bool allowNoGroup = false )
static

Definition at line 6011 of file doxygen.cpp.

6012{
6013 const GroupDef *gd = md->getGroupDef();
6014 if (!gd)
6015 {
6016 return allowNoGroup;
6017 }
6018
6019 for (const auto &g : root->groups)
6020 {
6021 if (g.groupname == gd->name())
6022 {
6023 return true; // matching group
6024 }
6025 }
6026
6027 return false;
6028}

References MemberDef::getGroupDef(), Entry::groups, and Definition::name().

Referenced by findDefineDocumentation(), and findGlobalMember().

◆ isRecursiveBaseClass()

bool isRecursiveBaseClass ( const DString & scope,
const DString & name )
static

Definition at line 5117 of file doxygen.cpp.

5118{
5119 DString n=name;
5120 if (size_t index=n.find('<'); index!=DString::npos)
5121 {
5122 n=n.left(index);
5123 }
5124 bool result = rightScopeMatch(scope,n);
5125 return result;
5126}

References DString::find(), DString::left(), DString::npos, and rightScopeMatch().

Referenced by findClassRelation().

◆ isSpecialization()

bool isSpecialization ( const ArgumentLists & srcTempArgLists,
const ArgumentLists & dstTempArgLists )
static

Definition at line 6243 of file doxygen.cpp.

6247{
6248 auto srcIt = srcTempArgLists.begin();
6249 auto dstIt = dstTempArgLists.begin();
6250 while (srcIt!=srcTempArgLists.end() && dstIt!=dstTempArgLists.end())
6251 {
6252 if ((*srcIt).size()!=(*dstIt).size()) return true;
6253 ++srcIt;
6254 ++dstIt;
6255 }
6256 return false;
6257}

Referenced by addMemberFunction().

◆ isSymbolHidden()

bool isSymbolHidden ( const Definition * d)
static

Definition at line 9429 of file doxygen.cpp.

9430{
9431 bool hidden = d->isHidden();
9432 const Definition *parent = d->getOuterScope();
9433 return parent ? hidden || isSymbolHidden(parent) : hidden;
9434}
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1335

References Definition::getOuterScope(), Definition::isHidden(), isSymbolHidden(), and parent().

Referenced by computeTooltipTexts(), and isSymbolHidden().

◆ isVarWithConstructor()

bool isVarWithConstructor ( const Entry * root)
static

Returns true iff type is a class within scope context. Used to detect variable declarations that look like function prototypes.

Definition at line 3234 of file doxygen.cpp.

3235{
3236 bool result = false;
3237 bool typeIsClass = false;
3238 bool typePtrType = false;
3239 DString type;
3240 Definition *ctx = nullptr;
3241 FileDef *fd = root->fileDef();
3242 SymbolResolver resolver(fd);
3243
3244 AUTO_TRACE("isVarWithConstructor({})",root->name);
3245 if (root->parent()->section.isCompound())
3246 { // inside a class
3247 result=false;
3248 AUTO_TRACE_EXIT("inside class: result={}",result);
3249 return result;
3250 }
3251 else if ((fd != nullptr) && (fd->name().endsWith(".c") || fd->name().endsWith(".h")))
3252 { // inside a .c file
3253 result=false;
3254 AUTO_TRACE_EXIT("inside C file: result={}",result);
3255 return result;
3256 }
3257 if (root->type.empty())
3258 {
3259 result=false;
3260 AUTO_TRACE_EXIT("no type: result={}",result);
3261 return result;
3262 }
3263 if (!root->parent()->name.empty())
3264 {
3266 }
3267 type = root->type;
3268 // remove qualifiers
3269 type.findAndRemoveWord("const");
3270 type.findAndRemoveWord("static");
3271 type.findAndRemoveWord("volatile");
3272 typePtrType = type.find('*')!=DString::npos || type.find('&')!=DString::npos;
3273 if (!typePtrType)
3274 {
3275 typeIsClass = resolver.resolveClass(ctx,type)!=nullptr;
3276 if (size_t ti=type.find('<'); !typeIsClass && ti!=DString::npos)
3277 {
3278 typeIsClass=resolver.resolveClass(ctx,type.left(ti))!=nullptr;
3279 }
3280 }
3281 if (typeIsClass) // now we still have to check if the arguments are
3282 // types or values. Since we do not have complete type info
3283 // we need to rely on heuristics :-(
3284 {
3285 if (root->argList.empty())
3286 {
3287 result=false; // empty arg list -> function prototype.
3288 AUTO_TRACE_EXIT("empty arg list: result={}",result);
3289 return result;
3290 }
3291 for (const Argument &a : root->argList)
3292 {
3293 static const reg::Ex initChars(R"([\d"'&*!^]+)");
3295 if (!a.name.empty() || !a.defval.empty())
3296 {
3297 std::string name = a.name.str();
3298 if (reg::search(name,match,initChars) && match.position()==0)
3299 {
3300 result=true;
3301 }
3302 else
3303 {
3304 result=false; // arg has (type,name) pair -> function prototype
3305 }
3306 AUTO_TRACE_EXIT("function prototype: result={}",result);
3307 return result;
3308 }
3309 if (!a.type.empty() &&
3310 (a.type.at(a.type.length()-1)=='*' ||
3311 a.type.at(a.type.length()-1)=='&'))
3312 // type ends with * or & => pointer or reference
3313 {
3314 result=false;
3315 AUTO_TRACE_EXIT("pointer or reference: result={}",result);
3316 return result;
3317 }
3318 if (a.type.empty() || resolver.resolveClass(ctx,a.type)!=nullptr)
3319 {
3320 result=false; // arg type is a known type
3321 AUTO_TRACE_EXIT("known type: result={}",result);
3322 return result;
3323 }
3324 if (checkIfTypedef(ctx,fd,a.type))
3325 {
3326 result=false; // argument is a typedef
3327 AUTO_TRACE_EXIT("typedef: result={}",result);
3328 return result;
3329 }
3330 std::string atype = a.type.str();
3331 if (reg::search(atype,match,initChars) && match.position()==0)
3332 {
3333 result=true; // argument type starts with typical initializer char
3334 AUTO_TRACE_EXIT("argument with init char: result={}",result);
3335 return result;
3336 }
3337 std::string resType=resolveTypeDef(ctx,a.type).str();
3338 if (resType.empty()) resType=atype;
3339 static const reg::Ex idChars(R"(\a\w*)");
3340 if (reg::search(resType,match,idChars) && match.position()==0) // resType starts with identifier
3341 {
3342 resType=match.str();
3343 if (resType=="int" || resType=="long" ||
3344 resType=="float" || resType=="double" ||
3345 resType=="char" || resType=="void" ||
3346 resType=="signed" || resType=="unsigned" ||
3347 resType=="const" || resType=="volatile" )
3348 {
3349 result=false; // type keyword -> function prototype
3350 AUTO_TRACE_EXIT("type keyword: result={}",result);
3351 return result;
3352 }
3353 }
3354 }
3355 result=true;
3356 }
3357
3358 AUTO_TRACE_EXIT("end: result={}",result);
3359 return result;
3360}
DString defval
Definition arguments.h:47
DString name
Definition arguments.h:45
bool findAndRemoveWord(const char *word)
removes occurrences of whole word from this string, while keeping internal spaces and reducing multip...
Definition dstring.cpp:660
bool checkIfTypedef(const Definition *scope, const FileDef *fileScope, const DString &n)
Definition util.cpp:4403

References Entry::argList, DString::at(), AUTO_TRACE, AUTO_TRACE_EXIT, checkIfTypedef(), Argument::defval, ArgumentList::empty(), DString::empty(), DString::endsWith(), Entry::fileDef(), DString::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), DString::findAndRemoveWord(), EntryType::isCompound(), DString::left(), DString::length(), Argument::name, Definition::name(), Entry::name, Doxygen::namespaceLinkedMap, DString::npos, Entry::parent(), SymbolResolver::resolveClass(), resolveTypeDef(), reg::search(), Entry::section, DString::str(), Argument::type, and Entry::type.

Referenced by buildVarList().

◆ make_parser_factory()

template<class T>
std::function< std::unique_ptr< T >() > make_parser_factory ( )

Definition at line 11843 of file doxygen.cpp.

11844{
11845 return []() { return std::make_unique<T>(); };
11846}

Referenced by initDoxygen().

◆ makeTemplateInstanceRelation()

void makeTemplateInstanceRelation ( const Entry * root,
ClassDefMutable * cd )
static

Definition at line 5572 of file doxygen.cpp.

5573{
5574 AUTO_TRACE("root->name={} cd={}",root->name,cd->name());
5575 size_t i = root->name.find('<');
5576 size_t j = root->name.rfind('>');
5577 size_t k = j!=DString::npos ? root->name.find("::",j+1) : DString::npos; // A<T::B> => ok, A<T>::B => nok
5578 if (i!=DString::npos && j!=DString::npos && k==DString::npos && root->lang!=SrcLangExt::CSharp && root->lang!=SrcLangExt::Java)
5579 {
5580 ClassDefMutable *master = getClassMutable(root->name.left(i));
5581 if (master && master!=cd && !cd->templateMaster())
5582 {
5583 AUTO_TRACE_ADD("class={} master={}",cd->name(),cd->templateMaster()?cd->templateMaster()->name():"<none>",master->name());
5584 cd->setTemplateMaster(master);
5585 master->insertExplicitTemplateInstance(cd,root->name.mid(i));
5586 }
5587 }
5588}
virtual void insertExplicitTemplateInstance(ClassDef *instance, const DString &spec)=0
virtual void setTemplateMaster(const ClassDef *tm)=0

References AUTO_TRACE, AUTO_TRACE_ADD, DString::find(), getClassMutable(), ClassDefMutable::insertExplicitTemplateInstance(), Entry::lang, DString::left(), DString::mid(), Definition::name(), Entry::name, DString::npos, DString::rfind(), ClassDefMutable::setTemplateMaster(), and ClassDef::templateMaster().

Referenced by findUsedTemplateInstances().

◆ mergeCategories()

void mergeCategories ( )
static

Definition at line 8979 of file doxygen.cpp.

8980{
8981 AUTO_TRACE();
8982 // merge members of categories into the class they extend
8983 for (const auto &cd : *Doxygen::classLinkedMap)
8984 {
8985 if (size_t i=cd->name().find('('); i!=DString::npos) // it is an Objective-C category
8986 {
8987 DString baseName=cd->name().left(i);
8988 ClassDefMutable *baseClass=toClassDefMutable(Doxygen::classLinkedMap->find(baseName));
8989 if (baseClass)
8990 {
8991 AUTO_TRACE_ADD("merging members of category {} into {}",cd->name(),baseClass->name());
8992 baseClass->mergeCategory(cd.get());
8993 }
8994 }
8995 }
8996}
virtual void mergeCategory(ClassDef *category)=0

References AUTO_TRACE, AUTO_TRACE_ADD, Doxygen::classLinkedMap, DString::left(), ClassDefMutable::mergeCategory(), Definition::name(), DString::npos, and toClassDefMutable().

Referenced by parseInput().

◆ organizeSubGroups()

void organizeSubGroups ( const Entry * root)
static

Definition at line 599 of file doxygen.cpp.

600{
601 //printf("Defining groups\n");
602 // first process the @defgroups blocks
603 organizeSubGroupsFiltered(root,false);
604 //printf("Additional groups\n");
605 // then process the @addtogroup, @weakgroup blocks
606 organizeSubGroupsFiltered(root,true);
607}
static void organizeSubGroupsFiltered(const Entry *root, bool additional)
Definition doxygen.cpp:580

References organizeSubGroupsFiltered().

Referenced by parseInput().

◆ organizeSubGroupsFiltered()

void organizeSubGroupsFiltered ( const Entry * root,
bool additional )
static

Definition at line 580 of file doxygen.cpp.

581{
582 if (root->section.isGroupDoc() && !root->name.empty())
583 {
584 AUTO_TRACE("additional={}",additional);
585 if ((root->groupDocType==Entry::GROUPDOC_NORMAL && !additional) ||
586 (root->groupDocType!=Entry::GROUPDOC_NORMAL && additional))
587 {
589 if (gd)
590 {
591 AUTO_TRACE_ADD("adding {} to group {}",root->name,gd->name());
592 addGroupToGroups(root,gd);
593 }
594 }
595 }
596 for (const auto &e : root->children()) organizeSubGroupsFiltered(e.get(),additional);
597}
void addGroupToGroups(const Entry *root, GroupDef *subGroup)

References addGroupToGroups(), AUTO_TRACE, AUTO_TRACE_ADD, Entry::children(), DString::empty(), LinkedMap< T, Hash, KeyEqual, Map >::find(), Entry::GROUPDOC_NORMAL, Entry::groupDocType, Doxygen::groupLinkedMap, Definition::name(), Entry::name, organizeSubGroupsFiltered(), and Entry::section.

Referenced by organizeSubGroups(), and organizeSubGroupsFiltered().

◆ parseFile()

std::shared_ptr< Entry > parseFile ( OutlineParserInterface & parser,
FileDef * fd,
const DString & fn,
ClangTUParser * clangParser,
bool newTU )
static

Definition at line 11107 of file doxygen.cpp.

11110{
11111 DString fileName=fn;
11112 AUTO_TRACE("fileName={}",fileName);
11113 DString extension;
11114 if (size_t ei = fileName.rfind('.'); ei!=DString::npos)
11115 {
11116 extension=fileName.mid(ei);
11117 }
11118 else
11119 {
11120 extension = ".no_extension";
11121 }
11122
11123 FileInfo fi(fileName.str());
11124 std::string preBuf;
11125
11126 if (Config_getBool(ENABLE_PREPROCESSING) &&
11127 parser.needsPreprocessing(extension))
11128 {
11129 Preprocessor preprocessor;
11130 StringVector includePath = Config_getList(INCLUDE_PATH);
11131 for (const auto &s : includePath)
11132 {
11133 std::string absPath = FileInfo(s).absFilePath();
11134 preprocessor.addSearchDir(absPath);
11135 }
11136 std::string inBuf;
11137 msg("Preprocessing {}...\n",fn);
11138 readInputFile(fileName,inBuf);
11139 addTerminalCharIfMissing(inBuf,'\n');
11140 preprocessor.processFile(fileName,inBuf,preBuf);
11141 }
11142 else // no preprocessing
11143 {
11144 msg("Reading {}...\n",fn);
11145 readInputFile(fileName,preBuf);
11146 addTerminalCharIfMissing(preBuf,'\n');
11147 }
11148
11149 std::string convBuf;
11150 convBuf.reserve(preBuf.size()+1024);
11151
11152 // convert multi-line C++ comments to C style comments
11153 convertCppComments(preBuf,convBuf,fileName.str());
11154
11155 std::shared_ptr<Entry> fileRoot = std::make_shared<Entry>();
11156 // use language parse to parse the file
11157 if (clangParser)
11158 {
11159 if (newTU) clangParser->parse();
11160 clangParser->switchToFile(fd);
11161 }
11162 parser.parseInput(fileName,convBuf.data(),fileRoot,clangParser);
11163 fileRoot->setFileDef(fd);
11164 return fileRoot;
11165}
void switchToFile(const FileDef *fd)
Switches to another file within the translation unit started with start().
void parse()
Parse the file given at construction time as a translation unit This file should already be preproces...
std::string absFilePath() const
Definition fileinfo.cpp:106
virtual bool needsPreprocessing(const DString &extension) const =0
Returns true if the language identified by extension needs the C preprocessor to be run before feed t...
virtual void parseInput(const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser)=0
Parses a single input file with the goal to build an Entry tree.
void processFile(const DString &fileName, const std::string &input, std::string &output)
Definition pre.l:4410
void addSearchDir(const DString &dir)
Definition pre.l:4392
void convertCppComments(const std::string &inBuf, std::string &outBuf, const std::string &fn)
Converts the comments in a file.
void addTerminalCharIfMissing(std::string &s, char c)
Definition stringutil.h:87
bool readInputFile(const DString &fileName, std::string &contents, const ReadInputFileOptions &options)
read a file name fileName and optionally filter and transcode it
Definition util.cpp:4506

References FileInfo::absFilePath(), Preprocessor::addSearchDir(), addTerminalCharIfMissing(), AUTO_TRACE, Config_getBool, Config_getList, convertCppComments(), DString::data(), DString::mid(), msg, OutlineParserInterface::needsPreprocessing(), DString::npos, ClangTUParser::parse(), OutlineParserInterface::parseInput(), Preprocessor::processFile(), readInputFile(), DString::rfind(), DString::str(), and ClangTUParser::switchToFile().

Referenced by parseFilesMultiThreading(), and parseFilesSingleThreading().

◆ parseFilesMultiThreading()

void parseFilesMultiThreading ( const std::shared_ptr< Entry > & root)
static

parse the list of input files

Definition at line 11168 of file doxygen.cpp.

11169{
11170 AUTO_TRACE();
11171#if USE_LIBCLANG
11173 {
11174 StringUnorderedSet processedFiles;
11175
11176 // create a dictionary with files to process
11177 StringUnorderedSet filesToProcess;
11178 for (const auto &s : g_inputFiles)
11179 {
11180 filesToProcess.insert(s);
11181 }
11182
11183 std::mutex processedFilesLock;
11184 // process source files (and their include dependencies)
11185 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
11186 msg("Processing input using {} threads.\n",numThreads);
11187 ThreadPool threadPool(numThreads);
11188 using FutureType = std::vector< std::shared_ptr<Entry> >;
11189 std::vector< std::future< FutureType > > results;
11190 for (const auto &s : g_inputFiles)
11191 {
11192 bool ambig = false;
11193 DString qs = s;
11195 ASSERT(fd!=nullptr);
11196 if (fd->isSource() && !fd->isReference() && fd->getLanguage()==SrcLangExt::Cpp) // this is a source file
11197 {
11198 // lambda representing the work to executed by a thread
11199 auto processFile = [qs,&filesToProcess,&processedFilesLock,&processedFiles]() {
11200 bool ambig_l = false;
11201 std::vector< std::shared_ptr<Entry> > roots;
11202 FileDef *fd_l = Doxygen::inputNameLinkedMap->findFileDef(qs,ambig_l);
11203 auto clangParser = ClangParser::instance()->createTUParser(fd_l);
11204 auto parser = getParserForFile(qs);
11205 auto fileRoot { parseFile(*parser.get(),fd_l,qs,clangParser.get(),true) };
11206 roots.push_back(fileRoot);
11207
11208 // Now process any include files in the same translation unit
11209 // first. When libclang is used this is much more efficient.
11210 for (auto incFile : clangParser->filesInSameTU())
11211 {
11212 DString qincFile = incFile;
11213 if (filesToProcess.find(incFile)!=filesToProcess.end())
11214 {
11215 bool needsToBeProcessed = false;
11216 {
11217 std::lock_guard<std::mutex> lock(processedFilesLock);
11218 needsToBeProcessed = processedFiles.find(incFile)==processedFiles.end();
11219 if (needsToBeProcessed) processedFiles.insert(incFile);
11220 }
11221 if (qincFile!=qs && needsToBeProcessed)
11222 {
11223 FileDef *ifd=Doxygen::inputNameLinkedMap->findFileDef(qincFile,ambig_l);
11224 if (ifd && !ifd->isReference())
11225 {
11226 //printf(" Processing %s in same translation unit as %s\n",incFile,qPrint(s));
11227 fileRoot = parseFile(*parser.get(),ifd,qincFile,clangParser.get(),false);
11228 roots.push_back(fileRoot);
11229 }
11230 }
11231 }
11232 }
11233 return roots;
11234 };
11235 // dispatch the work and collect the future results
11236 results.emplace_back(threadPool.queue(processFile));
11237 }
11238 }
11239 // synchronize with the Entry result lists produced and add them to the root
11240 for (auto &f : results)
11241 {
11242 auto l = f.get();
11243 for (auto &e : l)
11244 {
11245 root->moveToSubEntryAndKeep(e);
11246 }
11247 }
11248 // process remaining files
11249 results.clear();
11250 for (const auto &s : g_inputFiles)
11251 {
11252 if (processedFiles.find(s)==processedFiles.end()) // not yet processed
11253 {
11254 // lambda representing the work to executed by a thread
11255 auto processFile = [s]() {
11256 bool ambig = false;
11257 DString qs = s;
11258 std::vector< std::shared_ptr<Entry> > roots;
11260 auto parser { getParserForFile(qs) };
11261 bool useClang = getLanguageFromFileName(qs)==SrcLangExt::Cpp;
11262 if (useClang)
11263 {
11264 auto clangParser = ClangParser::instance()->createTUParser(fd);
11265 auto fileRoot = parseFile(*parser.get(),fd,qs,clangParser.get(),true);
11266 roots.push_back(fileRoot);
11267 }
11268 else
11269 {
11270 auto fileRoot = parseFile(*parser.get(),fd,qs,nullptr,true);
11271 roots.push_back(fileRoot);
11272 }
11273 return roots;
11274 };
11275 results.emplace_back(threadPool.queue(processFile));
11276 }
11277 }
11278 // synchronize with the Entry result lists produced and add them to the root
11279 for (auto &f : results)
11280 {
11281 auto l = f.get();
11282 for (auto &e : l)
11283 {
11284 root->moveToSubEntryAndKeep(e);
11285 }
11286 }
11287 }
11288 else // normal processing
11289#endif
11290 {
11291 std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
11292 msg("Processing input using {} threads.\n",numThreads);
11293 ThreadPool threadPool(numThreads);
11294 using FutureType = std::shared_ptr<Entry>;
11295 std::vector< std::future< FutureType > > results;
11296 for (const auto &s : g_inputFiles)
11297 {
11298 // lambda representing the work to executed by a thread
11299 auto processFile = [s]() {
11300 bool ambig = false;
11301 DString qs = s;
11303 auto parser = getParserForFile(qs);
11304 auto fileRoot = parseFile(*parser.get(),fd,qs,nullptr,true);
11305 return fileRoot;
11306 };
11307 // dispatch the work and collect the future results
11308 results.emplace_back(threadPool.queue(processFile));
11309 }
11310 // synchronize with the Entry results produced and add them to the root
11311 for (auto &f : results)
11312 {
11313 root->moveToSubEntryAndKeep(f.get());
11314 }
11315 }
11316}
static std::shared_ptr< Entry > parseFile(OutlineParserInterface &parser, FileDef *fd, const DString &fn, ClangTUParser *clangParser, bool newTU)
static std::unique_ptr< OutlineParserInterface > getParserForFile(const DString &fn)

References ASSERT, AUTO_TRACE, Doxygen::clangAssistedParsing, Config_getInt, ClangParser::createTUParser(), FileNameLinkedMap::findFileDef(), g_inputFiles, Definition::getLanguage(), getLanguageFromFileName(), getParserForFile(), Doxygen::inputNameLinkedMap, ClangParser::instance(), Definition::isReference(), FileDef::isSource(), msg, parseFile(), and ThreadPool::queue().

Referenced by parseInput().

◆ parseFilesSingleThreading()

void parseFilesSingleThreading ( const std::shared_ptr< Entry > & root)
static

parse the list of input files

Definition at line 11319 of file doxygen.cpp.

11320{
11321 AUTO_TRACE();
11322#if USE_LIBCLANG
11324 {
11325 StringUnorderedSet processedFiles;
11326
11327 // create a dictionary with files to process
11328 StringUnorderedSet filesToProcess;
11329 for (const auto &s : g_inputFiles)
11330 {
11331 filesToProcess.insert(s);
11332 }
11333
11334 // process source files (and their include dependencies)
11335 for (const auto &s : g_inputFiles)
11336 {
11337 bool ambig = false;
11338 DString qs =s;
11340 ASSERT(fd!=nullptr);
11341 if (fd->isSource() && !fd->isReference() && getLanguageFromFileName(qs)==SrcLangExt::Cpp) // this is a source file
11342 {
11343 auto clangParser = ClangParser::instance()->createTUParser(fd);
11344 auto parser { getParserForFile(qs) };
11345 auto fileRoot = parseFile(*parser.get(),fd,qs,clangParser.get(),true);
11346 root->moveToSubEntryAndKeep(fileRoot);
11347 processedFiles.insert(s);
11348
11349 // Now process any include files in the same translation unit
11350 // first. When libclang is used this is much more efficient.
11351 for (auto incFile : clangParser->filesInSameTU())
11352 {
11353 //printf(" file %s\n",qPrint(incFile));
11354 if (filesToProcess.find(incFile)!=filesToProcess.end() && // file need to be processed
11355 processedFiles.find(incFile)==processedFiles.end()) // and is not processed already
11356 {
11357 FileDef *ifd=Doxygen::inputNameLinkedMap->findFileDef(incFile,ambig);
11358 if (ifd && !ifd->isReference())
11359 {
11360 //printf(" Processing %s in same translation unit as %s\n",qPrint(incFile),qPrint(qs));
11361 fileRoot = parseFile(*parser.get(),ifd,incFile,clangParser.get(),false);
11362 root->moveToSubEntryAndKeep(fileRoot);
11363 processedFiles.insert(incFile);
11364 }
11365 }
11366 }
11367 }
11368 }
11369 // process remaining files
11370 for (const auto &s : g_inputFiles)
11371 {
11372 if (processedFiles.find(s)==processedFiles.end()) // not yet processed
11373 {
11374 bool ambig = false;
11375 DString qs = s;
11377 if (getLanguageFromFileName(qs)==SrcLangExt::Cpp) // not yet processed
11378 {
11379 auto clangParser = ClangParser::instance()->createTUParser(fd);
11380 auto parser { getParserForFile(qs) };
11381 auto fileRoot = parseFile(*parser.get(),fd,qs,clangParser.get(),true);
11382 root->moveToSubEntryAndKeep(fileRoot);
11383 }
11384 else
11385 {
11386 std::unique_ptr<OutlineParserInterface> parser { getParserForFile(qs) };
11387 std::shared_ptr<Entry> fileRoot = parseFile(*parser.get(),fd,qs,nullptr,true);
11388 root->moveToSubEntryAndKeep(fileRoot);
11389 }
11390 processedFiles.insert(s);
11391 }
11392 }
11393 }
11394 else // normal processing
11395#endif
11396 {
11397 for (const auto &s : g_inputFiles)
11398 {
11399 bool ambig = false;
11400 DString qs = s;
11402 ASSERT(fd!=nullptr);
11403 std::unique_ptr<OutlineParserInterface> parser { getParserForFile(qs) };
11404 std::shared_ptr<Entry> fileRoot = parseFile(*parser.get(),fd,qs,nullptr,true);
11405 root->moveToSubEntryAndKeep(std::move(fileRoot));
11406 }
11407 }
11408}

References ASSERT, AUTO_TRACE, Doxygen::clangAssistedParsing, ClangParser::createTUParser(), FileNameLinkedMap::findFileDef(), g_inputFiles, getLanguageFromFileName(), getParserForFile(), Doxygen::inputNameLinkedMap, ClangParser::instance(), Definition::isReference(), FileDef::isSource(), and parseFile().

Referenced by parseInput().

◆ parseInput()

void parseInput ( )

Definition at line 12904 of file doxygen.cpp.

12905{
12906 AUTO_TRACE();
12907 std::atexit(exitDoxygen);
12908
12909 Portable::correctPath(Config_getList(EXTERNAL_TOOL_PATH));
12910
12911#if USE_LIBCLANG
12912 Doxygen::clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
12913#endif
12914
12915 // we would like to show the versionString earlier, but we first have to handle the configuration file
12916 // to know the value of the QUIET setting.
12917 DString versionString = getFullVersion();
12918 msg("Doxygen version used: {}\n",versionString);
12919
12921
12922 /**************************************************************************
12923 * Make sure the output directory exists
12924 **************************************************************************/
12925 DString outputDirectory = Config_getString(OUTPUT_DIRECTORY);
12926 if (!g_singleComment)
12927 {
12928 if (outputDirectory.empty())
12929 {
12930 outputDirectory = Config_updateString(OUTPUT_DIRECTORY,Dir::currentDirPath());
12931 }
12932 else
12933 {
12934 Dir dir(outputDirectory.str());
12935 if (!dir.exists())
12936 {
12937 dir.setPath(Dir::currentDirPath());
12938 if (!dir.mkdir(outputDirectory.str()))
12939 {
12940 term("tag OUTPUT_DIRECTORY: Output directory '{}' does not "
12941 "exist and cannot be created\n",outputDirectory);
12942 }
12943 else
12944 {
12945 msg("Notice: Output directory '{}' does not exist. "
12946 "I have created it for you.\n", outputDirectory);
12947 }
12948 dir.setPath(outputDirectory.str());
12949 }
12950 outputDirectory = Config_updateString(OUTPUT_DIRECTORY,dir.absPath());
12951 }
12952 }
12953 AUTO_TRACE_ADD("outputDirectory={}",outputDirectory);
12954
12955 /**************************************************************************
12956 * Initialize global lists and dictionaries
12957 **************************************************************************/
12958
12959#ifdef HAS_SIGNALS
12960 signal(SIGINT, stopDoxygen);
12961#endif
12962
12963 uint32_t pid = Portable::pid();
12964 Doxygen::filterDBFileName.sprintf("doxygen_filterdb_%d.tmp",pid);
12965 Doxygen::filterDBFileName.prepend(outputDirectory+"/");
12966
12967 /**************************************************************************
12968 * Check/create output directories *
12969 **************************************************************************/
12970
12971 bool generateHtml = Config_getBool(GENERATE_HTML);
12972 bool generateDocbook = Config_getBool(GENERATE_DOCBOOK);
12973 bool generateXml = Config_getBool(GENERATE_XML);
12974 bool generateLatex = Config_getBool(GENERATE_LATEX);
12975 bool generateRtf = Config_getBool(GENERATE_RTF);
12976 bool generateMan = Config_getBool(GENERATE_MAN);
12977 bool generateSql = Config_getBool(GENERATE_SQLITE3);
12978 DString htmlOutput;
12979 DString docbookOutput;
12980 DString xmlOutput;
12981 DString latexOutput;
12982 DString rtfOutput;
12983 DString manOutput;
12984 DString sqlOutput;
12985
12986 if (!g_singleComment)
12987 {
12988 if (generateHtml)
12989 {
12990 htmlOutput = createOutputDirectory(outputDirectory,Config_getString(HTML_OUTPUT),"/html");
12991 Config_updateString(HTML_OUTPUT,htmlOutput);
12992
12993 DString sitemapUrl = Config_getString(SITEMAP_URL);
12994 bool generateSitemap = !sitemapUrl.empty();
12995 if (generateSitemap && !sitemapUrl.endsWith("/"))
12996 {
12997 Config_updateString(SITEMAP_URL,sitemapUrl+"/");
12998 }
12999
13000 // add HTML indexers that are enabled
13001 bool generateHtmlHelp = Config_getBool(GENERATE_HTMLHELP);
13002 bool generateEclipseHelp = Config_getBool(GENERATE_ECLIPSEHELP);
13003 bool generateQhp = Config_getBool(GENERATE_QHP);
13004 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
13005 bool generateDocSet = Config_getBool(GENERATE_DOCSET);
13006 if (generateEclipseHelp) Doxygen::indexList->addIndex<EclipseHelp>();
13007 if (generateHtmlHelp) Doxygen::indexList->addIndex<HtmlHelp>();
13008 if (generateQhp) Doxygen::indexList->addIndex<Qhp>();
13009 if (generateSitemap) Doxygen::indexList->addIndex<Sitemap>();
13010 if (generateTreeView) Doxygen::indexList->addIndex<FTVHelp>(true);
13011 if (generateDocSet) Doxygen::indexList->addIndex<DocSets>();
13014 }
13015
13016 if (generateDocbook)
13017 {
13018 docbookOutput = createOutputDirectory(outputDirectory,Config_getString(DOCBOOK_OUTPUT),"/docbook");
13019 Config_updateString(DOCBOOK_OUTPUT,docbookOutput);
13020 }
13021
13022 if (generateXml)
13023 {
13024 xmlOutput = createOutputDirectory(outputDirectory,Config_getString(XML_OUTPUT),"/xml");
13025 Config_updateString(XML_OUTPUT,xmlOutput);
13026 }
13027
13028 if (generateLatex)
13029 {
13030 latexOutput = createOutputDirectory(outputDirectory,Config_getString(LATEX_OUTPUT), "/latex");
13031 Config_updateString(LATEX_OUTPUT,latexOutput);
13032 }
13033
13034 if (generateRtf)
13035 {
13036 rtfOutput = createOutputDirectory(outputDirectory,Config_getString(RTF_OUTPUT),"/rtf");
13037 Config_updateString(RTF_OUTPUT,rtfOutput);
13038 }
13039
13040 if (generateMan)
13041 {
13042 manOutput = createOutputDirectory(outputDirectory,Config_getString(MAN_OUTPUT),"/man");
13043 Config_updateString(MAN_OUTPUT,manOutput);
13044 }
13045
13046 if (generateSql)
13047 {
13048 sqlOutput = createOutputDirectory(outputDirectory,Config_getString(SQLITE3_OUTPUT),"/sqlite3");
13049 Config_updateString(SQLITE3_OUTPUT,sqlOutput);
13050 }
13051 }
13052
13053 if (Config_getBool(HAVE_DOT))
13054 {
13055 DString curFontPath = Config_getString(DOT_FONTPATH);
13056 if (curFontPath.empty())
13057 {
13058 Portable::getenv("DOTFONTPATH");
13059 DString newFontPath = ".";
13060 if (!curFontPath.empty())
13061 {
13062 newFontPath+=Portable::pathListSeparator();
13063 newFontPath+=curFontPath;
13064 }
13065 Portable::setenv("DOTFONTPATH",qPrint(newFontPath));
13066 }
13067 else
13068 {
13069 Portable::setenv("DOTFONTPATH",qPrint(curFontPath));
13070 }
13071 }
13072
13073 /**************************************************************************
13074 * Handle layout file *
13075 **************************************************************************/
13076
13078 DString layoutFileName = Config_getString(LAYOUT_FILE);
13079 bool defaultLayoutUsed = false;
13080 if (layoutFileName.empty())
13081 {
13082 layoutFileName = Config_updateString(LAYOUT_FILE,"DoxygenLayout.xml");
13083 defaultLayoutUsed = true;
13084 }
13085 AUTO_TRACE_ADD("defaultLayoutUsed={}, layoutFileName={}",defaultLayoutUsed,layoutFileName);
13086
13087 FileInfo fi(layoutFileName.str());
13088 if (fi.exists())
13089 {
13090 msg("Parsing layout file {}...\n",layoutFileName);
13091 LayoutDocManager::instance().parse(layoutFileName);
13092 }
13093 else if (!defaultLayoutUsed)
13094 {
13095 warn_uncond("failed to open layout file '{}' for reading! Using default settings.\n",layoutFileName);
13096 }
13097 printLayout();
13098
13099 /**************************************************************************
13100 * Read and preprocess input *
13101 **************************************************************************/
13102
13103 // prevent search in the output directories
13104 StringVector exclPatterns = Config_getList(EXCLUDE_PATTERNS);
13105 if (generateHtml) exclPatterns.push_back(htmlOutput.str());
13106 if (generateDocbook) exclPatterns.push_back(docbookOutput.str());
13107 if (generateXml) exclPatterns.push_back(xmlOutput.str());
13108 if (generateLatex) exclPatterns.push_back(latexOutput.str());
13109 if (generateRtf) exclPatterns.push_back(rtfOutput.str());
13110 if (generateMan) exclPatterns.push_back(manOutput.str());
13111 Config_updateList(EXCLUDE_PATTERNS,exclPatterns);
13112
13113 if (!g_singleComment)
13114 {
13116
13118 }
13119
13120 // Notice: the order of the function calls below is very important!
13121
13122 if (generateHtml && !Config_getBool(USE_MATHJAX))
13123 {
13125 }
13126 if (generateRtf)
13127 {
13129 }
13130 if (generateDocbook)
13131 {
13133 }
13134
13136
13137 /**************************************************************************
13138 * Handle Tag Files *
13139 **************************************************************************/
13140
13141 std::shared_ptr<Entry> root = std::make_shared<Entry>();
13142
13143 if (!g_singleComment)
13144 {
13145 msg("Reading and parsing tag files\n");
13146 StringVector tagFileList = Config_getList(TAGFILES);
13147 for (const auto &s : tagFileList)
13148 {
13149 readTagFile(root,s.c_str());
13150 }
13151 }
13152
13153 /**************************************************************************
13154 * Parse source files *
13155 **************************************************************************/
13156
13157 addSTLSupport(root);
13158
13159 g_s.begin("Parsing files\n");
13160 if (g_singleComment)
13161 {
13162 //printf("Parsing comment %s\n",qPrint(g_commentFileName));
13163 if (g_commentFileName=="-")
13164 {
13165 std::string text = fileToString(g_commentFileName).str();
13166 addTerminalCharIfMissing(text,'\n');
13167 generateHtmlForComment("stdin.md",text);
13168 }
13169 else if (FileInfo(g_commentFileName.str()).isFile())
13170 {
13171 std::string text;
13173 addTerminalCharIfMissing(text,'\n');
13175 }
13176 else
13177 {
13178 }
13180 exit(0);
13181 }
13182 else
13183 {
13184 if (Config_getInt(NUM_PROC_THREADS)==1)
13185 {
13187 }
13188 else
13189 {
13191 }
13192 }
13193 g_s.end();
13194
13195 /**************************************************************************
13196 * Gather information *
13197 **************************************************************************/
13198
13199 g_s.begin("Building macro definition list...\n");
13201 g_s.end();
13202
13203 g_s.begin("Building group list...\n");
13204 buildGroupList(root.get());
13205 organizeSubGroups(root.get());
13206 g_s.end();
13207
13208 g_s.begin("Building directory list...\n");
13210 findDirDocumentation(root.get());
13211 g_s.end();
13212
13213 g_s.begin("Building namespace list...\n");
13214 buildNamespaceList(root.get());
13215 findUsingDirectives(root.get());
13216 g_s.end();
13217
13218 g_s.begin("Building file list...\n");
13219 buildFileList(root.get());
13220 g_s.end();
13221
13222 g_s.begin("Building class list...\n");
13223 buildClassList(root.get());
13224 g_s.end();
13225
13226 g_s.begin("Building concept list...\n");
13227 buildConceptList(root.get());
13228 g_s.end();
13229
13230 // build list of using declarations here (global list)
13231 buildListOfUsingDecls(root.get());
13232 g_s.end();
13233
13234 g_s.begin("Computing nesting relations for classes...\n");
13236 g_s.end();
13237 // 1.8.2-20121111: no longer add nested classes to the group as well
13238 //distributeClassGroupRelations();
13239
13240 // calling buildClassList may result in cached relations that
13241 // become invalid after resolveClassNestingRelations(), that's why
13242 // we need to clear the cache here
13244 // we don't need the list of using declaration anymore
13245 g_usingDeclarations.clear();
13246
13247 g_s.begin("Associating documentation with classes...\n");
13248 buildClassDocList(root.get());
13249 g_s.end();
13250
13251 g_s.begin("Associating documentation with concepts...\n");
13252 buildConceptDocList(root.get());
13254 g_s.end();
13255
13256 g_s.begin("Associating documentation with modules...\n");
13257 findModuleDocumentation(root.get());
13258 g_s.end();
13259
13260 g_s.begin("Building example list...\n");
13261 buildExampleList(root.get());
13262 g_s.end();
13263
13264 g_s.begin("Searching for enumerations...\n");
13265 findEnums(root.get());
13266 g_s.end();
13267
13268 // Since buildVarList calls isVarWithConstructor
13269 // and this calls getResolvedClass we need to process
13270 // typedefs first so the relations between classes via typedefs
13271 // are properly resolved. See bug 536385 for an example.
13272 g_s.begin("Searching for documented typedefs...\n");
13273 buildTypedefList(root.get());
13274 g_s.end();
13275
13276 if (Config_getBool(OPTIMIZE_OUTPUT_SLICE))
13277 {
13278 g_s.begin("Searching for documented sequences...\n");
13279 buildSequenceList(root.get());
13280 g_s.end();
13281
13282 g_s.begin("Searching for documented dictionaries...\n");
13283 buildDictionaryList(root.get());
13284 g_s.end();
13285 }
13286
13287 g_s.begin("Searching for members imported via using declarations...\n");
13288 // this should be after buildTypedefList in order to properly import
13289 // used typedefs
13290 findUsingDeclarations(root.get(),true); // do for python packages first
13291 findUsingDeclarations(root.get(),false); // then the rest
13292 g_s.end();
13293
13294 g_s.begin("Searching for included using directives...\n");
13296 g_s.end();
13297
13298 g_s.begin("Searching for documented variables...\n");
13299 buildVarList(root.get());
13300 g_s.end();
13301
13302 g_s.begin("Building interface member list...\n");
13303 buildInterfaceAndServiceList(root.get()); // UNO IDL
13304
13305 g_s.begin("Building member list...\n"); // using class info only !
13306 buildFunctionList(root.get());
13307 g_s.end();
13308
13309 g_s.begin("Searching for friends...\n");
13310 findFriends();
13311 g_s.end();
13312
13313 g_s.begin("Searching for documented defines...\n");
13314 findDefineDocumentation(root.get());
13315 g_s.end();
13316
13317 g_s.begin("Computing class inheritance relations...\n");
13318 findClassEntries(root.get());
13320 g_s.end();
13321
13322 g_s.begin("Computing class usage relations...\n");
13324 g_s.end();
13325
13326 g_s.begin("Flushing cached template relations that have become invalid...\n");
13328 g_s.end();
13329
13330 g_s.begin("Warn for undocumented namespaces...\n");
13332 g_s.end();
13333
13334 g_s.begin("Computing class relations...\n");
13337 if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
13338 {
13340 }
13342 g_classEntries.clear();
13343 g_s.end();
13344
13345 g_s.begin("Add enum values to enums...\n");
13346 addEnumValuesToEnums(root.get());
13347 findEnumDocumentation(root.get());
13348 g_s.end();
13349
13350 g_s.begin("Searching for member function documentation...\n");
13351 findObjCMethodDefinitions(root.get());
13352 findMemberDocumentation(root.get()); // may introduce new members !
13353 findFieldDocumentation(root.get());
13354 findUsingDeclImports(root.get()); // may introduce new members !
13355 g_usingClassMap.clear();
13359 g_s.end();
13360
13361 // moved to after finding and copying documentation,
13362 // as this introduces new members see bug 722654
13363 g_s.begin("Creating members for template instances...\n");
13365 g_s.end();
13366
13367 g_s.begin("Searching for tag less structs...\n");
13369 g_s.end();
13370
13371 g_s.begin("Building page list...\n");
13372 buildPageList(root.get());
13373 g_s.end();
13374
13375 g_s.begin("Building requirements list...\n");
13376 buildRequirementsList(root.get());
13377 g_s.end();
13378
13379 g_s.begin("Search for main page...\n");
13380 findMainPage(root.get());
13381 findMainPageTagFiles(root.get());
13382 g_s.end();
13383
13384 g_s.begin("Computing page relations...\n");
13385 computePageRelations(root.get());
13387 g_s.end();
13388
13389 g_s.begin("Determining the scope of groups...\n");
13390 findGroupScope(root.get());
13391 g_s.end();
13392
13393 g_s.begin("Computing module relations...\n");
13394 auto &mm = ModuleManager::instance();
13395 mm.resolvePartitions();
13396 mm.resolveImports();
13397 mm.collectExportedSymbols();
13398 g_s.end();
13399
13400 auto memberNameComp = [](const MemberNameLinkedMap::Ptr &n1,const MemberNameLinkedMap::Ptr &n2)
13401 {
13402 return dstricmp_sort(n1->memberName().data()+getPrefixIndex(n1->memberName()),
13403 n2->memberName().data()+getPrefixIndex(n2->memberName())
13404 )<0;
13405 };
13406
13407 auto classComp = [](const ClassLinkedMap::Ptr &c1,const ClassLinkedMap::Ptr &c2)
13408 {
13409 if (Config_getBool(SORT_BY_SCOPE_NAME))
13410 {
13411 return dstricmp_sort(c1->name(), c2->name())<0;
13412 }
13413 else
13414 {
13415 int i = dstricmp_sort(c1->className(), c2->className());
13416 return i==0 ? dstricmp_sort(c1->name(), c2->name())<0 : i<0;
13417 }
13418 };
13419
13420 auto namespaceComp = [](const NamespaceLinkedMap::Ptr &n1,const NamespaceLinkedMap::Ptr &n2)
13421 {
13422 return dstricmp_sort(n1->name(),n2->name())<0;
13423 };
13424
13425 auto conceptComp = [](const ConceptLinkedMap::Ptr &c1,const ConceptLinkedMap::Ptr &c2)
13426 {
13427 return dstricmp_sort(c1->name(),c2->name())<0;
13428 };
13429
13430 g_s.begin("Sorting lists...\n");
13431 std::stable_sort(Doxygen::memberNameLinkedMap->begin(),
13433 memberNameComp);
13434 std::stable_sort(Doxygen::functionNameLinkedMap->begin(),
13436 memberNameComp);
13437 std::stable_sort(Doxygen::hiddenClassLinkedMap->begin(),
13439 classComp);
13440 std::stable_sort(Doxygen::classLinkedMap->begin(),
13442 classComp);
13443 std::stable_sort(Doxygen::conceptLinkedMap->begin(),
13445 conceptComp);
13446 std::stable_sort(Doxygen::namespaceLinkedMap->begin(),
13448 namespaceComp);
13449 g_s.end();
13450
13451 g_s.begin("Determining which enums are documented\n");
13453 g_s.end();
13454
13455 g_s.begin("Computing member relations...\n");
13458 g_s.end();
13459
13460 g_s.begin("Building full member lists recursively...\n");
13462 g_s.end();
13463
13464 g_s.begin("Adding members to member groups.\n");
13466 g_s.end();
13467
13468 if (Config_getBool(DISTRIBUTE_GROUP_DOC))
13469 {
13470 g_s.begin("Distributing member group documentation.\n");
13472 g_s.end();
13473 }
13474
13475 g_s.begin("Computing member references...\n");
13477 g_s.end();
13478
13479 if (Config_getBool(INHERIT_DOCS))
13480 {
13481 g_s.begin("Inheriting documentation...\n");
13483 g_s.end();
13484 }
13485
13486
13487 // compute the shortest possible names of all files
13488 // without losing the uniqueness of the file names.
13489 g_s.begin("Generating disk names...\n");
13491 g_s.end();
13492
13493 g_s.begin("Adding source references...\n");
13495 g_s.end();
13496
13497 g_s.begin("Adding xrefitems...\n");
13500 g_s.end();
13501
13502 g_s.begin("Adding requirements...\n");
13505 g_s.end();
13506
13507 g_s.begin("Sorting member lists...\n");
13509 g_s.end();
13510
13511 g_s.begin("Setting anonymous enum type...\n");
13513 g_s.end();
13514
13515 g_s.begin("Computing dependencies between directories...\n");
13517 g_s.end();
13518
13519 g_s.begin("Generating citations page...\n");
13521 g_s.end();
13522
13523 g_s.begin("Counting data structures...\n");
13525 g_s.end();
13526
13527 g_s.begin("Resolving user defined references...\n");
13529 g_s.end();
13530
13531 g_s.begin("Finding anchors and sections in the documentation...\n");
13533 g_s.end();
13534
13535 g_s.begin("Transferring function references...\n");
13537 g_s.end();
13538
13539 g_s.begin("Combining using relations...\n");
13541 g_s.end();
13542
13544 g_s.begin("Adding members to index pages...\n");
13546 addToIndices();
13547 g_s.end();
13548
13549 g_s.begin("Correcting members for VHDL...\n");
13551 g_s.end();
13552
13553 g_s.begin("Computing tooltip texts...\n");
13555 g_s.end();
13556
13557 if (Config_getBool(SORT_GROUP_NAMES))
13558 {
13559 std::stable_sort(Doxygen::groupLinkedMap->begin(),
13561 [](const auto &g1,const auto &g2)
13562 { return g1->groupTitle() < g2->groupTitle(); });
13563
13564 for (const auto &gd : *Doxygen::groupLinkedMap)
13565 {
13566 gd->sortSubGroups();
13567 }
13568 }
13569
13570 printNavTree(root.get(),0);
13572}
void generatePage()
Generate the citations page.
Definition cite.cpp:336
A class that generates docset files.
Definition docsets.h:35
Generator for Eclipse help files.
Definition eclipsehelp.h:42
A class that generates a dynamic tree view side panel.
Definition ftvhelp.h:41
bool isFile() const
Definition fileinfo.cpp:68
void initFromRepository(const DString &dir)
Definition formula.cpp:60
void checkRepositories()
Definition formula.cpp:173
A class that generated the HTML Help specific files.
Definition htmlhelp.h:37
void countDataStructures()
Definition index.cpp:270
void initialize()
Definition indexlist.h:101
void addIndex(As &&... args)
Add an index generator to the list, using a syntax similar to std::make_unique<T>().
Definition indexlist.h:98
void parse(const DString &fileName, const char *data=nullptr)
Parses a user provided layout.
Definition layout.cpp:1509
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1476
Definition qhp.h:29
static void computeVhdlComponentRelations()
#define Config_updateList(name,...)
Definition config.h:43
DirIterator begin(DirIterator it) noexcept
Definition dir.cpp:175
void buildDirectories()
Definition dirdef.cpp:1099
void computeDirDependencies()
Definition dirdef.cpp:1173
static void findInheritedTemplateInstances()
Definition doxygen.cpp:5557
void printNavTree(Entry *root, int indent)
static void buildGroupList(const Entry *root)
Definition doxygen.cpp:540
static void flushCachedTemplateRelations()
Definition doxygen.cpp:9877
static void computeTemplateClassRelations()
Definition doxygen.cpp:5651
void printSectionsTree()
static void generateXRefPages()
Definition doxygen.cpp:5830
static void warnUndocumentedNamespaces()
Definition doxygen.cpp:5606
static void resolveClassNestingRelations()
Definition doxygen.cpp:1395
static void vhdlCorrectMemberProperties()
Definition doxygen.cpp:8792
static void stopDoxygen(int)
static void computeMemberReferences()
Definition doxygen.cpp:5720
static void transferRelatedFunctionDocumentation()
Definition doxygen.cpp:4681
static void addMembersToMemberGroup()
Definition doxygen.cpp:9742
static void distributeConceptGroups()
Definition doxygen.cpp:1362
static void transferFunctionDocumentation()
Definition doxygen.cpp:4600
static void setAnonymousEnumType()
Definition doxygen.cpp:9482
static void sortMemberLists()
Definition doxygen.cpp:9387
static void createTemplateInstanceMembers()
Definition doxygen.cpp:8960
void transferStaticInstanceInitializers()
Definition doxygen.cpp:4730
static void findObjCMethodDefinitions(const Entry *root)
Definition doxygen.cpp:7936
static void distributeMemberGroupDocumentation()
Definition doxygen.cpp:9780
static void resolveUserReferences()
static void findIncludedUsingDirectives()
Definition doxygen.cpp:2733
static void organizeSubGroups(const Entry *root)
Definition doxygen.cpp:599
void searchInputFiles()
static void findFriends()
Definition doxygen.cpp:4503
static DString g_commentFileName
Definition doxygen.cpp:196
static void addListReferences()
Definition doxygen.cpp:5821
static void exitDoxygen() noexcept
static void addMembersToIndex()
Definition doxygen.cpp:8582
static void addSourceReferences()
Definition doxygen.cpp:9260
static void inheritDocumentation()
Definition doxygen.cpp:9682
static void flushUnresolvedRelations()
Definition doxygen.cpp:9919
static void findDocumentedEnumValues()
Definition doxygen.cpp:8574
static void generateDiskNames()
static void addToIndices()
Definition doxygen.cpp:8624
static void computeClassRelations()
Definition doxygen.cpp:5626
static void checkPageRelations()
static void readTagFile(const std::shared_ptr< Entry > &root, const DString &tagLine)
static void addRequirementReferences()
Definition doxygen.cpp:5813
static void computeVerifiedDotPath()
static bool g_singleComment
Definition doxygen.cpp:197
static void findSectionsInDocumentation()
Definition doxygen.cpp:9818
static void mergeCategories()
Definition doxygen.cpp:8979
static void findUsedTemplateInstances()
Definition doxygen.cpp:5590
static void computeTooltipTexts()
Definition doxygen.cpp:9436
static void parseFilesSingleThreading(const std::shared_ptr< Entry > &root)
parse the list of input files
static void buildCompleteMemberLists()
Definition doxygen.cpp:9000
static void combineUsingRelations()
Definition doxygen.cpp:9717
static void checkMarkdownMainfile()
static void parseFilesMultiThreading(const std::shared_ptr< Entry > &root)
parse the list of input files
static DString createOutputDirectory(const DString &baseDirName, const DString &formatDirName, const char *defaultDirName)
static void transferFunctionReferences()
Definition doxygen.cpp:4633
static void buildDefineList()
Definition doxygen.cpp:9339
static void computeMemberRelations()
Definition doxygen.cpp:8943
int dstricmp_sort(const char *str1, const char *str2)
Definition dstring.h:67
void printLayout()
Definition layout.cpp:1861
void correctPath(const StringVector &list)
Correct a possible wrong PATH variable.
Definition portable.cpp:532
uint32_t pid()
Definition portable.cpp:264
DString pathListSeparator()
Definition portable.cpp:399
void initSearchIndexer()
void generateHtmlForComment(const std::string &fn, const std::string &text)
Helper for implemented the -c option of doxygen, which produces HTML output for a given doxygen forma...
void addSTLSupport(std::shared_ptr< Entry > &root)
Add stub entries for the most used classes in the standard template library.
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1058
int getPrefixIndex(const DString &name)
Definition util.cpp:2783

References Dir::absPath(), addEnumValuesToEnums(), IndexList::addIndex(), addListReferences(), addMembersToIndex(), addMembersToMemberGroup(), addRequirementReferences(), addSourceReferences(), addSTLSupport(), addTerminalCharIfMissing(), addToIndices(), SymbolResolver::All, AUTO_TRACE, AUTO_TRACE_ADD, begin(), Statistics::begin(), buildClassDocList(), buildClassList(), buildCompleteMemberLists(), buildConceptDocList(), buildConceptList(), buildDefineList(), buildDictionaryList(), buildDirectories(), buildExampleList(), buildFileList(), buildFunctionList(), buildGroupList(), buildInterfaceAndServiceList(), buildListOfUsingDecls(), buildNamespaceList(), buildPageList(), buildRequirementsList(), buildSequenceList(), buildTypedefList(), buildVarList(), checkMarkdownMainfile(), checkPageRelations(), FormulaManager::checkRepositories(), Doxygen::clangAssistedParsing, Doxygen::classLinkedMap, cleanUpDoxygen(), SymbolResolver::clearTypeLookupCache(), combineUsingRelations(), computeClassRelations(), computeDirDependencies(), computeMemberReferences(), computeMemberRelations(), computePageRelations(), computeTemplateClassRelations(), computeTooltipTexts(), computeVerifiedDotPath(), VhdlDocGen::computeVhdlComponentRelations(), Doxygen::conceptLinkedMap, Config_getBool, Config_getInt, Config_getList, Config_getString, Config_updateList, Config_updateString, Portable::correctPath(), Index::countDataStructures(), createOutputDirectory(), createTemplateInstanceMembers(), Dir::currentDirPath(), distributeConceptGroups(), distributeMemberGroupDocumentation(), dstricmp_sort(), DString::empty(), end(), Statistics::end(), DString::endsWith(), Dir::exists(), FileInfo::exists(), exitDoxygen(), fileToString(), Doxygen::filterDBFileName, findClassEntries(), findDefineDocumentation(), findDirDocumentation(), findDocumentedEnumValues(), findEnumDocumentation(), findEnums(), findFieldDocumentation(), findFriends(), findGroupScope(), findIncludedUsingDirectives(), findInheritedTemplateInstances(), findMainPage(), findMainPageTagFiles(), findMemberDocumentation(), findModuleDocumentation(), findObjCMethodDefinitions(), findSectionsInDocumentation(), findTagLessClasses(), findUsedTemplateInstances(), findUsingDeclarations(), findUsingDeclImports(), findUsingDirectives(), flushCachedTemplateRelations(), flushUnresolvedRelations(), Doxygen::functionNameLinkedMap, g_classEntries, g_commentFileName, g_s, g_singleComment, g_usingClassMap, g_usingDeclarations, generateDiskNames(), generateHtmlForComment(), CitationManager::generatePage(), RequirementManager::generatePage(), generateXRefPages(), Portable::getenv(), getPrefixIndex(), Doxygen::groupLinkedMap, Doxygen::hiddenClassLinkedMap, Doxygen::indexList, inheritDocumentation(), LayoutDocManager::init(), FormulaManager::initFromRepository(), IndexList::initialize(), initSearchIndexer(), CitationManager::instance(), FormulaManager::instance(), Index::instance(), LayoutDocManager::instance(), ModuleManager::instance(), RequirementManager::instance(), FileInfo::isFile(), Doxygen::memberNameLinkedMap, mergeCategories(), Dir::mkdir(), msg, Doxygen::namespaceLinkedMap, organizeSubGroups(), LayoutDocManager::parse(), parseFilesMultiThreading(), parseFilesSingleThreading(), Portable::pathListSeparator(), Portable::pid(), DString::prepend(), printLayout(), printNavTree(), printSectionsTree(), qPrint(), readInputFile(), readTagFile(), resolveClassNestingRelations(), resolveUserReferences(), searchInputFiles(), setAnonymousEnumType(), Portable::setenv(), Dir::setPath(), sortMemberLists(), DString::sprintf(), stopDoxygen(), DString::str(), term, transferFunctionDocumentation(), transferFunctionReferences(), transferRelatedFunctionDocumentation(), transferStaticInstanceInitializers(), vhdlCorrectMemberProperties(), warn_uncond, and warnUndocumentedNamespaces().

Referenced by main().

◆ printNavTree()

void printNavTree ( Entry * root,
int indent )

Definition at line 10422 of file doxygen.cpp.

10423{
10425 {
10426 DString indentStr;
10427 indentStr.fill(' ',indent);
10428 Debug::print(Debug::Entries,0,"{}{} at {}:{} (sec={}, spec={})\n",
10429 indentStr.empty()?"":indentStr,
10430 root->name.empty()?"<empty>":root->name,
10431 root->fileName,root->startLine,
10432 root->section.to_string(),
10433 root->spec.to_string());
10434 for (const auto &e : root->children())
10435 {
10436 printNavTree(e.get(),indent+2);
10437 }
10438 }
10439}
DString fill(char c, size_t len)
Fills a string with a predefined character.
Definition dstring.h:278
@ Entries
Definition debug.h:48
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:78
std::string to_string() const
Definition types.h:872
std::string to_string() const
Definition types.h:740

References Entry::children(), DString::empty(), Debug::Entries, Entry::fileName, DString::fill(), Debug::isFlagSet(), Entry::name, Debug::print(), printNavTree(), Entry::section, Entry::spec, Entry::startLine, EntryType::to_string(), and TypeSpecifier::to_string().

Referenced by parseInput(), and printNavTree().

◆ printSectionsTree()

void printSectionsTree ( )

Definition at line 10445 of file doxygen.cpp.

10446{
10448 {
10449 for (const auto &si : SectionManager::instance())
10450 {
10451 Debug::print(Debug::Sections,0,"Section = {}, file = {}, title = {}, type = {}, ref = {}\n",
10452 si->label(),si->fileName(),si->title(),si->type().level(),si->ref());
10453 }
10454 }
10455}
@ Sections
Definition debug.h:49

References SectionManager::instance(), Debug::isFlagSet(), Debug::print(), and Debug::Sections.

Referenced by parseInput().

◆ processTagLessClasses()

template<typename Container, typename TagContainer>
void processTagLessClasses ( const Definition * root,
const Container * def,
const TagContainer * tagParent,
MemberListType varFilter,
MemberListType typeFilter,
const DString & prefix,
int count )
static

Look through the members of class cd and its public members.

If there is a member m of a tag less struct/union, then we create a duplicate of the struct/union with the name of the member to identify it. So if cd has name S, then the tag less struct/union will get name S.m Since tag less structs can be nested we need to call this function recursively. Later on we need to patch the member types so we keep track of the hierarchy of classes we create.

Definition at line 1901 of file doxygen.cpp.

1907{
1908 if (varFilter==MemberListType::PubAttribs()) // also handle protected and private members
1909 {
1910 processTagLessClassesForList(root,def,tagParent,MemberListType::PubAttribs(),MemberListType::PubTypes(),prefix,count);
1911 processTagLessClassesForList(root,def,tagParent,MemberListType::ProAttribs(),MemberListType::ProTypes(),prefix,count);
1912 processTagLessClassesForList(root,def,tagParent,MemberListType::PriAttribs(),MemberListType::PriTypes(),prefix,count);
1913 }
1914 else
1915 {
1916 processTagLessClassesForList(root,def,tagParent,varFilter,typeFilter,prefix,count);
1917 }
1918}
static void processTagLessClassesForList(const Definition *root, const Container *def, const TagContainer *tagParent, MemberListType varFilter, MemberListType typeFilter, const DString &prefix, int count)
Definition doxygen.cpp:1794

References prefix, and processTagLessClassesForList().

Referenced by findTagLessClasses(), and processTagLessClassesForList().

◆ processTagLessClassesForList()

template<typename Container, typename TagContainer>
void processTagLessClassesForList ( const Definition * root,
const Container * def,
const TagContainer * tagParent,
MemberListType varFilter,
MemberListType typeFilter,
const DString & prefix,
int count )
static

Definition at line 1794 of file doxygen.cpp.

1800{
1801 AUTO_TRACE("count={} name={}\n",count,def->name());
1802 if (tagParent)
1803 {
1804 MemberList *ml = def->getMemberList(varFilter);
1805 if (ml)
1806 {
1807 int pos=0;
1808 // make a copy of the member list, since we may add new members to the list while iterating over it
1809 std::vector<MemberDef *> members;
1810 for (const auto &md : *ml)
1811 {
1812 members.push_back(md);
1813 }
1814 for (const auto &md : members)
1815 {
1816 MemberDefMutable *pmdm = nullptr;
1817 if (tagParent!=def)
1818 {
1819 // associate the variable of the anonymous type with the type member
1820 MemberList *pml = tagParent->getMemberList(varFilter);
1821 if (pml)
1822 {
1823 for (const auto &pmd : *pml)
1824 {
1825 if (pmd->name()==md->name())
1826 {
1827 pmdm = toMemberDefMutable(pmd);
1828 }
1829 }
1830 }
1831 }
1832 else
1833 {
1834 pmdm = toMemberDefMutable(md);
1835 }
1836 bool hasNamedVariable = pmdm==nullptr || !pmdm->isAnonymous();
1837
1838 DString type = md->typeString();
1839 //printf(" member %s: type='%s' outerScope='%s'\n",qPrint(md->name()),qPrint(type),qPrint(md->getOuterScope()?md->getOuterScope()->name():"<null>"));
1840 if ((def->definitionType()!=Definition::TypeFile || md->getOuterScope()==Doxygen::globalScope) && // parse namespace members only if def is a namespace
1841 (type.find("::@")!=DString::npos || type.find(" @")!=DString::npos)) // member of tag less struct/union
1842 {
1843 // make a copy of the class list, since we may add new members to the list while iterating over it
1844 std::vector<const ClassDef *> candidates;
1845 for (const auto &icd : def->getClasses())
1846 {
1847 candidates.push_back(icd);
1848 }
1849 for (const auto &icd : candidates)
1850 {
1851 //printf(" comparing '%s'<->'%s'\n",qPrint(type),qPrint(icd->name()));
1852 if (type.find(icd->name())!=DString::npos) // matching tag less struct/union
1853 {
1854 DString name = md->name();
1855 if (md->isAnonymous()) name = "__unnamed" + DString().setNum(pos++)+"__"; // TODO: remove dead code
1856 if (!prefix.empty()) name.prepend(prefix+".");
1857 //printf(" found %s in scope %s\n",qPrint(name),qPrint(def->name()));
1858 ClassDefMutable *ncd = createTagLessInstance(root,icd,name,hasNamedVariable);
1859 if (ncd)
1860 {
1861 processTagLessClasses(ncd,icd,ncd,MemberListType::PubAttribs(),MemberListType::PubTypes(),name,count+1);
1862 //printf(" addTagged %s to %s\n",qPrint(ncd->name()),qPrint(tagParent->name()));
1863 ncd->setTaglessParent(icd);
1864 if (pmdm)
1865 {
1866 pmdm->setClassDefOfAnonymousType(ncd);
1867 }
1868 }
1869 }
1870 else
1871 {
1872 //printf(" no match for %s in %s\n",qPrint(icd->name()),qPrint(type));
1873 }
1874 }
1875 }
1876 }
1877 }
1878 // associate the variable of the anonymous enum type with the type member
1879 ml = def->getMemberList(typeFilter);
1880 if (ml)
1881 {
1882 for (const auto &md : *ml)
1883 {
1884 MemberListType mlFilter = def->definitionType()==Definition::TypeClass ? varFilter : MemberListType::DecVarMembers();
1885 associateVariableWithAnonymousEnumType(md,def,md,mlFilter);
1886 }
1887 }
1888 }
1889}
virtual void setTaglessParent(const ClassDef *cd)=0
DString & setNum(short n)
Definition dstring.h:552
Wrapper class for the MemberListType type.
Definition types.h:346
static ClassDefMutable * createTagLessInstance(const Definition *root, const ClassDef *templ, const DString &fieldName, bool hasNamedVariable)
Definition doxygen.cpp:1576

References associateVariableWithAnonymousEnumType(), AUTO_TRACE, createTagLessInstance(), DString::find(), Doxygen::globalScope, Definition::isAnonymous(), DString::npos, prefix, processTagLessClasses(), MemberDefMutable::setClassDefOfAnonymousType(), DString::setNum(), ClassDefMutable::setTaglessParent(), toMemberDefMutable(), Definition::TypeClass, and Definition::TypeFile.

Referenced by processTagLessClasses().

◆ readConfiguration()

void readConfiguration ( int argc,
char ** argv )

Definition at line 11951 of file doxygen.cpp.

11952{
11953 DString versionString = getFullVersion();
11954
11955 // helper that calls \a func to write to file \a fileName via a TextStream
11956 auto writeFile = [](const char *fileName,std::function<void(TextStream&)> func) -> bool
11957 {
11958 std::ofstream f;
11959 if (openOutputFile(fileName,f))
11960 {
11961 TextStream t(&f);
11962 func(t);
11963 return true;
11964 }
11965 return false;
11966 };
11967
11968
11969 /**************************************************************************
11970 * Handle arguments *
11971 **************************************************************************/
11972
11973 int optInd=1;
11974 DString configName;
11975 DString traceName;
11976 bool genConfig=false;
11977 bool shortList=false;
11978 bool traceTiming=false;
11980 bool updateConfig=false;
11981 bool quiet = false;
11982 while (optInd<argc && argv[optInd][0]=='-' &&
11983 (isalpha(argv[optInd][1]) || argv[optInd][1]=='?' ||
11984 argv[optInd][1]=='-')
11985 )
11986 {
11987 switch(argv[optInd][1])
11988 {
11989 case 'g':
11990 {
11991 genConfig=true;
11992 }
11993 break;
11994 case 'l':
11995 {
11996 DString layoutName;
11997 if (optInd+1>=argc)
11998 {
11999 layoutName="DoxygenLayout.xml";
12000 }
12001 else
12002 {
12003 layoutName=argv[optInd+1];
12004 }
12005 writeDefaultLayoutFile(layoutName);
12007 exit(0);
12008 }
12009 break;
12010 case 'c':
12011 if (optInd+1>=argc) // no file name given
12012 {
12013 msg("option \"-c\" is missing the file name to read\n");
12014 devUsage();
12016 exit(1);
12017 }
12018 else
12019 {
12020 g_commentFileName=argv[optInd+1];
12021 optInd++;
12022 }
12023 g_singleComment=true;
12024 quiet=true;
12025 break;
12026 case 'd':
12027 {
12028 DString debugLabel=getArg(argc,argv,optInd);
12029 if (debugLabel.empty())
12030 {
12031 devUsage();
12033 exit(0);
12034 }
12035 int retVal = Debug::setFlagStr(debugLabel);
12036 if (!retVal)
12037 {
12038 msg("option \"-d\" has unknown debug specifier: \"{}\".\n",debugLabel);
12039 devUsage();
12041 exit(1);
12042 }
12043 }
12044 break;
12045 case 't':
12046 {
12047#if ENABLE_TRACING
12048 if (!strcmp(argv[optInd]+1,"t_time"))
12049 {
12050 traceTiming = true;
12051 }
12052 else if (!strcmp(argv[optInd]+1,"t"))
12053 {
12054 traceTiming = false;
12055 }
12056 else
12057 {
12058 err("option should be \"-t\" or \"-t_time\", found: \"{}\".\n",argv[optInd]);
12060 exit(1);
12061 }
12062 if (optInd+1>=argc || argv[optInd+1][0] == '-') // no file name given
12063 {
12064 traceName="stdout";
12065 }
12066 else
12067 {
12068 traceName=argv[optInd+1];
12069 optInd++;
12070 }
12071#else
12072 err("support for option \"-t\" has not been compiled in (use a debug build or a release build with tracing enabled).\n");
12074 exit(1);
12075#endif
12076 }
12077 break;
12078 case 'x':
12079 if (!strcmp(argv[optInd]+1,"x_noenv")) diffList=Config::CompareMode::CompressedNoEnv;
12080 else if (!strcmp(argv[optInd]+1,"x")) diffList=Config::CompareMode::Compressed;
12081 else
12082 {
12083 err("option should be \"-x\" or \"-x_noenv\", found: \"{}\".\n",argv[optInd]);
12085 exit(1);
12086 }
12087 break;
12088 case 's':
12089 shortList=true;
12090 break;
12091 case 'u':
12092 updateConfig=true;
12093 break;
12094 case 'e':
12095 {
12096 DString formatName=getArg(argc,argv,optInd);
12097 if (formatName.empty())
12098 {
12099 err("option \"-e\" is missing format specifier rtf.\n");
12101 exit(1);
12102 }
12103 if (dstricmp(formatName.data(),"rtf")==0)
12104 {
12105 if (optInd+1>=argc)
12106 {
12107 err("option \"-e rtf\" is missing an extensions file name\n");
12109 exit(1);
12110 }
12111 writeFile(argv[optInd+1],RTFGenerator::writeExtensionsFile);
12113 exit(0);
12114 }
12115 err("option \"-e\" has invalid format specifier.\n");
12117 exit(1);
12118 }
12119 break;
12120 case 'f':
12121 {
12122 DString listName=getArg(argc,argv,optInd);
12123 if (listName.empty())
12124 {
12125 err("option \"-f\" is missing list specifier.\n");
12127 exit(1);
12128 }
12129 if (dstricmp(listName.data(),"emoji")==0)
12130 {
12131 if (optInd+1>=argc)
12132 {
12133 err("option \"-f emoji\" is missing an output file name\n");
12135 exit(1);
12136 }
12137 writeFile(argv[optInd+1],[](TextStream &t) { EmojiEntityMapper::instance().writeEmojiFile(t); });
12139 exit(0);
12140 }
12141 err("option \"-f\" has invalid list specifier.\n");
12143 exit(1);
12144 }
12145 break;
12146 case 'w':
12147 {
12148 DString formatName=getArg(argc,argv,optInd);
12149 if (formatName.empty())
12150 {
12151 err("option \"-w\" is missing format specifier rtf, html or latex\n");
12153 exit(1);
12154 }
12155 if (dstricmp(formatName.data(),"rtf")==0)
12156 {
12157 if (optInd+1>=argc)
12158 {
12159 err("option \"-w rtf\" is missing a style sheet file name\n");
12161 exit(1);
12162 }
12163 if (!writeFile(argv[optInd+1],RTFGenerator::writeStyleSheetFile))
12164 {
12165 err("error opening RTF style sheet file {}!\n",argv[optInd+1]);
12167 exit(1);
12168 }
12170 exit(0);
12171 }
12172 else if (dstricmp(formatName.data(),"html")==0)
12173 {
12174 Config::init();
12175 if (optInd+4<argc || FileInfo("Doxyfile").exists() || FileInfo("doxyfile").exists())
12176 // explicit config file mentioned or default found on disk
12177 {
12178 DString df = optInd+4<argc ? argv[optInd+4] : (FileInfo("Doxyfile").exists() ? DString("Doxyfile") : DString("doxyfile"));
12179 if (!Config::parse(df)) // parse the config file
12180 {
12181 err("error opening or reading configuration file {}!\n",argv[optInd+4]);
12183 exit(1);
12184 }
12185 }
12186 if (optInd+3>=argc)
12187 {
12188 err("option \"-w html\" does not have enough arguments\n");
12190 exit(1);
12191 }
12192 Config::postProcess(true);
12195 setTranslator(Config_getEnum(OUTPUT_LANGUAGE));
12196 writeFile(argv[optInd+1],[&](TextStream &t) { HtmlGenerator::writeHeaderFile(t,argv[optInd+3]); });
12197 writeFile(argv[optInd+2],HtmlGenerator::writeFooterFile);
12198 writeFile(argv[optInd+3],HtmlGenerator::writeStyleSheetFile);
12200 exit(0);
12201 }
12202 else if (dstricmp(formatName.data(),"latex")==0)
12203 {
12204 Config::init();
12205 if (optInd+4<argc || FileInfo("Doxyfile").exists() || FileInfo("doxyfile").exists())
12206 {
12207 DString df = optInd+4<argc ? argv[optInd+4] : (FileInfo("Doxyfile").exists() ? DString("Doxyfile") : DString("doxyfile"));
12208 if (!Config::parse(df))
12209 {
12210 err("error opening or reading configuration file {}!\n",argv[optInd+4]);
12212 exit(1);
12213 }
12214 }
12215 if (optInd+3>=argc)
12216 {
12217 err("option \"-w latex\" does not have enough arguments\n");
12219 exit(1);
12220 }
12221 Config::postProcess(true);
12224 setTranslator(Config_getEnum(OUTPUT_LANGUAGE));
12225 writeFile(argv[optInd+1],LatexGenerator::writeHeaderFile);
12226 writeFile(argv[optInd+2],LatexGenerator::writeFooterFile);
12227 writeFile(argv[optInd+3],LatexGenerator::writeStyleSheetFile);
12229 exit(0);
12230 }
12231 else
12232 {
12233 err("Illegal format specifier \"{}\": should be one of rtf, html or latex\n",formatName);
12235 exit(1);
12236 }
12237 }
12238 break;
12239 case 'm':
12240 g_dumpSymbolMap = true;
12241 break;
12242 case 'v':
12243 version(false);
12245 exit(0);
12246 break;
12247 case 'V':
12248 version(true);
12250 exit(0);
12251 break;
12252 case '-':
12253 if (dstrcmp(&argv[optInd][2],"help")==0)
12254 {
12255 usage(argv[0],versionString);
12256 exit(0);
12257 }
12258 else if (dstrcmp(&argv[optInd][2],"version")==0)
12259 {
12260 version(false);
12262 exit(0);
12263 }
12264 else if ((dstrcmp(&argv[optInd][2],"Version")==0) ||
12265 (dstrcmp(&argv[optInd][2],"VERSION")==0))
12266 {
12267 version(true);
12269 exit(0);
12270 }
12271 else
12272 {
12273 err("Unknown option \"-{}\"\n",&argv[optInd][1]);
12274 usage(argv[0],versionString);
12275 exit(1);
12276 }
12277 break;
12278 case 'b':
12279 setvbuf(stdout,nullptr,_IONBF,0);
12280 break;
12281 case 'q':
12282 quiet = true;
12283 break;
12284 case 'h':
12285 case '?':
12286 usage(argv[0],versionString);
12287 exit(0);
12288 break;
12289 default:
12290 err("Unknown option \"-{:c}\"\n",argv[optInd][1]);
12291 usage(argv[0],versionString);
12292 exit(1);
12293 }
12294 optInd++;
12295 }
12296
12297 /**************************************************************************
12298 * Parse or generate the config file *
12299 **************************************************************************/
12300
12301 initTracing(traceName.data(),traceTiming);
12302 TRACE("Doxygen version used: {}",getFullVersion());
12303 Config::init();
12304
12305 FileInfo configFileInfo1("Doxyfile"),configFileInfo2("doxyfile");
12306 if (optInd>=argc)
12307 {
12308 if (configFileInfo1.exists())
12309 {
12310 configName="Doxyfile";
12311 }
12312 else if (configFileInfo2.exists())
12313 {
12314 configName="doxyfile";
12315 }
12316 else if (genConfig)
12317 {
12318 configName="Doxyfile";
12319 }
12320 else
12321 {
12322 err("Doxyfile not found and no input file specified!\n");
12323 usage(argv[0],versionString);
12324 exit(1);
12325 }
12326 }
12327 else
12328 {
12329 FileInfo fi(argv[optInd]);
12330 if (fi.exists() || dstrcmp(argv[optInd],"-")==0 || genConfig)
12331 {
12332 configName=argv[optInd];
12333 }
12334 else
12335 {
12336 err("configuration file {} not found!\n",argv[optInd]);
12337 usage(argv[0],versionString);
12338 exit(1);
12339 }
12340 }
12341
12342 if (genConfig)
12343 {
12344 generateConfigFile(configName,shortList);
12346 exit(0);
12347 }
12348
12349 if (!Config::parse(configName,updateConfig,diffList))
12350 {
12351 err("could not open or read configuration file {}!\n",configName);
12353 exit(1);
12354 }
12355
12356 if (diffList!=Config::CompareMode::Full)
12357 {
12359 compareDoxyfile(diffList);
12361 exit(0);
12362 }
12363
12364 if (updateConfig)
12365 {
12367 generateConfigFile(configName,shortList,true);
12369 exit(0);
12370 }
12371
12372 /* Perlmod wants to know the path to the config file.*/
12373 FileInfo configFileInfo(configName.str());
12374 setPerlModDoxyfile(configFileInfo.absFilePath());
12375
12376 /* handle -q option */
12377 if (quiet) Config_updateBool(QUIET,true);
12378}
static bool setFlagStr(const DString &label)
Definition debug.cpp:103
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1981
void writeEmojiFile(TextStream &t)
Writes the list of supported emojis to the given file.
Definition emoji.cpp:2002
bool exists() const
Definition fileinfo.cpp:35
static void writeHeaderFile(TextStream &t, const DString &cssname)
Definition htmlgen.cpp:1629
static void writeFooterFile(TextStream &t)
Definition htmlgen.cpp:1635
static void writeStyleSheetFile(TextStream &t)
Definition htmlgen.cpp:1623
static void writeFooterFile(TextStream &t)
Definition latexgen.cpp:696
static void writeStyleSheetFile(TextStream &t)
Definition latexgen.cpp:702
static void writeHeaderFile(TextStream &t)
Definition latexgen.cpp:690
static void writeStyleSheetFile(TextStream &t)
Definition rtfgen.cpp:397
static void writeExtensionsFile(TextStream &t)
Definition rtfgen.cpp:412
#define Config_updateBool(name, value)
Definition config.h:40
static void compareDoxyfile(Config::CompareMode diffList)
static void devUsage()
static void generateConfigFile(const DString &configFile, bool shortList, bool updateOnly=false)
static void version(const bool extended)
static void usage(const DString &name, const DString &versionString)
static const char * getArg(int argc, char **argv, int &optInd)
int dstricmp(const char *s1, const char *s2)
Definition dstring.cpp:444
int dstrcmp(const char *str1, const char *str2)
Definition dstring.h:50
void writeDefaultLayoutFile(const DString &fileName)
Definition layout.cpp:1773
CompareMode
Definition config.h:54
void init()
bool parse(const DString &fileName, bool update=false, CompareMode compareMode=CompareMode::Full)
void setPerlModDoxyfile(const DString &qs)
void initTracing(const DString &logFile, bool timing)
Definition trace.cpp:25

References FileInfo::absFilePath(), Config::checkAndCorrect(), cleanUpDoxygen(), compareDoxyfile(), Config::Compressed, Config::CompressedNoEnv, Config_getBool, Config_getEnum, Config_updateBool, DString::data(), devUsage(), dstrcmp(), dstricmp(), DString::empty(), err, FileInfo::exists(), Config::Full, g_commentFileName, g_dumpSymbolMap, g_singleComment, generateConfigFile(), getArg(), Config::init(), initTracing(), EmojiEntityMapper::instance(), msg, openOutputFile(), Config::parse(), Config::postProcess(), Debug::setFlagStr(), setPerlModDoxyfile(), setTranslator(), DString::str(), TRACE, Config::updateObsolete(), usage(), version(), writeDefaultLayoutFile(), EmojiEntityMapper::writeEmojiFile(), RTFGenerator::writeExtensionsFile(), HtmlGenerator::writeFooterFile(), LatexGenerator::writeFooterFile(), HtmlGenerator::writeHeaderFile(), LatexGenerator::writeHeaderFile(), HtmlGenerator::writeStyleSheetFile(), LatexGenerator::writeStyleSheetFile(), and RTFGenerator::writeStyleSheetFile().

Referenced by main().

◆ readDir()

void readDir ( FileInfo * fi,
FileNameLinkedMap * fnMap,
StringUnorderedSet * exclSet,
const StringVector * patList,
const StringVector * exclPatList,
StringVector * resultList,
StringUnorderedSet * resultSet,
bool errorIfNotExist,
bool recursive,
StringUnorderedSet * killSet,
StringUnorderedSet * paths )
static

Definition at line 11484 of file doxygen.cpp.

11496{
11497 std::string dirName = fi->absFilePath();
11498 if (paths && !dirName.empty())
11499 {
11500 paths->insert(dirName);
11501 }
11502 //printf("%s isSymLink()=%d\n",qPrint(dirName),fi->isSymLink());
11503 if (fi->isSymLink())
11504 {
11505 dirName = resolveSymlink(dirName);
11506 if (dirName.empty())
11507 {
11508 //printf("RECURSIVE SYMLINK: %s\n",qPrint(dirName));
11509 return; // recursive symlink
11510 }
11511 }
11512
11513 if (g_pathsVisited.find(dirName)!=g_pathsVisited.end())
11514 {
11515 //printf("PATH ALREADY VISITED: %s\n",qPrint(dirName));
11516 return; // already visited path
11517 }
11518 g_pathsVisited.insert(dirName);
11519
11520 Dir dir(dirName);
11521 msg("Searching for files in directory {}\n", fi->absFilePath());
11522 //printf("killSet=%p count=%d\n",killSet,killSet ? (int)killSet->count() : -1);
11523
11524 StringVector dirResultList;
11525
11526 bool caseSenseNames = useCaseSenseNames();
11527
11528 // Process the entries in a fixed order, so that the order in which FileDefs
11529 // are created (which e.g. determines the SHORT_NAMES numbering) and in which
11530 // subdirectories are visited does not depend on the file system.
11531 StringVector entries;
11532 for (const auto &dirEntry : dir.iterator())
11533 {
11534 entries.push_back(dirEntry.path());
11535 }
11536 std::sort(entries.begin(),entries.end());
11537
11538 for (const auto &entryPath : entries)
11539 {
11540 FileInfo cfi(entryPath);
11541 auto checkPatterns = [&]() -> bool
11542 {
11543 return (patList==nullptr || cfi.match(*patList,caseSenseNames)) &&
11544 (exclPatList==nullptr || !cfi.match(*exclPatList,caseSenseNames)) &&
11545 (killSet==nullptr || killSet->find(cfi.absFilePath())==killSet->end());
11546 };
11547
11548 if (exclSet==nullptr || exclSet->find(cfi.absFilePath())==exclSet->end())
11549 { // file should not be excluded
11550 //printf("killSet->find(%s)\n",qPrint(cfi->absFilePath()));
11551 if (Config_getBool(EXCLUDE_SYMLINKS) && cfi.isSymLink())
11552 {
11553 }
11554 else if (!cfi.exists() || !cfi.isReadable())
11555 {
11556 if (errorIfNotExist && checkPatterns())
11557 {
11558 warn_uncond("source '{}' is not a readable file or directory... skipping.\n",cfi.absFilePath());
11559 }
11560 }
11561 else if (cfi.isFile() && checkPatterns())
11562 {
11563 std::string name=cfi.fileName();
11564 std::string path=cfi.dirPath()+"/";
11565 std::string fullName=path+name;
11566 if (fnMap)
11567 {
11568 auto fd = createFileDef(path,name);
11569 FileName *fn=nullptr;
11570 if (!name.empty())
11571 {
11572 fn = fnMap->add(name);
11573 fn->push_back(std::move(fd));
11574 }
11575 }
11576 dirResultList.push_back(fullName);
11577 if (resultSet) resultSet->insert(fullName);
11578 if (killSet) killSet->insert(fullName);
11579 }
11580 else if (recursive &&
11581 cfi.isDir() &&
11582 (exclPatList==nullptr || !cfi.match(*exclPatList,caseSenseNames)) &&
11583 cfi.fileName().at(0)!='.') // skip "." ".." and ".dir"
11584 {
11585 FileInfo acfi(cfi.absFilePath());
11586 readDir(&acfi,fnMap,exclSet,
11587 patList,exclPatList,&dirResultList,resultSet,errorIfNotExist,
11588 recursive,killSet,paths);
11589 }
11590 }
11591 }
11592 if (resultList && !dirResultList.empty())
11593 {
11594 // sort the resulting list to make the order platform independent.
11595 std::stable_sort(dirResultList.begin(),
11596 dirResultList.end(),
11597 [](const auto &f1,const auto &f2) { return dstricmp_sort(f1.c_str(),f2.c_str())<0; });
11598
11599 // append the sorted results to resultList
11600 resultList->insert(resultList->end(), dirResultList.begin(), dirResultList.end());
11601 }
11602}
bool isSymLink() const
Definition fileinfo.cpp:82
Class representing all files with a certain base name.
Definition filename.h:31
static StringUnorderedSet g_pathsVisited(1009)
static std::string resolveSymlink(const std::string &path)
static void readDir(FileInfo *fi, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, const StringVector *patList, const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool errorIfNotExist, bool recursive, StringUnorderedSet *killSet, StringUnorderedSet *paths)
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Definition filedef.cpp:270
bool useCaseSenseNames()
Returns true if the names of the symbols can be case sensitive.
Definition util.cpp:2811

References FileInfo::absFilePath(), LinkedMap< T, Hash, KeyEqual, Map >::add(), Config_getBool, createFileDef(), FileInfo::dirPath(), FileInfo::exists(), FileInfo::fileName(), g_pathsVisited(), FileInfo::isDir(), FileInfo::isFile(), FileInfo::isReadable(), FileInfo::isSymLink(), Dir::iterator(), FileInfo::match(), msg, readDir(), resolveSymlink(), useCaseSenseNames(), and warn_uncond.

Referenced by readDir(), and readFileOrDirectory().

◆ readFileOrDirectory()

void readFileOrDirectory ( const DString & s,
FileNameLinkedMap * fnMap,
StringUnorderedSet * exclSet,
const StringVector * patList,
const StringVector * exclPatList,
StringVector * resultList,
StringUnorderedSet * resultSet,
bool recursive,
bool errorIfNotExist,
StringUnorderedSet * killSet,
StringUnorderedSet * paths )

Definition at line 11609 of file doxygen.cpp.

11621{
11622 //printf("killSet count=%d\n",killSet ? (int)killSet->size() : -1);
11623 // strip trailing slashes
11624 if (s.empty()) return;
11625
11626 g_pathsVisited.clear();
11627
11628 FileInfo fi(s.str());
11629 //printf("readFileOrDirectory(%s)\n",s);
11630 {
11631 if (exclSet==nullptr || exclSet->find(fi.absFilePath())==exclSet->end())
11632 {
11633 if (Config_getBool(EXCLUDE_SYMLINKS) && fi.isSymLink())
11634 {
11635 }
11636 else if (!fi.exists() || !fi.isReadable())
11637 {
11638 if (errorIfNotExist)
11639 {
11640 warn_uncond("source '{}' is not a readable file or directory... skipping.\n",s);
11641 }
11642 }
11643 else if (fi.isFile())
11644 {
11645 std::string dirPath = fi.dirPath(true);
11646 std::string filePath = fi.absFilePath();
11647 if (paths && !dirPath.empty())
11648 {
11649 paths->insert(dirPath);
11650 }
11651 //printf("killSet.find(%s)=%d\n",qPrint(fi.absFilePath()),killSet.find(fi.absFilePath())!=killSet.end());
11652 if (killSet==nullptr || killSet->find(filePath)==killSet->end())
11653 {
11654 std::string name=fi.fileName();
11655 if (fnMap)
11656 {
11657 auto fd = createFileDef(dirPath+"/",name);
11658 if (!name.empty())
11659 {
11660 FileName *fn = fnMap->add(name);
11661 fn->push_back(std::move(fd));
11662 }
11663 }
11664 if (resultList || resultSet)
11665 {
11666 if (resultList) resultList->push_back(filePath);
11667 if (resultSet) resultSet->insert(filePath);
11668 }
11669
11670 if (killSet) killSet->insert(fi.absFilePath());
11671 }
11672 }
11673 else if (fi.isDir()) // readable dir
11674 {
11675 readDir(&fi,fnMap,exclSet,patList,
11676 exclPatList,resultList,resultSet,errorIfNotExist,
11677 recursive,killSet,paths);
11678 }
11679 }
11680 }
11681}

References FileInfo::absFilePath(), LinkedMap< T, Hash, KeyEqual, Map >::add(), Config_getBool, createFileDef(), FileInfo::dirPath(), DString::empty(), FileInfo::exists(), FileInfo::fileName(), g_pathsVisited(), FileInfo::isDir(), FileInfo::isFile(), FileInfo::isReadable(), FileInfo::isSymLink(), readDir(), DString::str(), and warn_uncond.

Referenced by searchInputFiles().

◆ readTagFile()

void readTagFile ( const std::shared_ptr< Entry > & root,
const DString & tagLine )
static

Definition at line 10810 of file doxygen.cpp.

10811{
10812 DString fileName;
10813 DString destName;
10814 if (size_t eqPos = tagLine.find('='); eqPos!=DString::npos) // tag command contains a destination
10815 {
10816 fileName = tagLine.left(eqPos).stripWhiteSpace();
10817 destName = tagLine.mid(eqPos+1).stripWhiteSpace();
10818 if (fileName.empty() || destName.empty()) return;
10819 //printf("insert tagDestination %s->%s\n",qPrint(fi.fileName()),qPrint(destName));
10820 }
10821 else
10822 {
10823 fileName = tagLine;
10824 }
10825
10826 FileInfo fi(fileName.str());
10827 if (!fi.exists() || !fi.isFile())
10828 {
10829 err("Tag file '{}' does not exist or is not a file. Skipping it...\n",fileName);
10830 return;
10831 }
10832
10833 if (Doxygen::tagFileSet.find(fi.absFilePath()) != Doxygen::tagFileSet.end()) return;
10834
10835 Doxygen::tagFileSet.emplace(fi.absFilePath());
10836
10837 if (!destName.empty())
10838 {
10839 Doxygen::tagDestinationMap.emplace(fi.absFilePath(), destName.str());
10840 msg("Reading tag file '{}', location '{}'...\n",fileName,destName);
10841 }
10842 else
10843 {
10844 msg("Reading tag file '{}'...\n",fileName);
10845 }
10846
10847 parseTagFile(root,fi.absFilePath().c_str());
10848}
static StringUnorderedSet tagFileSet
Definition doxygen.h:110
void parseTagFile(const std::shared_ptr< Entry > &root, const char *fullName)

References FileInfo::absFilePath(), DString::empty(), err, FileInfo::exists(), DString::find(), FileInfo::isFile(), DString::left(), DString::mid(), msg, DString::npos, parseTagFile(), DString::str(), DString::stripWhiteSpace(), Doxygen::tagDestinationMap, and Doxygen::tagFileSet.

Referenced by parseInput().

◆ resolveClassNestingRelations()

void resolveClassNestingRelations ( )
static

create the scope artificially

Definition at line 1395 of file doxygen.cpp.

1396{
1397 ClassDefSet visitedClasses;
1398
1399 bool done=false;
1400 //int iteration=0;
1401 while (!done)
1402 {
1403 done=true;
1404 //++iteration;
1405 struct ClassAlias
1406 {
1407 ClassAlias(const DString &name,std::unique_ptr<ClassDef> cd,DefinitionMutable *ctx) :
1408 aliasFullName(name),aliasCd(std::move(cd)), aliasContext(ctx) {}
1409 DString aliasFullName;
1410 std::unique_ptr<ClassDef> aliasCd;
1411 DefinitionMutable *aliasContext;
1412 };
1413 std::vector<ClassAlias> aliases;
1414 for (const auto &icd : *Doxygen::classLinkedMap)
1415 {
1416 ClassDefMutable *cd = toClassDefMutable(icd.get());
1417 if (cd && visitedClasses.find(icd.get())==visitedClasses.end())
1418 {
1420 //printf("processing=%s, iteration=%d\n",qPrint(cd->name()),iteration);
1421 // also add class to the correct structural context
1423 name,icd->getFileDef(),nullptr);
1424 if (d)
1425 {
1426 //printf("****** adding %s to scope %s in iteration %d\n",qPrint(cd->name()),qPrint(d->name()),iteration);
1428 if (dm)
1429 {
1430 dm->addInnerCompound(cd);
1431 }
1432 cd->setOuterScope(d);
1433
1434 // for inline namespace add an alias of the class to the outer scope
1436 {
1438 //printf("nd->isInline()=%d\n",nd->isInline());
1439 if (nd && nd->isInline())
1440 {
1441 d = d->getOuterScope();
1442 if (d)
1443 {
1444 dm = toDefinitionMutable(d);
1445 if (dm)
1446 {
1447 auto aliasCd = createClassDefAlias(d,cd);
1448 DString aliasFullName = d->qualifiedName()+"::"+aliasCd->localName();
1449 aliases.emplace_back(aliasFullName,std::move(aliasCd),dm);
1450 //printf("adding %s to %s as %s\n",qPrint(aliasCd->name()),qPrint(d->name()),qPrint(aliasFullName));
1451 }
1452 }
1453 }
1454 else
1455 {
1456 break;
1457 }
1458 }
1459
1460 visitedClasses.insert(icd.get());
1461 done=false;
1462 }
1463 //else
1464 //{
1465 // printf("****** ignoring %s: scope not (yet) found in iteration %d\n",qPrint(cd->name()),iteration);
1466 //}
1467 }
1468 }
1469 // add aliases
1470 for (auto &alias : aliases)
1471 {
1472 ClassDef *aliasCd = Doxygen::classLinkedMap->add(alias.aliasFullName,std::move(alias.aliasCd));
1473 if (aliasCd)
1474 {
1475 alias.aliasContext->addInnerCompound(aliasCd);
1476 }
1477 }
1478 }
1479
1480 //give warnings for unresolved compounds
1481 for (const auto &icd : *Doxygen::classLinkedMap)
1482 {
1483 ClassDefMutable *cd = toClassDefMutable(icd.get());
1484 if (cd && visitedClasses.find(icd.get())==visitedClasses.end())
1485 {
1487 /// create the scope artificially
1488 // anyway, so we can at least relate scopes properly.
1489 Definition *d = buildScopeFromQualifiedName(name,cd->getLanguage(),nullptr);
1490 if (d && d!=cd && !cd->getDefFileName().empty())
1491 // avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; }
1492 // for this case doxygen assumes the existence of a namespace N::N in which C is to be found!
1493 // also avoid warning for stuff imported via a tagfile.
1494 {
1496 if (dm)
1497 {
1498 dm->addInnerCompound(cd);
1499 }
1500 cd->setOuterScope(d);
1501 // A specialization can only be written for a template that has been declared before, so a missing
1502 // scope means that declaration is outside the input - e.g. `template<> struct std::hash<MyClass>`.
1503 if (cd->localName().find('<')==DString::npos)
1504 {
1505 warn(cd->getDefFileName(),cd->getDefLine(),
1506 "Incomplete input: scope for class {} not found!{}",name,
1507 name.startsWith("std::") ? " Try enabling BUILTIN_STL_SUPPORT." : ""
1508 );
1509 }
1510 }
1511 }
1512 }
1513}

References LinkedMap< T, Hash, KeyEqual, Map >::add(), DefinitionMutable::addInnerCompound(), buildScopeFromQualifiedName(), Doxygen::classLinkedMap, createClassDefAlias(), Definition::definitionType(), DString::empty(), DString::find(), findScopeFromQualifiedName(), Definition::getDefFileName(), Definition::getDefLine(), Definition::getLanguage(), Definition::getOuterScope(), Doxygen::globalScope, NamespaceDef::isInline(), Definition::localName(), Definition::name(), DString::npos, Definition::qualifiedName(), DefinitionMutable::setOuterScope(), stripAnonymousNamespaceScope(), toClassDefMutable(), toDefinitionMutable(), toNamespaceDef(), Definition::TypeNamespace, and warn.

Referenced by parseInput().

◆ resolveSymlink()

std::string resolveSymlink ( const std::string & path)
static

Definition at line 11412 of file doxygen.cpp.

11413{
11414 size_t sepPos=0;
11415 size_t oldPos=0;
11416 StringUnorderedSet nonSymlinks;
11417 StringUnorderedSet known;
11418 DString result(path);
11419 DString oldPrefix = "/";
11420 do
11421 {
11422#if defined(_WIN32)
11423 // UNC path, skip server and share name
11424 if (sepPos==0 && (result.startsWith("//") || result.startsWith("\\\\")))
11425 sepPos = result.find('/',2);
11426 if (sepPos!=DString::npos)
11427 sepPos = result.find('/',sepPos+1);
11428#else
11429 sepPos = result.find('/',sepPos+1);
11430#endif
11431 DString prefix = sepPos==DString::npos ? result : result.left(sepPos);
11432 if (nonSymlinks.find(prefix.str())==nonSymlinks.end())
11433 {
11434 FileInfo fi(prefix.str());
11435 if (fi.isSymLink())
11436 {
11437 DString target = fi.readLink();
11438 bool isRelative = FileInfo(target.str()).isRelative();
11439 if (isRelative)
11440 {
11441 target = Dir::cleanDirPath(oldPrefix.str()+"/"+target.str());
11442 }
11443 if (sepPos!=DString::npos)
11444 {
11445 if (fi.isDir() && !target.empty() && target.at(target.length()-1)!='/')
11446 {
11447 target+='/';
11448 }
11449 target+=result.mid(sepPos);
11450 }
11451 result = Dir::cleanDirPath(target.str());
11452 if (known.find(result.str())!=known.end()) return std::string(); // recursive symlink!
11453 known.insert(result.str());
11454 if (isRelative)
11455 {
11456 sepPos = oldPos;
11457 }
11458 else // link to absolute path
11459 {
11460 sepPos = 0;
11461 oldPrefix = "/";
11462 }
11463 }
11464 else
11465 {
11466 nonSymlinks.insert(prefix.str());
11467 oldPrefix = prefix;
11468 }
11469 oldPos = sepPos;
11470 }
11471 }
11472 while (sepPos!=DString::npos);
11473 return Dir::cleanDirPath(result.str());
11474}
static std::string cleanDirPath(const std::string &path)
Definition dir.cpp:362
bool isRelative() const
Definition fileinfo.cpp:63

References DString::at(), Dir::cleanDirPath(), DString::empty(), DString::find(), FileInfo::isDir(), FileInfo::isRelative(), FileInfo::isSymLink(), DString::left(), DString::length(), DString::mid(), DString::npos, prefix, FileInfo::readLink(), DString::startsWith(), and DString::str().

Referenced by readDir().

◆ resolveTemplateInstanceInType()

void resolveTemplateInstanceInType ( const Entry * root,
const Definition * scope,
const MemberDef * md )
static

Definition at line 5088 of file doxygen.cpp.

5089{
5090 // For a statement like 'using X = T<A>', add a template instance 'T<A>' as a symbol, so it can
5091 // be used to match arguments (see issue #11111)
5092 AUTO_TRACE();
5093 DString ttype = md->typeString();
5094 ttype.stripPrefix("typedef ");
5095 if (size_t ti=ttype.find('<'); ti!=DString::npos)
5096 {
5097 DString templateClassName = ttype.left(ti);
5098 SymbolResolver resolver(root->fileDef());
5099 ClassDefMutable *baseClass = resolver.resolveClassMutable(scope ? scope : Doxygen::globalScope,
5100 templateClassName, true, true);
5101 AUTO_TRACE_ADD("templateClassName={} baseClass={}",templateClassName,baseClass?baseClass->name():"<none>");
5102 if (baseClass)
5103 {
5104 const ArgumentList &tl = baseClass->templateArguments();
5105 TemplateNameMap templateNames = getTemplateArgumentsInName(tl,templateClassName.str());
5107 baseClass,
5108 ttype.mid(ti),
5109 templateNames,
5110 baseClass->isArtificial());
5111 }
5112 }
5113}

References AUTO_TRACE, AUTO_TRACE_ADD, Entry::fileDef(), DString::find(), findTemplateInstanceRelation(), Definition::getOuterScope(), getTemplateArgumentsInName(), Doxygen::globalScope, Definition::isArtificial(), DString::left(), DString::mid(), Definition::name(), DString::npos, SymbolResolver::resolveClassMutable(), DString::str(), DString::stripPrefix(), ClassDef::templateArguments(), and MemberDef::typeString().

Referenced by addVariableToClass(), and addVariableToFile().

◆ resolveUserReferences()

void resolveUserReferences ( )
static

Definition at line 10308 of file doxygen.cpp.

10309{
10310 for (const auto &si : SectionManager::instance())
10311 {
10312 //printf("si->label='%s' si->definition=%s si->fileName='%s'\n",
10313 // qPrint(si->label),si->definition?qPrint(si->definition->name()):"<none>",
10314 // qPrint(si->fileName));
10315 PageDef *pd=nullptr;
10316
10317 // hack: the items of a todo/test/bug/deprecated list are all fragments from
10318 // different files, so the resulting section's all have the wrong file
10319 // name (not from the todo/test/bug/deprecated list, but from the file in
10320 // which they are defined). We correct this here by looking at the
10321 // generated section labels!
10323 {
10324 DString label="_"+rl->listName(); // "_todo", "_test", ...
10325 if (si->label().left(label.length())==label)
10326 {
10327 si->setFileName(rl->listName());
10328 si->setGenerated(true);
10329 break;
10330 }
10331 }
10332
10333 //printf("start: si->label=%s si->fileName=%s\n",qPrint(si->label),qPrint(si->fileName));
10334 if (!si->generated())
10335 {
10336 // if this section is in a page and the page is in a group, then we
10337 // have to adjust the link file name to point to the group.
10338 if (!si->fileName().empty() &&
10339 (pd=Doxygen::pageLinkedMap->find(si->fileName())) &&
10340 pd->getGroupDef())
10341 {
10342 si->setFileName(pd->getGroupDef()->getOutputFileBase());
10343 }
10344
10345 if (si->definition())
10346 {
10347 // TODO: there should be one function in Definition that returns
10348 // the file to link to, so we can avoid the following tests.
10349 const GroupDef *gd=nullptr;
10350 if (si->definition()->definitionType()==Definition::TypeMember)
10351 {
10352 gd = (toMemberDef(si->definition()))->getGroupDef();
10353 }
10354
10355 if (gd)
10356 {
10357 si->setFileName(gd->getOutputFileBase());
10358 }
10359 else
10360 {
10361 //si->fileName=si->definition->getOutputFileBase();
10362 //printf("Setting si->fileName to %s\n",qPrint(si->fileName));
10363 }
10364 }
10365 }
10366 //printf("end: si->label=%s si->fileName=%s\n",qPrint(si->label),qPrint(si->fileName));
10367 }
10368}
virtual const GroupDef * getGroupDef() const =0

References LinkedMap< T, Hash, KeyEqual, Map >::find(), PageDef::getGroupDef(), Definition::getOutputFileBase(), RefListManager::instance(), SectionManager::instance(), DString::length(), Doxygen::pageLinkedMap, toMemberDef(), and Definition::TypeMember.

Referenced by parseInput().

◆ runHtmlHelpCompiler()

void runHtmlHelpCompiler ( )
static

Definition at line 10633 of file doxygen.cpp.

10634{
10635 std::string oldDir = Dir::currentDirPath();
10636 Dir::setCurrent(Config_getString(HTML_OUTPUT).str());
10639 {
10640 err("failed to run html help compiler on {}\n", HtmlHelp::hhpFileName);
10641 }
10642 Dir::setCurrent(oldDir);
10643}
@ ExtCmd
Definition debug.h:37
static bool setCurrent(const std::string &path)
Definition dir.cpp:355
static const DString hhpFileName
Definition htmlhelp.h:90
int system(const DString &command, const DString &args, bool commandHasConsole=true)
Definition portable.cpp:121
void setShortDir()
Definition portable.cpp:569

References Config_getString, Dir::currentDirPath(), err, Debug::ExtCmd, HtmlHelp::hhpFileName, Debug::isFlagSet(), qPrint(), Dir::setCurrent(), Portable::setShortDir(), and Portable::system().

Referenced by generateOutput().

◆ runQHelpGenerator()

void runQHelpGenerator ( )
static

Definition at line 10645 of file doxygen.cpp.

10646{
10647 DString args = Qhp::qhpFileName + " -o \"" + Qhp::getQchFileName() + "\"";
10648 std::string oldDir = Dir::currentDirPath();
10649 Dir::setCurrent(Config_getString(HTML_OUTPUT).str());
10650
10651 DString qhgLocation=Config_getString(QHG_LOCATION);
10652 if (Debug::isFlagSet(Debug::Qhp)) // produce info for debugging
10653 {
10654 // run qhelpgenerator -v and extract the Qt version used
10655 DString cmd=qhgLocation+ " -v 2>&1";
10656 Debug::print(Debug::ExtCmd,0,"Executing popen(`{}`)\n",cmd);
10657 FILE *f=Portable::popen(cmd,"r");
10658 if (!f)
10659 {
10660 err("could not execute {}\n",qhgLocation);
10661 }
10662 else
10663 {
10664 const size_t bufSize = 1024;
10665 char inBuf[bufSize+1];
10666 size_t numRead=fread(inBuf,1,bufSize,f);
10667 inBuf[numRead] = '\0';
10668 Debug::print(Debug::Qhp,0,"{}",inBuf);
10670
10671 int qtVersion=0;
10672 static const reg::Ex versionReg(R"(Qt (\d+)\.(\d+)\.(\d+))");
10674 std::string s = inBuf;
10675 if (reg::search(s,match,versionReg))
10676 {
10677 qtVersion = 10000*DString(match[1].str()).toInt() +
10678 100*DString(match[2].str()).toInt() +
10679 DString(match[3].str()).toInt();
10680 }
10681 if (qtVersion>0 && (qtVersion<60000 || qtVersion >= 60205))
10682 {
10683 // dump the output of qhelpgenerator -c file.qhp
10684 // Qt<6 or Qt>=6.2.5 or higher, see https://bugreports.qt.io/browse/QTBUG-101070
10685 cmd=qhgLocation+ " -c " + Qhp::qhpFileName + " 2>&1";
10686 Debug::print(Debug::ExtCmd,0,"Executing popen(`{}`)\n",cmd);
10687 f=Portable::popen(cmd,"r");
10688 if (!f)
10689 {
10690 err("could not execute {}\n",qhgLocation);
10691 }
10692 else
10693 {
10694 std::string output;
10695 while ((numRead=fread(inBuf,1,bufSize,f))>0)
10696 {
10697 inBuf[numRead] = '\0';
10698 output += inBuf;
10699 }
10701 Debug::print(Debug::Qhp,0,"{}",output);
10702 }
10703 }
10704 }
10705 }
10706
10707 if (Portable::system(qhgLocation, args, false))
10708 {
10709 err("failed to run qhelpgenerator on {}\n",Qhp::qhpFileName);
10710 }
10711 Dir::setCurrent(oldDir);
10712}
int toInt(bool *ok=nullptr, int base=10) const
Definition dstring.cpp:191
@ Qhp
Definition debug.h:45
static DString getQchFileName()
Definition qhp.cpp:430
static const DString qhpFileName
Definition qhp.h:49
FILE * popen(const DString &name, const DString &type)
Definition portable.cpp:495
int pclose(FILE *stream)
Definition portable.cpp:504

References Config_getString, Dir::currentDirPath(), err, Debug::ExtCmd, Qhp::getQchFileName(), Debug::isFlagSet(), Portable::pclose(), Portable::popen(), Debug::print(), Debug::Qhp, Qhp::qhpFileName, reg::search(), Dir::setCurrent(), Portable::system(), and DString::toInt().

Referenced by generateOutput().

◆ scopeIsTemplate()

bool scopeIsTemplate ( const Definition * d)
static

Definition at line 6259 of file doxygen.cpp.

6260{
6261 bool result=false;
6262 //printf("> scopeIsTemplate(%s)\n",qPrint(d?d->name():"null"));
6264 {
6265 auto cd = toClassDef(d);
6266 result = cd->templateArguments().hasParameters() || cd->templateMaster()!=nullptr ||
6268 }
6269 //printf("< scopeIsTemplate=%d\n",result);
6270 return result;
6271}

References Definition::definitionType(), Definition::getOuterScope(), scopeIsTemplate(), toClassDef(), and Definition::TypeClass.

Referenced by addMemberFunction(), and scopeIsTemplate().

◆ searchInputFiles()

void searchInputFiles ( )

Definition at line 12651 of file doxygen.cpp.

12652{
12653 StringUnorderedSet killSet;
12654
12655 StringVector exclPatterns = Config_getList(EXCLUDE_PATTERNS);
12656 bool alwaysRecursive = Config_getBool(RECURSIVE);
12657 StringUnorderedSet excludeNameSet;
12658
12659 // gather names of all files in the include path
12660 g_s.begin("Searching for include files...\n");
12661 killSet.clear();
12662 StringVector includePathList = Config_getList(INCLUDE_PATH);
12663 for (const auto &s : includePathList)
12664 {
12665 size_t plSize = Config_getList(INCLUDE_FILE_PATTERNS).size();
12666 StringVector pl = plSize==0 ? Config_getList(FILE_PATTERNS) :
12667 Config_getList(INCLUDE_FILE_PATTERNS);
12668 readFileOrDirectory(s, // s
12670 nullptr, // exclSet
12671 &pl, // patList
12672 &exclPatterns, // exclPatList
12673 nullptr, // resultList
12674 nullptr, // resultSet
12675 false, // INCLUDE_PATH isn't recursive
12676 true, // errorIfNotExist
12677 &killSet); // killSet
12678 }
12679 g_s.end();
12680
12681 g_s.begin("Searching for example files...\n");
12682 killSet.clear();
12683 StringVector examplePathList = Config_getList(EXAMPLE_PATH);
12684 for (const auto &s : examplePathList)
12685 {
12686 StringVector patterns = Config_getList(EXAMPLE_PATTERNS);
12687 readFileOrDirectory(s, // s
12689 nullptr, // exclSet
12690 &patterns, // patList
12691 nullptr, // exclPatList
12692 nullptr, // resultList
12693 nullptr, // resultSet
12694 (alwaysRecursive || Config_getBool(EXAMPLE_RECURSIVE)), // recursive
12695 true, // errorIfNotExist
12696 &killSet); // killSet
12697 }
12698 g_s.end();
12699
12700 g_s.begin("Searching for images...\n");
12701 killSet.clear();
12702 StringVector imagePathList=Config_getList(IMAGE_PATH);
12703 for (const auto &s : imagePathList)
12704 {
12705 readFileOrDirectory(s, // s
12707 nullptr, // exclSet
12708 nullptr, // patList
12709 nullptr, // exclPatList
12710 nullptr, // resultList
12711 nullptr, // resultSet
12712 alwaysRecursive, // recursive
12713 true, // errorIfNotExist
12714 &killSet); // killSet
12715 }
12716 g_s.end();
12717
12718 g_s.begin("Searching for dot files...\n");
12719 killSet.clear();
12720 StringVector dotFileList=Config_getList(DOTFILE_DIRS);
12721 for (const auto &s : dotFileList)
12722 {
12723 readFileOrDirectory(s, // s
12725 nullptr, // exclSet
12726 nullptr, // patList
12727 nullptr, // exclPatList
12728 nullptr, // resultList
12729 nullptr, // resultSet
12730 alwaysRecursive, // recursive
12731 true, // errorIfNotExist
12732 &killSet); // killSet
12733 }
12734 g_s.end();
12735
12736 g_s.begin("Searching for msc files...\n");
12737 killSet.clear();
12738 StringVector mscFileList=Config_getList(MSCFILE_DIRS);
12739 for (const auto &s : mscFileList)
12740 {
12741 readFileOrDirectory(s, // s
12743 nullptr, // exclSet
12744 nullptr, // patList
12745 nullptr, // exclPatList
12746 nullptr, // resultList
12747 nullptr, // resultSet
12748 alwaysRecursive, // recursive
12749 true, // errorIfNotExist
12750 &killSet); // killSet
12751 }
12752 g_s.end();
12753
12754 g_s.begin("Searching for dia files...\n");
12755 killSet.clear();
12756 StringVector diaFileList=Config_getList(DIAFILE_DIRS);
12757 for (const auto &s : diaFileList)
12758 {
12759 readFileOrDirectory(s, // s
12761 nullptr, // exclSet
12762 nullptr, // patList
12763 nullptr, // exclPatList
12764 nullptr, // resultList
12765 nullptr, // resultSet
12766 alwaysRecursive, // recursive
12767 true, // errorIfNotExist
12768 &killSet); // killSet
12769 }
12770 g_s.end();
12771
12772 g_s.begin("Searching for plantuml files...\n");
12773 killSet.clear();
12774 StringVector plantUmlFileList=Config_getList(PLANTUMLFILE_DIRS);
12775 for (const auto &s : plantUmlFileList)
12776 {
12777 readFileOrDirectory(s, // s
12779 nullptr, // exclSet
12780 nullptr, // patList
12781 nullptr, // exclPatList
12782 nullptr, // resultList
12783 nullptr, // resultSet
12784 alwaysRecursive, // recursive
12785 true, // errorIfNotExist
12786 &killSet); // killSet
12787 }
12788 g_s.end();
12789
12790 g_s.begin("Searching for mermaid files...\n");
12791 killSet.clear();
12792 StringVector mermaidFileList=Config_getList(MERMAIDFILE_DIRS);
12793 for (const auto &s : mermaidFileList)
12794 {
12795 readFileOrDirectory(s, // s
12797 nullptr, // exclSet
12798 nullptr, // patList
12799 nullptr, // exclPatList
12800 nullptr, // resultList
12801 nullptr, // resultSet
12802 alwaysRecursive, // recursive
12803 true, // errorIfNotExist
12804 &killSet); // killSet
12805 }
12806 g_s.end();
12807
12808 g_s.begin("Searching for files to exclude\n");
12809 StringVector excludeList = Config_getList(EXCLUDE);
12810 for (const auto &s : excludeList)
12811 {
12812 StringVector filePatterns = Config_getList(FILE_PATTERNS);
12813 readFileOrDirectory(s, // s
12814 nullptr, // fnDict
12815 nullptr, // exclSet
12816 &filePatterns, // patList
12817 nullptr, // exclPatList
12818 nullptr, // resultList
12819 &excludeNameSet, // resultSet
12820 alwaysRecursive, // recursive
12821 false); // errorIfNotExist
12822 }
12823 g_s.end();
12824
12825 /**************************************************************************
12826 * Determine Input Files *
12827 **************************************************************************/
12828
12829 g_s.begin("Searching INPUT for files to process...\n");
12830 killSet.clear();
12831 Doxygen::inputPaths.clear();
12832 StringVector inputList=Config_getList(INPUT);
12833 for (const auto &s : inputList)
12834 {
12835 DString path = s;
12836 size_t l = path.length();
12837 if (l>0)
12838 {
12839 // strip trailing slashes
12840 if (path.at(l-1)=='\\' || path.at(l-1)=='/') path=path.left(l-1);
12841
12842 StringVector filePatterns = Config_getList(FILE_PATTERNS);
12844 path, // s
12846 &excludeNameSet, // exclSet
12847 &filePatterns, // patList
12848 &exclPatterns, // exclPatList
12849 &g_inputFiles, // resultList
12850 nullptr, // resultSet
12851 alwaysRecursive, // recursive
12852 true, // errorIfNotExist
12853 &killSet, // killSet
12854 &Doxygen::inputPaths); // paths
12855 }
12856 }
12857
12858 // Sort the FileDef objects by full path to get a predictable ordering over multiple runs
12859 for (auto &fileName : *Doxygen::inputNameLinkedMap)
12860 {
12861 if (fileName->size()>1)
12862 {
12863 std::stable_sort(fileName->begin(),fileName->end(),[](const auto &f1,const auto &f2)
12864 {
12865 return dstricmp_sort(f1->absFilePath(),f2->absFilePath())<0;
12866 });
12867 }
12868 }
12869 std::stable_sort(Doxygen::inputNameLinkedMap->begin(),
12871 [](const auto &f1,const auto &f2)
12872 {
12873 return dstricmp_sort(f1->front()->absFilePath(),f2->front()->absFilePath())<0;
12874 });
12875 if (Doxygen::inputNameLinkedMap->empty())
12876 {
12877 warn_uncond("No files to be processed, please check your settings, in particular INPUT, FILE_PATTERNS, and RECURSIVE\n");
12878 }
12879 g_s.end();
12880}
static StringUnorderedSet inputPaths
Definition doxygen.h:96
void readFileOrDirectory(const DString &s, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, const StringVector *patList, const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool recursive, bool errorIfNotExist, StringUnorderedSet *killSet, StringUnorderedSet *paths)

References DString::at(), begin(), Statistics::begin(), Config_getBool, Config_getList, Doxygen::diaFileNameLinkedMap, Doxygen::dotFileNameLinkedMap, dstricmp_sort(), end(), Statistics::end(), Doxygen::exampleNameLinkedMap, g_inputFiles, g_s, Doxygen::imageNameLinkedMap, Doxygen::includeNameLinkedMap, Doxygen::inputNameLinkedMap, Doxygen::inputPaths, DString::left(), DString::length(), Doxygen::mermaidFileNameLinkedMap, Doxygen::mscFileNameLinkedMap, Doxygen::plantUmlFileNameLinkedMap, readFileOrDirectory(), and warn_uncond.

Referenced by parseInput().

◆ setAnonymousEnumType()

void setAnonymousEnumType ( )
static

Definition at line 9482 of file doxygen.cpp.

9483{
9484 for (const auto &cd : *Doxygen::classLinkedMap)
9485 {
9486 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9487 if (cdm)
9488 {
9489 cdm->setAnonymousEnumType();
9490 }
9491 }
9492}
virtual void setAnonymousEnumType()=0

References Doxygen::classLinkedMap, ClassDefMutable::setAnonymousEnumType(), and toClassDefMutable().

Referenced by parseInput().

◆ sortMemberLists()

void sortMemberLists ( )
static

Definition at line 9387 of file doxygen.cpp.

9388{
9389 // sort class member lists
9390 for (const auto &cd : *Doxygen::classLinkedMap)
9391 {
9392 ClassDefMutable *cdm = toClassDefMutable(cd.get());
9393 if (cdm)
9394 {
9395 cdm->sortMemberLists();
9396 }
9397 }
9398
9399 // sort namespace member lists
9400 for (const auto &nd : *Doxygen::namespaceLinkedMap)
9401 {
9403 if (ndm)
9404 {
9405 ndm->sortMemberLists();
9406 }
9407 }
9408
9409 // sort file member lists
9410 for (const auto &fn : *Doxygen::inputNameLinkedMap)
9411 {
9412 for (const auto &fd : *fn)
9413 {
9414 fd->sortMemberLists();
9415 }
9416 }
9417
9418 // sort group member lists
9419 for (const auto &gd : *Doxygen::groupLinkedMap)
9420 {
9421 gd->sortMemberLists();
9422 }
9423
9425}
virtual void sortMemberLists()=0
void sortMemberLists()
virtual void sortMemberLists()=0

References Doxygen::classLinkedMap, Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), Doxygen::namespaceLinkedMap, ClassDefMutable::sortMemberLists(), ModuleManager::sortMemberLists(), NamespaceDefMutable::sortMemberLists(), toClassDefMutable(), and toNamespaceDefMutable().

Referenced by parseInput().

◆ stopDoxygen()

void stopDoxygen ( int )
static

Definition at line 12518 of file doxygen.cpp.

12519{
12520 signal(SIGINT,SIG_DFL); // Re-register signal handler for default action
12521 Dir thisDir;
12522 msg("Cleaning up...\n");
12523 if (!Doxygen::filterDBFileName.empty())
12524 {
12525 thisDir.remove(Doxygen::filterDBFileName.str());
12526 }
12527 killpg(0,SIGINT);
12529 exitTracing();
12530 exit(1);
12531}

References cleanUpDoxygen(), exitTracing(), Doxygen::filterDBFileName, msg, and Dir::remove().

Referenced by parseInput().

◆ stripTemplateSpecifiers()

DString stripTemplateSpecifiers ( const DString & s)

Definition at line 697 of file doxygen.cpp.

698{
699 size_t l = s.length();
700 int count=0;
701 int round=0;
702 DString result;
703 for (size_t i=0;i<l;i++)
704 {
705 char c=s.at(i);
706 if (c=='(') round++;
707 else if (c==')' && round>0) round--;
708 else if (c=='<' && round==0) count++;
709 if (count==0)
710 {
711 result+=c;
712 }
713 if (c=='>' && round==0 && count>0) count--;
714 }
715 //printf("stripTemplateSpecifiers(%s)=%s\n",qPrint(s),qPrint(result));
716 return result;
717}

References DString::at(), and DString::length().

Referenced by buildScopeFromQualifiedName().

◆ substituteTemplatesInArgList()

void substituteTemplatesInArgList ( const ArgumentLists & srcTempArgLists,
const ArgumentLists & dstTempArgLists,
const ArgumentList & src,
ArgumentList & dst )
static

Definition at line 6357 of file doxygen.cpp.

6363{
6364 auto dstIt = dst.begin();
6365 for (const Argument &sa : src)
6366 {
6367 DString dstType = substituteTemplatesInString(srcTempArgLists,dstTempArgLists,sa.type.str());
6368 DString dstArray = substituteTemplatesInString(srcTempArgLists,dstTempArgLists,sa.array.str());
6369 if (dstIt == dst.end())
6370 {
6371 Argument da = sa;
6372 da.type = dstType;
6373 da.array = dstArray;
6374 dst.push_back(da);
6375 dstIt = dst.end();
6376 }
6377 else
6378 {
6379 Argument da = *dstIt;
6380 da.type = dstType;
6381 da.array = dstArray;
6382 ++dstIt;
6383 }
6384 }
6385 dst.setConstSpecifier(src.constSpecifier());
6386 dst.setVolatileSpecifier(src.volatileSpecifier());
6387 dst.setPureSpecifier(src.pureSpecifier());
6389 srcTempArgLists,dstTempArgLists,
6390 src.trailingReturnType().str()));
6391 dst.setIsDeleted(src.isDeleted());
6392 dst.setRefQualifier(src.refQualifier());
6393 dst.setNoParameters(src.noParameters());
6394 //printf("substituteTemplatesInArgList: replacing %s with %s\n",
6395 // qPrint(argListToString(src)),qPrint(argListToString(dst))
6396 // );
6397}
DString array
Definition arguments.h:46
iterator end()
Definition arguments.h:95
void setPureSpecifier(bool b)
Definition arguments.h:122
void push_back(const Argument &a)
Definition arguments.h:103
void setConstSpecifier(bool b)
Definition arguments.h:120
void setRefQualifier(RefQualifierType t)
Definition arguments.h:127
void setIsDeleted(bool b)
Definition arguments.h:126
iterator begin()
Definition arguments.h:94
void setNoParameters(bool b)
Definition arguments.h:128
void setVolatileSpecifier(bool b)
Definition arguments.h:121
static DString substituteTemplatesInString(const ArgumentLists &srcTempArgLists, const ArgumentLists &dstTempArgLists, const std::string &src)
Definition doxygen.cpp:6273

References Argument::array, ArgumentList::begin(), ArgumentList::constSpecifier(), ArgumentList::end(), ArgumentList::isDeleted(), ArgumentList::noParameters(), ArgumentList::pureSpecifier(), ArgumentList::push_back(), ArgumentList::refQualifier(), ArgumentList::setConstSpecifier(), ArgumentList::setIsDeleted(), ArgumentList::setNoParameters(), ArgumentList::setPureSpecifier(), ArgumentList::setRefQualifier(), ArgumentList::setTrailingReturnType(), ArgumentList::setVolatileSpecifier(), DString::str(), substituteTemplatesInString(), ArgumentList::trailingReturnType(), Argument::type, and ArgumentList::volatileSpecifier().

Referenced by addMemberFunction().

◆ substituteTemplatesInString()

DString substituteTemplatesInString ( const ArgumentLists & srcTempArgLists,
const ArgumentLists & dstTempArgLists,
const std::string & src )
static

Definition at line 6273 of file doxygen.cpp.

6278{
6279 std::string dst;
6280 static const reg::Ex re(R"(\a\w*)");
6281 reg::Iterator it(src,re);
6283 //printf("type=%s\n",qPrint(sa->type));
6284 size_t p=0;
6285 for (; it!=end ; ++it) // for each word in srcType
6286 {
6287 const auto &match = *it;
6288 size_t i = match.position();
6289 size_t l = match.length();
6290 bool found=false;
6291 dst+=src.substr(p,i-p);
6292 std::string name=match.str();
6293
6294 auto srcIt = srcTempArgLists.begin();
6295 auto dstIt = dstTempArgLists.begin();
6296 while (srcIt!=srcTempArgLists.end() && !found)
6297 {
6298 const ArgumentList *tdAli = nullptr;
6299 std::vector<Argument>::const_iterator tdaIt;
6300 if (dstIt!=dstTempArgLists.end())
6301 {
6302 tdAli = &(*dstIt);
6303 tdaIt = tdAli->begin();
6304 ++dstIt;
6305 }
6306
6307 const ArgumentList &tsaLi = *srcIt;
6308 for (auto tsaIt = tsaLi.begin(); tsaIt!=tsaLi.end() && !found; ++tsaIt)
6309 {
6310 Argument tsa = *tsaIt;
6311 const Argument *tda = nullptr;
6312 if (tdAli && tdaIt!=tdAli->end())
6313 {
6314 tda = &(*tdaIt);
6315 ++tdaIt;
6316 }
6317 //if (tda) printf("tsa=%s|%s tda=%s|%s\n",
6318 // qPrint(tsa.type),qPrint(tsa.name),
6319 // qPrint(tda->type),qPrint(tda->name));
6320 if (name==tsa.name.str())
6321 {
6322 if (tda && tda->name.empty())
6323 {
6324 DString tdaName = tda->name;
6325 DString tdaType = tda->type;
6326 int vc=0;
6327 if (tdaType.startsWith("class ")) vc=6;
6328 else if (tdaType.startsWith("typename ")) vc=9;
6329 if (vc>0) // convert type=="class T" to type=="class" name=="T"
6330 {
6331 tdaName = tdaType.mid(vc);
6332 }
6333 if (!tdaName.empty())
6334 {
6335 name=tdaName.str(); // substitute
6336 found=true;
6337 }
6338 }
6339 }
6340 }
6341
6342 //printf(" srcList='%s' dstList='%s faList='%s'\n",
6343 // qPrint(argListToString(srclali.current())),
6344 // qPrint(argListToString(dstlali.current())),
6345 // funcTempArgList ? qPrint(argListToString(funcTempArgList)) : "<none>");
6346 ++srcIt;
6347 }
6348 dst+=name;
6349 p=i+l;
6350 }
6351 dst+=src.substr(p);
6352 //printf(" substituteTemplatesInString(%s)=%s\n",
6353 // qPrint(src),qPrint(dst));
6354 return dst;
6355}

References ArgumentList::begin(), DString::empty(), ArgumentList::end(), end(), DString::mid(), Argument::name, DString::startsWith(), DString::str(), and Argument::type.

Referenced by substituteTemplatesInArgList().

◆ transferFunctionDocumentation()

void transferFunctionDocumentation ( )
static

Definition at line 4600 of file doxygen.cpp.

4601{
4602 AUTO_TRACE();
4603
4604 // find matching function declaration and definitions.
4605 for (const auto &mn : *Doxygen::functionNameLinkedMap)
4606 {
4607 //printf("memberName=%s count=%zu\n",qPrint(mn->memberName()),mn->size());
4608 /* find a matching function declaration and definition for this function */
4609 for (const auto &imdec : *mn)
4610 {
4611 MemberDefMutable *mdec = toMemberDefMutable(imdec.get());
4612 if (mdec &&
4613 (mdec->isPrototype() ||
4614 (mdec->isVariable() && mdec->isExternal())
4615 ))
4616 {
4617 for (const auto &imdef : *mn)
4618 {
4619 MemberDefMutable *mdef = toMemberDefMutable(imdef.get());
4620 if (mdef && mdec!=mdef &&
4621 mdec->getNamespaceDef()==mdef->getNamespaceDef())
4622 {
4624 }
4625 }
4626 }
4627 }
4628 }
4629}
void combineDeclarationAndDefinition(MemberDefMutable *mdec, MemberDefMutable *mdef)

References AUTO_TRACE, combineDeclarationAndDefinition(), Doxygen::functionNameLinkedMap, MemberDef::getNamespaceDef(), MemberDef::isExternal(), MemberDef::isPrototype(), MemberDef::isVariable(), and toMemberDefMutable().

Referenced by parseInput().

◆ transferFunctionReferences()

void transferFunctionReferences ( )
static

Definition at line 4633 of file doxygen.cpp.

4634{
4635 AUTO_TRACE();
4636 for (const auto &mn : *Doxygen::functionNameLinkedMap)
4637 {
4638 MemberDefMutable *mdef=nullptr,*mdec=nullptr;
4639 /* find a matching function declaration and definition for this function */
4640 for (const auto &imd : *mn)
4641 {
4642 MemberDefMutable *md = toMemberDefMutable(imd.get());
4643 if (md)
4644 {
4645 if (md->isPrototype())
4646 mdec=md;
4647 else if (md->isVariable() && md->isExternal())
4648 mdec=md;
4649
4650 if (md->isFunction() && !md->isStatic() && !md->isPrototype())
4651 mdef=md;
4652 else if (md->isVariable() && !md->isExternal() && !md->isStatic())
4653 mdef=md;
4654 }
4655
4656 if (mdef && mdec) break;
4657 }
4658 if (mdef && mdec)
4659 {
4660 const ArgumentList &mdefAl = mdef->argumentList();
4661 const ArgumentList &mdecAl = mdec->argumentList();
4662 if (
4663 matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdef->typeString(),const_cast<ArgumentList*>(&mdefAl),
4664 mdec->getOuterScope(),mdec->getFileDef(),mdec->typeString(),const_cast<ArgumentList*>(&mdecAl),
4665 true,mdef->getLanguage()
4666 )
4667 ) /* match found */
4668 {
4669 AUTO_TRACE_ADD("merging references for mdec={} mdef={}",mdec->name(),mdef->name());
4670 mdef->mergeReferences(mdec);
4671 mdec->mergeReferences(mdef);
4672 mdef->mergeReferencedBy(mdec);
4673 mdec->mergeReferencedBy(mdef);
4674 }
4675 }
4676 }
4677}
virtual void mergeReferencedBy(const Definition *other)=0
virtual void mergeReferences(const Definition *other)=0

References MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Doxygen::functionNameLinkedMap, MemberDef::getFileDef(), Definition::getLanguage(), Definition::getOuterScope(), MemberDef::isExternal(), MemberDef::isFunction(), MemberDef::isPrototype(), MemberDef::isStatic(), MemberDef::isVariable(), matchArguments2(), DefinitionMutable::mergeReferencedBy(), DefinitionMutable::mergeReferences(), Definition::name(), toMemberDefMutable(), and MemberDef::typeString().

Referenced by parseInput().

◆ transferRelatedFunctionDocumentation()

void transferRelatedFunctionDocumentation ( )
static

Definition at line 4681 of file doxygen.cpp.

4682{
4683 AUTO_TRACE();
4684 // find match between function declaration and definition for
4685 // related functions
4686 for (const auto &mn : *Doxygen::functionNameLinkedMap)
4687 {
4688 /* find a matching function declaration and definition for this function */
4689 // for each global function
4690 for (const auto &imd : *mn)
4691 {
4692 MemberDefMutable *md = toMemberDefMutable(imd.get());
4693 if (md)
4694 {
4695 //printf(" Function '%s'\n",qPrint(md->name()));
4697 if (rmn) // check if there is a member with the same name
4698 {
4699 //printf(" Member name found\n");
4700 // for each member with the same name
4701 for (const auto &irmd : *rmn)
4702 {
4703 MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
4704 //printf(" Member found: related='%d'\n",rmd->isRelated());
4705 if (rmd &&
4706 (rmd->isRelated() || rmd->isForeign()) && // related function
4707 matchArguments2( md->getOuterScope(), md->getFileDef(), md->typeString(), &md->argumentList(),
4708 rmd->getOuterScope(),rmd->getFileDef(),rmd->typeString(),&rmd->argumentList(),
4709 true,md->getLanguage()
4710 )
4711 )
4712 {
4713 AUTO_TRACE_ADD("Found related member '{}'",md->name());
4714 if (rmd->relatedAlso())
4715 md->setRelatedAlso(rmd->relatedAlso());
4716 else if (rmd->isForeign())
4717 md->makeForeign();
4718 else
4719 md->makeRelated();
4720 }
4721 }
4722 }
4723 }
4724 }
4725 }
4726}
virtual bool isForeign() const =0
virtual ClassDef * relatedAlso() const =0
virtual void setRelatedAlso(ClassDef *cd)=0
virtual void makeForeign()=0

References MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, LinkedMap< T, Hash, KeyEqual, Map >::find(), Doxygen::functionNameLinkedMap, MemberDef::getFileDef(), Definition::getLanguage(), Definition::getOuterScope(), MemberDef::isForeign(), MemberDef::isRelated(), MemberDefMutable::makeForeign(), MemberDefMutable::makeRelated(), matchArguments2(), Doxygen::memberNameLinkedMap, Definition::name(), MemberDef::relatedAlso(), MemberDefMutable::setRelatedAlso(), toMemberDefMutable(), and MemberDef::typeString().

Referenced by parseInput().

◆ transferStaticInstanceInitializers()

void transferStaticInstanceInitializers ( )

Definition at line 4730 of file doxygen.cpp.

4731{
4732 AUTO_TRACE();
4733 for (const auto &[qualifiedName,bodyInfo] : Doxygen::staticInitMap)
4734 {
4735 size_t i=qualifiedName.rfind("::");
4736 if (i!=std::string::npos)
4737 {
4738 DString scope = qualifiedName.substr(0,i);
4739 DString name = qualifiedName.substr(i+2);
4741 if (mn)
4742 {
4743 for (const auto &imd : *mn)
4744 {
4745 MemberDefMutable *md = toMemberDefMutable(imd.get());
4746 if (md && md->qualifiedName().str()==qualifiedName && md->isVariable())
4747 {
4748 AUTO_TRACE_ADD("found static member {} body [{}..{}]\n",
4749 md->qualifiedName(),bodyInfo.startLine,bodyInfo.endLine);
4750 md->setBodySegment(bodyInfo.defLine,
4751 bodyInfo.startLine,
4752 bodyInfo.endLine);
4753 }
4754 }
4755 }
4756 }
4757 }
4758}

References AUTO_TRACE, AUTO_TRACE_ADD, LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberDef::isVariable(), Doxygen::memberNameLinkedMap, Definition::qualifiedName(), DefinitionMutable::setBodySegment(), Doxygen::staticInitMap, DString::str(), DString::substr(), and toMemberDefMutable().

Referenced by parseInput().

◆ tryAddEnumDocsToGroupMember()

bool tryAddEnumDocsToGroupMember ( const Entry * root,
const DString & name )
static

Definition at line 8430 of file doxygen.cpp.

8431{
8432 for (const auto &g : root->groups)
8433 {
8434 const GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname);
8435 if (gd)
8436 {
8437 MemberList *ml = gd->getMemberList(MemberListType::DecEnumMembers());
8438 if (ml)
8439 {
8440 MemberDefMutable *md = toMemberDefMutable(ml->find(name));
8441 if (md)
8442 {
8443 addEnumDocs(root,md);
8444 return true;
8445 }
8446 }
8447 }
8448 else if (!gd && g.pri == Grouping::GROUPING_INGROUP)
8449 {
8450 warn(root->fileName, root->startLine,
8451 "Found non-existing group '{}' for the command '{}', ignoring command",
8452 g.groupname, Grouping::getGroupPriName( g.pri )
8453 );
8454 }
8455 }
8456
8457 return false;
8458}
virtual MemberList * getMemberList(MemberListType lt) const =0
const MemberDef * find(const DString &name) const
Definition memberlist.h:94

References addEnumDocs(), Entry::fileName, LinkedMap< T, Hash, KeyEqual, Map >::find(), MemberVector::find(), Grouping::getGroupPriName(), GroupDef::getMemberList(), Grouping::GROUPING_INGROUP, Doxygen::groupLinkedMap, Entry::groups, Entry::startLine, toMemberDefMutable(), and warn.

Referenced by findEnumDocumentation().

◆ usage()

void usage ( const DString & name,
const DString & versionString )
static

Definition at line 11776 of file doxygen.cpp.

11777{
11779 msg("Doxygen version {0}\nCopyright Dimitri van Heesch 1997-2025\n\n"
11780 "You can use Doxygen in a number of ways:\n\n"
11781 "1) Use Doxygen to generate a template configuration file*:\n"
11782 " {1} [-s] -g [configName]\n\n"
11783 "2) Use Doxygen to update an old configuration file*:\n"
11784 " {1} [-s] -u [configName]\n\n"
11785 "3) Use Doxygen to generate documentation using an existing "
11786 "configuration file*:\n"
11787 " {1} [configName]\n\n"
11788 "4) Use Doxygen to generate a template file controlling the layout of the\n"
11789 " generated documentation:\n"
11790 " {1} -l [layoutFileName]\n\n"
11791 " In case layoutFileName is omitted DoxygenLayout.xml will be used as filename.\n"
11792 " If - is used for layoutFileName Doxygen will write to standard output.\n\n"
11793 "5) Use Doxygen to generate a template style sheet file for RTF, HTML or Latex.\n"
11794 " RTF: {1} -w rtf styleSheetFile\n"
11795 " HTML: {1} -w html headerFile footerFile styleSheetFile [configFile]\n"
11796 " LaTeX: {1} -w latex headerFile footerFile styleSheetFile [configFile]\n\n"
11797 "6) Use Doxygen to generate a rtf extensions file\n"
11798 " {1} -e rtf extensionsFile\n\n"
11799 " If - is used for extensionsFile Doxygen will write to standard output.\n\n"
11800 "7) Use Doxygen to compare the used configuration file with the template configuration file\n"
11801 " {1} -x [configFile]\n\n"
11802 " Use Doxygen to compare the used configuration file with the template configuration file\n"
11803 " without replacing the environment variables or CMake type replacement variables\n"
11804 " {1} -x_noenv [configFile]\n\n"
11805 "8) Use Doxygen to show a list of built-in emojis.\n"
11806 " {1} -f emoji outputFileName\n\n"
11807 " If - is used for outputFileName Doxygen will write to standard output.\n\n"
11808 "*) If -s is specified the comments of the configuration items in the config file will be omitted.\n"
11809 " If configName is omitted 'Doxyfile' will be used as a default.\n"
11810 " If - is used for configFile Doxygen will write / read the configuration to /from standard output / input.\n\n"
11811 "If -q is used for a Doxygen documentation run, Doxygen will see this as if QUIET=YES has been set.\n\n"
11812 "-v print version string, -V print extended version information\n"
11813 "-h,-? prints usage help information\n"
11814 "{1} -d prints additional usage flags for debugging purposes\n",versionString,name);
11815}

References Debug::clearFlag(), msg, and Debug::Time.

Referenced by readConfiguration().

◆ version()

void version ( const bool extended)
static

Definition at line 11746 of file doxygen.cpp.

11747{
11749 DString versionString = getFullVersion();
11750 msg("{}\n",versionString);
11751 if (extended)
11752 {
11753 DString extVers;
11754 if (!extVers.empty()) extVers+= ", ";
11755 extVers += "sqlite3 ";
11756 extVers += sqlite3_libversion();
11757#if USE_LIBCLANG
11758 if (!extVers.empty()) extVers+= ", ";
11759 extVers += "clang support ";
11760 extVers += CLANG_VERSION_STRING;
11761#endif
11762 if (!extVers.empty())
11763 {
11764 if (size_t lastComma = extVers.rfind(','); lastComma != DString::npos)
11765 {
11766 extVers = extVers.replace(lastComma,1," and");
11767 }
11768 msg(" with {}.\n",extVers);
11769 }
11770 }
11771}
DString & replace(size_t index, size_t len, const char *s)
Definition dstring.cpp:154

References Debug::clearFlag(), DString::empty(), msg, DString::npos, DString::replace(), DString::rfind(), and Debug::Time.

Referenced by readConfiguration().

◆ vhdlCorrectMemberProperties()

void vhdlCorrectMemberProperties ( )
static

Definition at line 8792 of file doxygen.cpp.

8793{
8794 // for each member name
8795 for (const auto &mn : *Doxygen::memberNameLinkedMap)
8796 {
8797 // for each member definition
8798 for (const auto &imd : *mn)
8799 {
8800 MemberDefMutable *md = toMemberDefMutable(imd.get());
8801 if (md)
8802 {
8804 }
8805 }
8806 }
8807 // for each member name
8808 for (const auto &mn : *Doxygen::functionNameLinkedMap)
8809 {
8810 // for each member definition
8811 for (const auto &imd : *mn)
8812 {
8813 MemberDefMutable *md = toMemberDefMutable(imd.get());
8814 if (md)
8815 {
8817 }
8818 }
8819 }
8820}
static void correctMemberProperties(MemberDefMutable *md)

References VhdlDocGen::correctMemberProperties(), Doxygen::functionNameLinkedMap, Doxygen::memberNameLinkedMap, and toMemberDefMutable().

Referenced by parseInput().

◆ warnUndocumentedNamespaces()

void warnUndocumentedNamespaces ( )
static

Definition at line 5606 of file doxygen.cpp.

5607{
5608 AUTO_TRACE();
5609 for (const auto &nd : *Doxygen::namespaceLinkedMap)
5610 {
5611 if (!nd->hasDocumentation())
5612 {
5613 if ((EntryType::guessSection(nd->getDefFileName()).isHeader() ||
5614 nd->getLanguage() == SrcLangExt::Fortran) && // Fortran doesn't have header files.
5615 !Config_getBool(HIDE_UNDOC_NAMESPACES) // undocumented namespaces are visible
5616 )
5617 {
5618 warn_undoc(nd->getDefFileName(),nd->getDefLine(), "{} {} is not documented.",
5619 nd->getLanguage() == SrcLangExt::Fortran ? "Module" : "Namespace",
5620 nd->name());
5621 }
5622 }
5623 }
5624}

References AUTO_TRACE, Config_getBool, EntryType::guessSection(), Doxygen::namespaceLinkedMap, and warn_undoc.

Referenced by parseInput().

◆ writeTagFile()

void writeTagFile ( )
static

Definition at line 12534 of file doxygen.cpp.

12535{
12536 DString generateTagFile = Config_getString(GENERATE_TAGFILE);
12537 if (generateTagFile.empty()) return;
12538
12539 std::ofstream f = Portable::openOutputStream(generateTagFile);
12540 if (!f.is_open())
12541 {
12542 err("cannot open tag file {} for writing\n", generateTagFile);
12543 return;
12544 }
12545 TextStream tagFile(&f);
12546 tagFile << "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\n";
12547 tagFile << "<tagfile doxygen_version=\"" << getDoxygenVersion() << "\"";
12548 std::string gitVersion = getGitVersion();
12549 if (!gitVersion.empty())
12550 {
12551 tagFile << " doxygen_gitid=\"" << gitVersion << "\"";
12552 }
12553 tagFile << ">\n";
12554
12555 // for each file
12556 for (const auto &fn : *Doxygen::inputNameLinkedMap)
12557 {
12558 for (const auto &fd : *fn)
12559 {
12560 if (fd->isLinkableInProject()) fd->writeTagFile(tagFile);
12561 }
12562 }
12563 // for each class
12564 for (const auto &cd : *Doxygen::classLinkedMap)
12565 {
12566 ClassDefMutable *cdm = toClassDefMutable(cd.get());
12567 if (cdm && cdm->isLinkableInProject())
12568 {
12569 cdm->writeTagFile(tagFile);
12570 }
12571 }
12572 // for each concept
12573 for (const auto &cd : *Doxygen::conceptLinkedMap)
12574 {
12575 ConceptDefMutable *cdm = toConceptDefMutable(cd.get());
12576 if (cdm && cdm->isLinkableInProject())
12577 {
12578 cdm->writeTagFile(tagFile);
12579 }
12580 }
12581 // for each namespace
12582 for (const auto &nd : *Doxygen::namespaceLinkedMap)
12583 {
12585 if (ndm && nd->isLinkableInProject())
12586 {
12587 ndm->writeTagFile(tagFile);
12588 }
12589 }
12590 // for each group
12591 for (const auto &gd : *Doxygen::groupLinkedMap)
12592 {
12593 if (gd->isLinkableInProject()) gd->writeTagFile(tagFile);
12594 }
12595 // for each module
12596 for (const auto &mod : ModuleManager::instance().modules())
12597 {
12598 if (mod->isLinkableInProject()) mod->writeTagFile(tagFile);
12599 }
12600 // for each page
12601 for (const auto &pd : *Doxygen::pageLinkedMap)
12602 {
12603 if (pd->isLinkableInProject()) pd->writeTagFile(tagFile);
12604 }
12605 // for requirements
12607 // for each directory
12608 for (const auto &dd : *Doxygen::dirLinkedMap)
12609 {
12610 if (dd->isLinkableInProject()) dd->writeTagFile(tagFile);
12611 }
12612 if (Doxygen::mainPage) Doxygen::mainPage->writeTagFile(tagFile);
12613
12614 tagFile << "</tagfile>\n";
12615}
virtual void writeTagFile(TextStream &) const =0
virtual void writeTagFile(TextStream &)=0
virtual void writeTagFile(TextStream &)=0
void writeTagFile(TextStream &tagFile)

References Doxygen::classLinkedMap, Doxygen::conceptLinkedMap, Config_getString, Doxygen::dirLinkedMap, DString::empty(), err, Doxygen::groupLinkedMap, Doxygen::inputNameLinkedMap, ModuleManager::instance(), RequirementManager::instance(), Definition::isLinkableInProject(), Doxygen::mainPage, Doxygen::namespaceLinkedMap, Portable::openOutputStream(), Doxygen::pageLinkedMap, toClassDefMutable(), toConceptDefMutable(), toNamespaceDefMutable(), ClassDef::writeTagFile(), ConceptDefMutable::writeTagFile(), NamespaceDefMutable::writeTagFile(), and RequirementManager::writeTagFile().

Referenced by generateOutput().

Variable Documentation

◆ g_classEntries

◆ g_commentFileName

DString g_commentFileName
static

Definition at line 196 of file doxygen.cpp.

Referenced by parseInput(), and readConfiguration().

◆ g_compoundKeywords

const StringUnorderedSet g_compoundKeywords
static
Initial value:
=
{ "template class", "template struct", "class", "struct", "record", "union", "interface", "exception" }

Definition at line 202 of file doxygen.cpp.

Referenced by buildVarList(), and filterMemberDocumentation().

◆ g_dumpSymbolMap

bool g_dumpSymbolMap = false
static

Definition at line 195 of file doxygen.cpp.

Referenced by generateOutput(), and readConfiguration().

◆ g_inputFiles

◆ g_outputList

◆ g_s

◆ g_singleComment

bool g_singleComment =false
static

Definition at line 197 of file doxygen.cpp.

Referenced by parseInput(), and readConfiguration().

◆ g_successfulRun

bool g_successfulRun = false
static

Definition at line 194 of file doxygen.cpp.

Referenced by exitDoxygen(), and generateOutput().

◆ g_usingClassMap

std::unordered_map<std::string,std::vector<ClassDefMutable*> > g_usingClassMap
static

Definition at line 2481 of file doxygen.cpp.

Referenced by findUsingDeclImports(), and parseInput().

◆ g_usingDeclarations

StringSet g_usingDeclarations
static

Definition at line 193 of file doxygen.cpp.

Referenced by buildListOfUsingDecls(), findScopeFromQualifiedName(), and parseInput().