Doxygen
Loading...
Searching...
No Matches
entry.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2026 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 ENTRY_H
17#define ENTRY_H
18
19#include <functional>
20#include <memory>
21#include <vector>
22
23#include "arguments.h"
24#include "configvalues.h"
25#include "reflist.h"
26#include "requirement.h"
27#include "textstream.h"
28#include "types.h"
29
30class FileDef;
31class SectionInfo;
32
33//--------------------------------------------------------------
34
42
43#define COMMAND_OVERRIDES \
44 OVERRIDE_ENTRY(bool, bool, 1, callGraph ) \
45 OVERRIDE_ENTRY(bool, bool, 1, callerGraph ) \
46 OVERRIDE_ENTRY(bool, bool, 1, referencedByRelation ) \
47 OVERRIDE_ENTRY(bool, bool, 1, referencesRelation ) \
48 OVERRIDE_ENTRY(bool, bool, 1, inlineSource ) \
49 OVERRIDE_ENTRY(bool, bool, 1, includeGraph ) \
50 OVERRIDE_ENTRY(bool, bool, 1, includedByGraph ) \
51 OVERRIDE_ENTRY(bool, bool, 1, directoryGraph ) \
52 OVERRIDE_ENTRY(bool, bool, 1, collaborationGraph ) \
53 OVERRIDE_ENTRY(bool, bool, 1, groupGraph ) \
54 OVERRIDE_ENTRY(bool, bool, 1, enumValues ) \
55 OVERRIDE_ENTRY(CLASS_GRAPH_t, int, 3, inheritanceGraph )
56
58{
59 private:
60#define OVERRIDE_ENTRY(type,store_type,bits,name) \
61 store_type m_##name : bits; \
62 bool m_##name##ExplicitlySet : 1;
64#undef OVERRIDE_ENTRY
65
66 public:
68 void reset() { std::memset(this, 0, sizeof(*this)); }
69
70 // conversions between type and store_type
71 bool to_store_type(bool t) const { return t; }
72 int to_store_type(CLASS_GRAPH_t t) const { return static_cast<int>(t); }
73 bool from_store_type(bool t) const { return t; }
74 CLASS_GRAPH_t from_store_type(int t) const { return static_cast<CLASS_GRAPH_t>(t); }
75
76#define OVERRIDE_ENTRY(type,store_type,bits,name) \
77 void override_##name(type value) { \
78 m_##name = to_store_type(value); \
79 m_##name##ExplicitlySet = true; \
80 /* printf("overrule_%s(%d) isSet=%d\n",#name,value,m_##name##ExplicitlySet); */ \
81 } \
82 void apply_##name(std::function<void(type)> func) const { \
83 /* printf("apply_%s(%d) isSet=%d\n",#name,m_##name,m_##name##ExplicitlySet); */ \
84 if (m_##name##ExplicitlySet) func(from_store_type(m_##name)); \
85 }
87#undef OVERRIDE_ENTRY
88
89};
90
91//--------------------------------------------------------------
92
93/** This class stores information about an inheritance relation
94 */
96{
97 /*! Creates an object representing an inheritance relation */
99 name(n),prot(p),virt(v) {}
100 DString name; //!< the name of the base class
101 Protection prot; //!< inheritance type
102 Specifier virt; //!< virtualness
103};
104
105/** This struct is used to capture the tag file information
106 * for an Entry.
107 */
115
116/** Represents an unstructured piece of information, about an
117 * entity found in the sources.
118 *
119 * parseMain() in scanner.l will generate a tree of these
120 * entries.
121 */
122class Entry
123{
124 public:
125
127 {
128 GROUPDOC_NORMAL, //!< defgroup
129 GROUPDOC_ADD, //!< addtogroup
130 GROUPDOC_WEAK //!< weakgroup
131 }; //!< kind of group
132
133 Entry();
134 Entry(const Entry &);
135 Entry &operator=(const Entry &) = delete;
136 Entry(Entry &&) = delete;
137 Entry &operator=(Entry &&) = delete;
138 ~Entry();
139
140 /*! Returns the parent for this Entry or nullptr if this entry has no parent. */
141 Entry *parent() const { return m_parent; }
142
143 /*! Returns the list of children for this Entry
144 * @see addSubEntry() and removeSubEntry()
145 */
146 const std::vector< std::shared_ptr<Entry> > &children() const { return m_sublist; }
147
148 /*! @name add entry as a child and pass ownership.
149 * @note This makes the entry passed invalid!
150 * @{
151 */
153 void moveToSubEntryAndKeep(std::shared_ptr<Entry> e);
154 /*! @} */
155
156 /*! @name add entry as a child, pass ownership and reinitialize entry */
158 void moveToSubEntryAndRefresh(std::shared_ptr<Entry> &e);
159
160 /*! make a copy of \a e and add it as a child to this entry */
161 void copyToSubEntry (Entry* e);
162 void copyToSubEntry (const std::shared_ptr<Entry> &e);
163
164 /*! Removes entry \a e from the list of children.
165 * The entry will be deleted if found.
166 */
167 void removeSubEntry(const Entry *e);
168
169 /*! Restore the state of this Entry to the default value it has
170 * at construction time.
171 */
172 void reset();
173
174 void markAsProcessed() const { (const_cast<Entry*>(this))->section = EntryType::makeEmpty(); }
175 void setFileDef(FileDef *fd);
176 FileDef *fileDef() const { return m_fileDef; }
177
178 // identification
179 EntryType section; //!< entry type (see Sections);
180 DString type; //!< member type
181 DString name; //!< member name
182 bool hasTagInfo; //!< is tag info valid
183 TagInfo tagInfoData; //!< tag file info data
184 const TagInfo *tagInfo() const { return hasTagInfo ? &tagInfoData : nullptr; }
185
186 // content
187 Protection protection; //!< class protection
188 MethodTypes mtype; //!< signal, slot, (dcop) method, or property?
189 TypeSpecifier spec; //!< class/member specifiers
190 VhdlSpecifier vhdlSpec; //!< VHDL specifiers
191 int initLines; //!< define/variable initializer lines to show
192 bool isStatic; //!< static ?
193 bool explicitExternal; //!< explicitly defined as external?
194 bool proto; //!< prototype ?
195 bool subGrouping; //!< automatically group class members?
196 bool exported; //!< is the symbol exported from a C++20 module
197 CommandOverrides commandOverrides; //!< store info for commands whose default can be overridden
198 Specifier virt; //!< virtualness of the entry
199 DString args; //!< member argument string
200 DString bitfields; //!< member's bit fields
201 DString attributes; //!< member's attributes (e.g. [[nodiscard]])
202 ArgumentList argList; //!< member arguments as a list
203 ArgumentLists tArgLists; //!< template argument declarations
204 TextStream program; //!< the program text
205 TextStream initializer; //!< initial value (for variables)
206 DString includeFile; //!< include file (2 arg of \\class, must be unique)
207 DString includeName; //!< include name (3 arg of \\class)
208 DString doc; //!< documentation block (partly parsed)
209 std::vector<FieldDocumentation> fieldDocs; //!< documentation from \\field commands
210 int docLine; //!< line number at which the documentation was found
211 DString docFile; //!< file in which the documentation was found
212 DString brief; //!< brief description (doc block)
213 int briefLine; //!< line number at which the brief desc. was found
214 DString briefFile; //!< file in which the brief desc. was found
215 DString inbodyDocs; //!< documentation inside the body of a function
216 int inbodyLine; //!< line number at which the body doc was found
217 DString inbodyFile; //!< file in which the body doc was found
218 DString relates; //!< related class (doc block)
219 RelatesType relatesType; //!< how relates is handled
220 DString read; //!< property read accessor
221 DString write; //!< property write accessor
222 DString inside; //!< name of the class in which documents are found
223 DString exception; //!< throw specification
224 ArgumentList typeConstr; //!< where clause (C#) for type constraints
225 int bodyLine; //!< line number of the body in the source
226 size_t bodyColumn; //!< column of the body in the source
227 int endBodyLine; //!< line number where the definition ends
228 int mGrpId; //!< member group id
229 std::vector<BaseInfo> extends; //!< list of base classes
230 std::vector<Grouping> groups; //!< list of groups this entry belongs to
231 std::vector<const SectionInfo*> anchors; //!< list of anchors defined in this entry
232 DString fileName; //!< file this entry was extracted from
233 int startLine; //!< start line of entry in the source
234 size_t startColumn; //!< start column of entry in the source
235 RefItemVector sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in
236 RequirementRefs rqli; //!< references to requirements
237 SrcLangExt lang; //!< programming language in which this entry was found
238 bool hidden; //!< does this represent an entity that is hidden from the output
239 bool artificial; //!< Artificially introduced item
241 DString id; //!< libclang id
243 DString metaData; //!< Slice metadata
244 DString req; //!< C++20 requires clause
245 std::vector<std::string> qualifiers; //!< qualifiers specified with the qualifier command
246
247 /// return the command name used to define GROUPDOC_SEC
248 const char *groupDocCmd() const
249 {
250 switch( groupDocType )
251 {
252 case GROUPDOC_NORMAL: return "\\defgroup";
253 case GROUPDOC_ADD: return "\\addtogroup";
254 case GROUPDOC_WEAK: return "\\weakgroup";
255 default: return "unknown group command";
256 }
257 }
259 {
260 if( !section.isGroupDoc() )
261 {
263 }
264 switch( groupDocType )
265 {
269 default: return Grouping::GROUPING_LOWEST;
270 }
271 }
272
273 private:
274 Entry *m_parent; //!< parent node in the tree
275 std::vector< std::shared_ptr<Entry> > m_sublist;
277};
278
279typedef std::vector< std::shared_ptr<Entry> > EntryList;
280
281#endif
This class represents an function or template argument list.
Definition arguments.h:66
bool from_store_type(bool t) const
Definition entry.h:73
bool to_store_type(bool t) const
Definition entry.h:71
void reset()
Definition entry.h:68
CLASS_GRAPH_t from_store_type(int t) const
Definition entry.h:74
int to_store_type(CLASS_GRAPH_t t) const
Definition entry.h:72
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:123
TextStream initializer
initial value (for variables)
Definition entry.h:205
void moveToSubEntryAndKeep(Entry *e)
Definition entry.cpp:147
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:190
bool subGrouping
automatically group class members?
Definition entry.h:195
RequirementRefs rqli
references to requirements
Definition entry.h:236
Entry & operator=(const Entry &)=delete
void setFileDef(FileDef *fd)
Definition entry.cpp:250
const std::vector< std::shared_ptr< Entry > > & children() const
Definition entry.h:146
TextStream program
the program text
Definition entry.h:204
bool proto
prototype ?
Definition entry.h:194
std::vector< std::shared_ptr< Entry > > m_sublist
Definition entry.h:275
GroupDocType groupDocType
Definition entry.h:240
int docLine
line number at which the documentation was found
Definition entry.h:210
DString includeName
include name (3 arg of \class)
Definition entry.h:207
DString bitfields
member's bit fields
Definition entry.h:200
ArgumentList typeConstr
where clause (C#) for type constraints
Definition entry.h:224
void markAsProcessed() const
Definition entry.h:174
int endBodyLine
line number where the definition ends
Definition entry.h:227
bool hasTagInfo
is tag info valid
Definition entry.h:182
DString write
property write accessor
Definition entry.h:221
bool exported
is the symbol exported from a C++20 module
Definition entry.h:196
const TagInfo * tagInfo() const
Definition entry.h:184
const char * groupDocCmd() const
return the command name used to define GROUPDOC_SEC
Definition entry.h:248
DString includeFile
include file (2 arg of \class, must be unique)
Definition entry.h:206
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
LocalToc localToc
Definition entry.h:242
MethodTypes mtype
signal, slot, (dcop) method, or property?
Definition entry.h:188
std::vector< FieldDocumentation > fieldDocs
documentation from \field commands
Definition entry.h:209
GroupDocType
Definition entry.h:127
@ GROUPDOC_WEAK
weakgroup
Definition entry.h:130
@ GROUPDOC_ADD
addtogroup
Definition entry.h:129
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:128
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
TagInfo tagInfoData
tag file info data
Definition entry.h:183
DString inside
name of the class in which documents are found
Definition entry.h:222
DString doc
documentation block (partly parsed)
Definition entry.h:208
DString req
C++20 requires clause.
Definition entry.h:244
bool explicitExternal
explicitly defined as external?
Definition entry.h:193
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
void moveToSubEntryAndRefresh(Entry *&e)
Definition entry.cpp:133
RelatesType relatesType
how relates is handled
Definition entry.h:219
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:230
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
Entry()
Definition entry.cpp:33
size_t startColumn
start column of entry in the source
Definition entry.h:234
ArgumentList argList
member arguments as a list
Definition entry.h:202
Grouping::GroupPri_t groupingPri() const
Definition entry.h:258
DString type
member type
Definition entry.h:180
Entry(Entry &&)=delete
int inbodyLine
line number at which the body doc was found
Definition entry.h:216
FileDef * m_fileDef
Definition entry.h:276
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 exception
throw specification
Definition entry.h:223
DString relates
related class (doc block)
Definition entry.h:218
int mGrpId
member group id
Definition entry.h:228
void copyToSubEntry(Entry *e)
Definition entry.cpp:159
std::vector< BaseInfo > extends
list of base classes
Definition entry.h:229
DString inbodyFile
file in which the body doc was found
Definition entry.h:217
DString attributes
member's attributes (e.g. [[nodiscard]])
Definition entry.h:201
Specifier virt
virtualness of the entry
Definition entry.h:198
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
~Entry()
Definition entry.cpp:124
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:215
int briefLine
line number at which the brief desc. was found
Definition entry.h:213
Entry * m_parent
parent node in the tree
Definition entry.h:274
FileDef * fileDef() const
Definition entry.h:176
DString id
libclang id
Definition entry.h:241
int initLines
define/variable initializer lines to show
Definition entry.h:191
bool isStatic
static ?
Definition entry.h:192
Entry & operator=(Entry &&)=delete
void reset()
Definition entry.cpp:184
TypeSpecifier spec
class/member specifiers
Definition entry.h:189
DString briefFile
file in which the brief desc. was found
Definition entry.h:214
DString read
property read accessor
Definition entry.h:220
size_t bodyColumn
column of the body in the source
Definition entry.h:226
void removeSubEntry(const Entry *e)
Definition entry.cpp:173
Wrapper class for the Entry type.
Definition types.h:859
A model of a file symbol.
Definition filedef.h:97
class that provide information about a section.
Definition section.h:58
This struct is used to capture the tag file information for an Entry.
Definition entry.h:109
DString tagName
Definition entry.h:111
DString anchor
Definition entry.h:113
DString fileName
Definition entry.h:112
Text streaming class that buffers data.
Definition textstream.h:36
Wrapper class for a number of boolean properties.
Definition types.h:696
#define COMMAND_OVERRIDES
Definition entry.h:43
std::vector< std::shared_ptr< Entry > > EntryList
Definition entry.h:279
std::vector< RefItem * > RefItemVector
Definition reflist.h:134
std::vector< RequirementRef > RequirementRefs
List of requirement references.
Definition requirement.h:56
BaseInfo(const DString &n, Protection p, Specifier v)
Definition entry.h:98
Protection prot
inheritance type
Definition entry.h:101
Specifier virt
virtualness
Definition entry.h:102
DString name
the name of the base class
Definition entry.h:100
DString file
Definition entry.h:39
DString doc
Definition entry.h:38
DString name
Definition entry.h:37
GroupPri_t
Grouping priority.
Definition types.h:230
@ GROUPING_LOWEST
Definition types.h:231
@ GROUPING_AUTO_ADD
membership in group was defined via @add[to]group
Definition types.h:233
@ GROUPING_AUTO_WEAK
membership in group was defined via @weakgroup
Definition types.h:232
@ GROUPING_AUTO_DEF
membership in group was defined via @defgroup
Definition types.h:234
This file contains a number of basic enums and types.
MethodTypes
Definition types.h:119
Protection
Definition types.h:32
SrcLangExt
Definition types.h:207
RelatesType
Definition types.h:143
Specifier
Definition types.h:80
VhdlSpecifier
Definition types.h:772