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
45 int line;
49 {
50 QCString result=importName;
51 if (!partitionName.isEmpty())
52 {
53 result+=":"+partitionName;
54 }
55 return result;
56 }
57};
58
59using ImportInfoList = std::vector<ImportInfo>;
60using ModuleMap = std::unordered_map<std::string,ModuleDef *>;
61using ImportInfoMap = std::unordered_map<std::string,ImportInfoList>;
62
63
65{
66 public:
68
69 enum class Type
70 {
73 };
74 virtual Type moduleType() const = 0;
75 virtual QCString partitionName() const = 0;
76 virtual void writeDocumentation(OutputList &ol) = 0;
77 virtual bool isPrimaryInterface() const = 0;
78 virtual MemberList *getMemberList(MemberListType lt) const = 0;
79 virtual const MemberLists &getMemberLists() const = 0;
80 virtual const MemberGroupList &getMemberGroups() const = 0;
81 virtual int countVisibleMembers() const = 0;
82 virtual const ClassLinkedRefMap &getClasses() const = 0;
83 virtual const ConceptLinkedRefMap &getConcepts() const = 0;
84 virtual FileDef *getFileDef() const = 0;
85 virtual const ImportInfoMap &getImports() const = 0;
86 virtual const ImportInfoMap &getExports() const = 0;
87 virtual const ModuleMap &partitions() const = 0;
88 virtual void writeTagFile(TextStream &tagFile) const = 0;
89 virtual FileList getUsedFiles() const = 0;
90};
91
93const ModuleDef *toModuleDef(const Definition *d);
94
95class ModuleLinkedMap : public LinkedMap<ModuleDef>
96{
97};
98
99class ModuleLinkedRefMap : public LinkedRefMap<ModuleDef>
100{
101 public:
102 bool declVisible() const;
103 void writeDeclaration(OutputList &ol,const QCString &header,bool localNames) const;
104};
105
106class ModuleList : public std::vector<ModuleDef *>
107{
108};
109
111{
112 public:
113 static ModuleManager &instance();
114 void createModuleDef(const QCString &fileName, int line, int column, bool exported,
115 const QCString &moduleName, const QCString &partitionName=QCString());
116 void clear();
117 void addHeader(const QCString &moduleFile,int line,const QCString &headerName,bool isSystem);
118 void addImport(const QCString &moduleFile,int line,const QCString &importName,bool isExported,const QCString &partitionName=QCString());
119 void addClassToModule (const Entry *root,ClassDef *cd);
120 void addConceptToModule (const Entry *root,ConceptDef *cd);
121 void addMemberToModule (const Entry *root,MemberDef *md);
122 void addDocs(const Entry *root);
123 void addTagInfo(const QCString &moduleFile,const QCString &tagName,const QCString &clangId);
124 void addListReferences();
128 void sortMemberLists();
129
130 void resolvePartitions();
131 void resolveImports();
133 void countMembers();
135 int numDocumentedModules() const;
136 const ModuleLinkedMap &modules() const;
137 ModuleDef *getPrimaryInterface(const QCString &moduleName) const;
138
139 private:
141 ~ModuleManager() = default;
145 struct Private;
146 std::unique_ptr<Private> p;
147
148};
149
150#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
A model of a file symbol.
Definition filedef.h:99
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
Wrapper class for the MemberListType type.
Definition types.h:184
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:146
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
This is an alternative implementation of QCString.
Definition qcstring.h:101
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:60
std::vector< ImportInfo > ImportInfoList
Definition moduledef.h:59
ModuleDef * toModuleDef(Definition *d)
std::unordered_map< std::string, ImportInfoList > ImportInfoMap
Definition moduledef.h:61
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