Doxygen
Loading...
Searching...
No Matches
entry.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#include <algorithm>
19#include <atomic>
20#include <stdlib.h>
21
22#include "entry.h"
23#include "util.h"
24#include "section.h"
25#include "doxygen.h"
26#include "arguments.h"
27#include "config.h"
28
29//------------------------------------------------------------------
30
32
33Entry::Entry() : section(EntryType::makeEmpty()), program(static_cast<size_t>(0)), initializer(static_cast<size_t>(0))
34{
35 //printf("Entry::Entry(%p)\n",this);
36 g_num++;
37 m_parent=nullptr;
38 //printf("Entry::Entry() tArgList=0\n");
39 mGrpId = -1;
40 hasTagInfo = false;
41 relatesType = RelatesType::Simple;
42 hidden = false;
44 reset();
45}
46
48{
49 //printf("Entry::Entry(%p):copy\n",this);
50 g_num++;
51 type = e.type;
52 name = e.name;
56 mtype = e.mtype;
57 spec = e.spec;
63 proto = e.proto;
67 virt = e.virt;
68 args = e.args;
71 argList = e.argList;
77 doc = e.doc;
78 docLine = e.docLine;
79 docFile = e.docFile;
80 brief = e.brief;
86 relates = e.relates;
88 read = e.read;
89 write = e.write;
90 inside = e.inside;
96 mGrpId = e.mGrpId;
97 anchors = e.anchors;
101 sli = e.sli;
102 rqli = e.rqli;
103 lang = e.lang;
104 hidden = e.hidden;
107 id = e.id;
108 extends = e.extends;
109 groups = e.groups;
110 req = e.req;
113
114 m_parent = e.m_parent;
115 // deep copy child entries
116 m_sublist.reserve(e.m_sublist.size());
117 for (const auto &cur : e.m_sublist)
118 {
119 m_sublist.push_back(std::make_shared<Entry>(*cur));
120 }
121}
122
124{
125 //printf("Entry::~Entry(%p) num=%d\n",this,g_num);
126 //printf("Deleting entry %d name %s type %x children %d\n",
127 // num,qPrint(name),section,sublist->count());
128
129 g_num--;
130}
131
133{
134 current->m_parent=this;
135 m_sublist.emplace_back(current);
136 current = new Entry;
137}
138
139void Entry::moveToSubEntryAndRefresh(std::shared_ptr<Entry> &current)
140{
141 current->m_parent=this;
142 m_sublist.push_back(current);
143 current = std::make_shared<Entry>();
144}
145
147{
148 current->m_parent=this;
149 m_sublist.emplace_back(current);
150}
151
152void Entry::moveToSubEntryAndKeep(std::shared_ptr<Entry> current)
153{
154 current->m_parent=this;
155 m_sublist.push_back(current);
156}
157
159{
160 Entry *copy = new Entry(*current);
161 copy->m_parent=this;
162 m_sublist.emplace_back(copy);
163}
164
165void Entry::copyToSubEntry(const std::shared_ptr<Entry> &current)
166{
167 std::shared_ptr<Entry> copy = std::make_shared<Entry>(*current);
168 copy->m_parent=this;
169 m_sublist.push_back(copy);
170}
171
173{
174 auto it = std::find_if(m_sublist.begin(),m_sublist.end(),
175 [e](const std::shared_ptr<Entry>&elem) { return elem.get()==e; });
176 if (it!=m_sublist.end())
177 {
178 m_sublist.erase(it);
179 }
180}
181
182
184{
185 //printf("Entry::reset()\n");
186 name.clear();
187 type.clear();
188 args.clear();
192 program.str(std::string());
195 doc.clear();
196 docFile.clear();
197 docLine=-1;
198 relates.clear();
199 relatesType=RelatesType::Simple;
200 brief.clear();
202 briefLine=-1;
205 inbodyLine=-1;
206 inside.clear();
207 fileName.clear();
208 initializer.str(std::string());
209 initLines = -1;
210 startLine = 1;
211 startColumn = 1;
212 bodyLine = -1;
213 bodyColumn = 1;
214 endBodyLine = -1;
215 mGrpId = -1;
217 exported = false;
218 section = EntryType::makeEmpty();
219 mtype = MethodTypes::Method;
220 virt = Specifier::Normal;
221 isStatic = false;
222 proto = false;
223 explicitExternal = false;
224 spec.reset();
226 lang = SrcLangExt::Unknown;
227 hidden = false;
228 artificial = false;
229 subGrouping = true;
230 protection = Protection::Public;
232 id.clear();
233 metaData.clear();
234 m_sublist.clear();
235 extends.clear();
236 groups.clear();
237 anchors.clear();
238 argList.reset();
239 tArgLists.clear();
241 sli.clear();
242 rqli.clear();
243 req.clear();
244 m_fileDef = nullptr;
245 qualifiers.clear();
246}
247
249{
250 m_fileDef = fd;
251 for (const auto &childNode : m_sublist)
252 {
253 childNode->setFileDef(fd);
254 }
255}
256
257//------------------------------------------------------------------
void reset()
Definition arguments.h:80
void reset()
Definition entry.h:63
void clear()
Definition dstring.h:219
TextStream initializer
initial value (for variables)
Definition entry.h:199
void moveToSubEntryAndKeep(Entry *e)
Definition entry.cpp:146
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:184
bool subGrouping
automatically group class members?
Definition entry.h:189
RequirementRefs rqli
references to requirements
Definition entry.h:229
void setFileDef(FileDef *fd)
Definition entry.cpp:248
TextStream program
the program text
Definition entry.h:198
bool proto
prototype ?
Definition entry.h:188
std::vector< std::shared_ptr< Entry > > m_sublist
Definition entry.h:268
GroupDocType groupDocType
Definition entry.h:233
int docLine
line number at which the documentation was found
Definition entry.h:203
DString includeName
include name (3 arg of \class)
Definition entry.h:201
DString bitfields
member's bit fields
Definition entry.h:194
ArgumentList typeConstr
where clause (C#) for type constraints
Definition entry.h:217
int endBodyLine
line number where the definition ends
Definition entry.h:220
bool hasTagInfo
is tag info valid
Definition entry.h:176
DString write
property write accessor
Definition entry.h:214
bool exported
is the symbol exported from a C++20 module
Definition entry.h:190
DString includeFile
include file (2 arg of \class, must be unique)
Definition entry.h:200
DString fileName
file this entry was extracted from
Definition entry.h:225
ArgumentLists tArgLists
template argument declarations
Definition entry.h:197
DString docFile
file in which the documentation was found
Definition entry.h:204
LocalToc localToc
Definition entry.h:235
MethodTypes mtype
signal, slot, (dcop) method, or property?
Definition entry.h:182
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:122
DString args
member argument string
Definition entry.h:193
SrcLangExt lang
programming language in which this entry was found
Definition entry.h:230
TagInfo tagInfoData
tag file info data
Definition entry.h:177
DString inside
name of the class in which documents are found
Definition entry.h:215
DString doc
documentation block (partly parsed)
Definition entry.h:202
DString req
C++20 requires clause.
Definition entry.h:237
int startColumn
start column of entry in the source
Definition entry.h:227
bool explicitExternal
explicitly defined as external?
Definition entry.h:187
DString brief
brief description (doc block)
Definition entry.h:205
std::vector< const SectionInfo * > anchors
list of anchors defined in this entry
Definition entry.h:224
void moveToSubEntryAndRefresh(Entry *&e)
Definition entry.cpp:132
RelatesType relatesType
how relates is handled
Definition entry.h:212
std::vector< Grouping > groups
list of groups this entry belongs to
Definition entry.h:223
CommandOverrides commandOverrides
store info for commands whose default can be overridden
Definition entry.h:191
int startLine
start line of entry in the source
Definition entry.h:226
Entry()
Definition entry.cpp:33
ArgumentList argList
member arguments as a list
Definition entry.h:196
DString type
member type
Definition entry.h:174
int inbodyLine
line number at which the body doc was found
Definition entry.h:209
FileDef * m_fileDef
Definition entry.h:269
EntryType section
entry type (see Sections);
Definition entry.h:173
int bodyLine
line number of the body in the source
Definition entry.h:218
DString exception
throw specification
Definition entry.h:216
DString relates
related class (doc block)
Definition entry.h:211
int mGrpId
member group id
Definition entry.h:221
void copyToSubEntry(Entry *e)
Definition entry.cpp:158
std::vector< BaseInfo > extends
list of base classes
Definition entry.h:222
DString inbodyFile
file in which the body doc was found
Definition entry.h:210
DString attributes
member's attributes (e.g. [[nodiscard]])
Definition entry.h:195
Specifier virt
virtualness of the entry
Definition entry.h:192
DString metaData
Slice metadata.
Definition entry.h:236
std::vector< std::string > qualifiers
qualifiers specified with the qualifier command
Definition entry.h:238
DString name
member name
Definition entry.h:175
RefItemVector sli
special lists (test/todo/bug/deprecated/..) this entry is in
Definition entry.h:228
Protection protection
class protection
Definition entry.h:181
bool artificial
Artificially introduced item.
Definition entry.h:232
bool hidden
does this represent an entity that is hidden from the output
Definition entry.h:231
~Entry()
Definition entry.cpp:123
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:208
int briefLine
line number at which the brief desc. was found
Definition entry.h:206
Entry * m_parent
parent node in the tree
Definition entry.h:267
DString id
libclang id
Definition entry.h:234
int initLines
define/variable initializer lines to show
Definition entry.h:185
bool isStatic
static ?
Definition entry.h:186
int bodyColumn
column of the body in the source
Definition entry.h:219
void reset()
Definition entry.cpp:183
TypeSpecifier spec
class/member specifiers
Definition entry.h:183
DString briefFile
file in which the brief desc. was found
Definition entry.h:207
DString read
property read accessor
Definition entry.h:213
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:99
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232
#define AtomicInt
Definition doxygen.h:31
static AtomicInt g_num
Definition entry.cpp:31
A bunch of utility functions.