Doxygen
Loading...
Searching...
No Matches
moduledef.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2023 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#ifndef MODULE_H
17#define MODULE_H
18
19#include "definition.h"
20#include "linkedmap.h"
21#include "filedef.h"
22
23class Entry;
24class ClassDef;
25class MemberDef;
26class NamespaceDef;
27class ConceptDef;
28class OutputList;
29class MemberList;
30class MemberLists;
31class MemberGroupList;
34class TextStream;
35
36class ModuleDef;
37
39{
40 ImportInfo(ModuleDef *def,const QCString &name,int l,const QCString &pName,bool isExported=false)
41 : moduleDef(def), importName(name), line(l), partitionName(pName), exported(isExported) {}
42
43 ModuleDef *moduleDef;
44 QCString importName;
45 int line;
46 QCString partitionName;
48 QCString qualifiedName() const
49 {
50 QCString result=importName;
51 if (!partitionName.isEmpty())
52 {
53 result+=":"+partitionName;
54 }
55 return result;
56 }
57};
58
59using ModuleMap = std::unordered_map<std::string,ModuleDef *>;
60using ImportInfoMap = std::unordered_map<std::string,ImportInfo>;
61
62
64{
65 public:
66 ABSTRACT_BASE_CLASS(ModuleDef)
67
68 enum class Type
69 {
72 };
73 virtual Type moduleType() const = 0;
74 virtual QCString partitionName() const = 0;
75 virtual void writeDocumentation(OutputList &ol) = 0;
76 virtual bool isPrimaryInterface() const = 0;
77 virtual MemberList *getMemberList(MemberListType lt) const = 0;
78 virtual const MemberLists &getMemberLists() const = 0;
79 virtual const MemberGroupList &getMemberGroups() const = 0;
80 virtual int countVisibleMembers() const = 0;
81 virtual const ClassLinkedRefMap &getClasses() const = 0;
82 virtual const ConceptLinkedRefMap &getConcepts() const = 0;
83 virtual FileDef *getFileDef() const = 0;
84 virtual const ImportInfoMap &getImports() const = 0;
85 virtual const ImportInfoMap &getExports() const = 0;
86 virtual const ModuleMap &partitions() const = 0;
87 virtual void writeTagFile(TextStream &tagFile) const = 0;
88 virtual FileList getUsedFiles() const = 0;
89};
90
92const ModuleDef *toModuleDef(const Definition *d);
93
94class ModuleLinkedMap : public LinkedMap<ModuleDef>
95{
96};
97
98class ModuleLinkedRefMap : public LinkedRefMap<ModuleDef>
99{
100 public:
101 bool declVisible() const;
102 void writeDeclaration(OutputList &ol,const QCString &header,bool localNames) const;
103};
104
105class ModuleList : public std::vector<ModuleDef *>
106{
107};
108
110{
111 public:
112 static ModuleManager &instance();
113 void createModuleDef(const QCString &fileName, int line, int column, bool exported,
114 const QCString &moduleName, const QCString &partitionName=QCString());
115 void clear();
116 void addHeader(const QCString &moduleFile,int line,const QCString &headerName,bool isSystem);
117 void addImport(const QCString &moduleFile,int line,const QCString &importName,bool isExported,const QCString &partitionName=QCString());
118 void addClassToModule (const Entry *root,ClassDef *cd);
119 void addConceptToModule (const Entry *root,ConceptDef *cd);
120 void addMemberToModule (const Entry *root,MemberDef *md);
121 void addDocs(const Entry *root);
122 void addTagInfo(const QCString &moduleFile,const QCString &tagName,const QCString &clangId);
123 void addListReferences();
127 void sortMemberLists();
128
129 void resolvePartitions();
130 void resolveImports();
132 void countMembers();
133 void writeDocumentation(OutputList &ol);
134 int numDocumentedModules() const;
135 const ModuleLinkedMap &modules() const;
136 ModuleDef *getPrimaryInterface(const QCString &moduleName) const;
137
138 private:
140 ~ModuleManager() = default;
142 void resolvePartitionsRecursively(ModuleDef *intfMod, ModuleDef *mod);
143 void collectExportedSymbolsRecursively(ModuleDef *intfMod, ModuleDef *mod);
144 struct Private;
145 std::unique_ptr<Private> p;
146
147};
148
149#endif
A abstract class representing of a compound symbol.
Definition classdef.h:104
The common base class of all entity definitions found in the sources.
Definition definition.h:76
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:116
Container class representing a vector of objects with keys.
Definition linkedmap.h:36
Container class representing a vector of objects with keys.
Definition linkedmap.h:232
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:108
virtual QCString partitionName() const =0
virtual const ImportInfoMap & getImports() const =0
virtual MemberList * getMemberList(MemberListType lt) const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual int countVisibleMembers() const =0
virtual const ModuleMap & partitions() const =0
virtual bool isPrimaryInterface() const =0
virtual Type moduleType() const =0
virtual const MemberLists & getMemberLists() const =0
virtual void writeDocumentation(OutputList &ol)=0
virtual FileList getUsedFiles() const =0
virtual const ImportInfoMap & getExports() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual FileDef * getFileDef() const =0
virtual void writeTagFile(TextStream &tagFile) const =0
bool declVisible() const
void writeDeclaration(OutputList &ol, const QCString &header, bool localNames) const
void addListReferences()
int numDocumentedModules() const
~ModuleManager()=default
void sortMemberLists()
void resolveImports()
static ModuleManager & instance()
void addDocs(const Entry *root)
void collectExportedSymbolsRecursively(ModuleDef *intfMod, ModuleDef *mod)
void addHeader(const QCString &moduleFile, int line, const QCString &headerName, bool isSystem)
void countMembers()
void addConceptToModule(const Entry *root, ConceptDef *cd)
void addTagInfo(const QCString &moduleFile, const QCString &tagName, const QCString &clangId)
void addClassToModule(const Entry *root, ClassDef *cd)
void createModuleDef(const QCString &fileName, int line, int column, bool exported, const QCString &moduleName, const QCString &partitionName=QCString())
ModuleDef * getPrimaryInterface(const QCString &moduleName) const
void addMemberToModule(const Entry *root, MemberDef *md)
void writeDocumentation(OutputList &ol)
void addMembersToMemberGroup()
void resolvePartitions()
std::unique_ptr< Private > p
Definition moduledef.h:145
void findSectionsInDocumentation()
void collectExportedSymbols()
void resolvePartitionsRecursively(ModuleDef *intfMod, ModuleDef *mod)
const ModuleLinkedMap & modules() const
void addImport(const QCString &moduleFile, int line, const QCString &importName, bool isExported, const QCString &partitionName=QCString())
void distributeMemberGroupDocumentation()
An abstract interface of a namespace symbol.
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:314
Text streaming class that buffers data.
Definition textstream.h:36
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
std::unordered_map< std::string, ModuleDef * > ModuleMap
Definition moduledef.h:59
ModuleDef * toModuleDef(Definition *d)
std::unordered_map< std::string, ImportInfo > ImportInfoMap
Definition moduledef.h:60
bool exported
Definition moduledef.h:47
ImportInfo(ModuleDef *def, const QCString &name, int l, const QCString &pName, bool isExported=false)
Definition moduledef.h:40
ModuleDef * moduleDef
Definition moduledef.h:43
QCString partitionName
Definition moduledef.h:46
QCString qualifiedName() const
Definition moduledef.h:48
QCString importName
Definition moduledef.h:44