Doxygen
entry.cpp
浏览该文件的文档.
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 
34 {
35  //printf("Entry::Entry(%p)\n",this);
36  g_num++;
37  m_parent=0;
39  //printf("Entry::Entry() tArgList=0\n");
40  mGrpId = -1;
41  hasTagInfo = FALSE;
43  hidden = FALSE;
45  reset();
46 }
47 
49 {
50  //printf("Entry::Entry(%p):copy\n",this);
51  g_num++;
52  section = e.section;
53  type = e.type;
54  name = e.name;
58  mtype = e.mtype;
59  spec = e.spec;
60  initLines = e.initLines;
61  stat = e.stat;
62  localToc = e.localToc;
64  proto = e.proto;
66  callGraph = e.callGraph;
70  virt = e.virt;
71  args = e.args;
72  bitfields = e.bitfields;
73  argList = e.argList;
74  tArgLists = e.tArgLists;
75  program.str(e.program.str());
79  doc = e.doc;
80  docLine = e.docLine;
81  docFile = e.docFile;
82  brief = e.brief;
83  briefLine = e.briefLine;
84  briefFile = e.briefFile;
88  relates = e.relates;
90  read = e.read;
91  write = e.write;
92  inside = e.inside;
93  exception = e.exception;
95  bodyLine = e.bodyLine;
98  mGrpId = e.mGrpId;
99  anchors = e.anchors;
100  fileName = e.fileName;
101  startLine = e.startLine;
103  sli = e.sli;
104  lang = e.lang;
105  hidden = e.hidden;
108  id = e.id;
109  extends = e.extends;
110  groups = e.groups;
111  req = e.req;
112  m_fileDef = e.m_fileDef;
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 
139 void 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 
152 void 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 
165 void 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  bool entryCallGraph = Config_getBool(CALL_GRAPH);
186  bool entryCallerGraph = Config_getBool(CALLER_GRAPH);
187  bool entryReferencedByRelation = Config_getBool(REFERENCED_BY_RELATION);
188  bool entryReferencesRelation = Config_getBool(REFERENCES_RELATION);
189  //printf("Entry::reset()\n");
190  name.resize(0);
191  type.resize(0);
192  args.resize(0);
193  bitfields.resize(0);
194  exception.resize(0);
195  program.str(std::string());
196  includeFile.resize(0);
197  includeName.resize(0);
198  doc.resize(0);
199  docFile.resize(0);
200  docLine=-1;
201  relates.resize(0);
203  brief.resize(0);
204  briefFile.resize(0);
205  briefLine=-1;
206  inbodyDocs.resize(0);
207  inbodyFile.resize(0);
208  inbodyLine=-1;
209  inside.resize(0);
210  fileName.resize(0);
211  initializer.str(std::string());
212  initLines = -1;
213  startLine = 1;
214  startColumn = 1;
215  bodyLine = -1;
216  bodyColumn = 1;
217  endBodyLine = -1;
218  mGrpId = -1;
219  callGraph = entryCallGraph;
220  callerGraph = entryCallerGraph;
221  referencedByRelation = entryReferencedByRelation;
222  referencesRelation = entryReferencesRelation;
223  section = EMPTY_SEC;
224  mtype = Method;
225  virt = Normal;
226  stat = FALSE;
227  proto = FALSE;
229  spec = 0;
231  hidden = FALSE;
232  artificial = FALSE;
233  subGrouping = TRUE;
234  protection = Public;
236  id.resize(0);
237  metaData.resize(0);
238  m_sublist.clear();
239  extends.clear();
240  groups.clear();
241  anchors.clear();
242  argList.reset();
243  tArgLists.clear();
244  typeConstr.reset();
245  sli.clear();
246  req.resize(0);
247  m_fileDef = 0;
248 }
249 
251 {
252  m_fileDef = fd;
253  for (const auto &childNode : m_sublist)
254  {
255  childNode->setFileDef(fd);
256  }
257 }
258 
259 //------------------------------------------------------------------
SrcLangExt_Unknown
@ SrcLangExt_Unknown
Definition: types.h:43
Entry::args
QCString args
member argument string
Definition: entry.h:259
Entry::tArgLists
ArgumentLists tArgLists
template argument declarations
Definition: entry.h:262
Entry::GROUPDOC_NORMAL
@ GROUPDOC_NORMAL
defgroup
Definition: entry.h:190
Entry::virt
Specifier virt
virtualness of the entry
Definition: entry.h:258
Normal
@ Normal
Definition: types.h:29
Entry::initializer
TextStream initializer
initial value (for variables)
Definition: entry.h:264
Entry::startLine
int startLine
start line of entry in the source
Definition: entry.h:291
Entry::callGraph
bool callGraph
do we need to draw the call graph?
Definition: entry.h:254
Entry::spec
uint64 spec
class/member specifiers
Definition: entry.h:248
section.h
Entry::mtype
MethodTypes mtype
signal, slot, (dcop) method, or property?
Definition: entry.h:247
Entry::extends
std::vector< BaseInfo > extends
list of base classes
Definition: entry.h:287
AtomicInt
#define AtomicInt
Definition: doxygen.h:28
Entry::startColumn
int startColumn
start column of entry in the source
Definition: entry.h:292
Entry::name
QCString name
member name
Definition: entry.h:240
Entry::hidden
bool hidden
does this represent an entity that is hidden from the output
Definition: entry.h:295
Entry::removeSubEntry
void removeSubEntry(const Entry *e)
Definition: entry.cpp:172
Entry::anchors
std::vector< const SectionInfo * > anchors
list of anchors defined in this entry
Definition: entry.h:289
Entry::hasTagInfo
bool hasTagInfo
is tag info valid
Definition: entry.h:241
Entry::referencedByRelation
bool referencedByRelation
do we need to show the referenced by relation?
Definition: entry.h:256
Entry::mGrpId
int mGrpId
member group id
Definition: entry.h:286
Entry::protection
Protection protection
class protection
Definition: entry.h:246
Public
@ Public
Definition: types.h:26
Entry::id
QCString id
libclang id
Definition: entry.h:298
Entry::briefFile
QCString briefFile
file in which the brief desc. was found
Definition: entry.h:272
Entry::includeName
QCString includeName
include name (3 arg of \class)
Definition: entry.h:266
Entry::docLine
int docLine
line number at which the documentation was found
Definition: entry.h:268
Entry::includeFile
QCString includeFile
include file (2 arg of \class, must be unique)
Definition: entry.h:265
Entry::reset
void reset()
Definition: entry.cpp:183
Entry::setFileDef
void setFileDef(FileDef *fd)
Definition: entry.cpp:250
Entry::relates
QCString relates
related class (doc block)
Definition: entry.h:276
Entry::doc
QCString doc
documentation block (partly parsed)
Definition: entry.h:267
Entry::groupDocType
GroupDocType groupDocType
Definition: entry.h:297
Entry::bodyColumn
int bodyColumn
column of the body in the source
Definition: entry.h:284
Entry::inbodyDocs
QCString inbodyDocs
documentation inside the body of a function
Definition: entry.h:273
Entry::metaData
QCString metaData
Slice metadata
Definition: entry.h:300
Entry::program
TextStream program
the program text
Definition: entry.h:263
entry.h
Method
@ Method
Definition: types.h:32
Entry::briefLine
int briefLine
line number at which the brief desc. was found
Definition: entry.h:271
Entry::section
int section
entry type (see Sections);
Definition: entry.h:238
arguments.h
doxygen.h
Entry::endBodyLine
int endBodyLine
line number where the definition ends
Definition: entry.h:285
Entry::localToc
LocalToc localToc
Definition: entry.h:299
Entry::callerGraph
bool callerGraph
do we need to draw the caller graph?
Definition: entry.h:255
Entry::moveToSubEntryAndKeep
void moveToSubEntryAndKeep(Entry *e)
Definition: entry.cpp:146
Entry::m_parent
Entry * m_parent
parent node in the tree
Definition: entry.h:330
g_num
static AtomicInt g_num
Definition: entry.cpp:31
Entry::m_fileDef
FileDef * m_fileDef
Definition: entry.h:333
TRUE
#define TRUE
Definition: qcstring.h:36
Entry::inbodyLine
int inbodyLine
line number at which the body doc was found
Definition: entry.h:274
TextStream::str
std::string str() const
Return the contents of the buffer as a std::string object
Definition: textstream.h:208
Entry::stat
bool stat
static ?
Definition: entry.h:250
Entry::copyToSubEntry
void copyToSubEntry(Entry *e)
Definition: entry.cpp:158
Entry::fileName
QCString fileName
file this entry was extracted from
Definition: entry.h:290
Entry::m_sublist
std::vector< std::shared_ptr< Entry > > m_sublist
Definition: entry.h:331
Entry::Entry
Entry()
Definition: entry.cpp:33
Entry::inbodyFile
QCString inbodyFile
file in which the body doc was found
Definition: entry.h:275
Entry::lang
SrcLangExt lang
programming language in which this entry was found
Definition: entry.h:294
Entry::typeConstr
ArgumentList typeConstr
where clause (C#) for type constraints
Definition: entry.h:282
Entry::brief
QCString brief
brief description (doc block)
Definition: entry.h:270
Entry::bodyLine
int bodyLine
line number of the body in the source
Definition: entry.h:283
Entry::initLines
int initLines
define/variable initializer lines to show
Definition: entry.h:249
Entry
Represents an unstructured piece of information, about an entity found in the sources.
Definition: entry.h:61
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
Entry::explicitExternal
bool explicitExternal
explicitly defined as external?
Definition: entry.h:251
Entry::relatesType
RelatesType relatesType
how relates is handled
Definition: entry.h:277
Entry::artificial
bool artificial
Artificially introduced item
Definition: entry.h:296
Entry::moveToSubEntryAndRefresh
void moveToSubEntryAndRefresh(Entry *&e)
Definition: entry.cpp:132
Entry::EMPTY_SEC
@ EMPTY_SEC
Definition: entry.h:94
config.h
ArgumentList::reset
void reset()
Definition: arguments.h:73
Entry::inside
QCString inside
name of the class in which documents are found
Definition: entry.h:280
FileDef
A model of a file symbol.
Definition: filedef.h:73
Entry::read
QCString read
property read accessor
Definition: entry.h:278
Entry::sli
RefItemVector sli
special lists (test/todo/bug/deprecated/..) this entry is in
Definition: entry.h:293
Entry::subGrouping
bool subGrouping
automatically group class members?
Definition: entry.h:253
Entry::type
QCString type
member type
Definition: entry.h:239
Entry::exception
QCString exception
throw specification
Definition: entry.h:281
Entry::proto
bool proto
prototype ?
Definition: entry.h:252
Entry::bitfields
QCString bitfields
member's bit fields
Definition: entry.h:260
Entry::referencesRelation
bool referencesRelation
do we need to show the references relation?
Definition: entry.h:257
Entry::argList
ArgumentList argList
member arguments as a list
Definition: entry.h:261
Entry::tagInfoData
TagInfo tagInfoData
tag file info data
Definition: entry.h:242
util.h
A bunch of utility functions.
Entry::docFile
QCString docFile
file in which the documentation was found
Definition: entry.h:269
Entry::write
QCString write
property write accessor
Definition: entry.h:279
Simple
@ Simple
Definition: types.h:35
Entry::~Entry
~Entry()
Definition: entry.cpp:123
Entry::groups
std::vector< Grouping > groups
list of groups this entry belongs to
Definition: entry.h:288
QCString::resize
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
Definition: qcstring.h:164
FALSE
#define FALSE
Definition: qcstring.h:33
Entry::req
QCString req
C++20 requires clause
Definition: entry.h:301