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