Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: entry.h,v 1.36 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | * Copyright (C) 1997-2011 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 | #ifndef ENTRY_H␊ |
19 | #define ENTRY_H␊ |
20 | ␊ |
21 | #include "qtbc.h"␊ |
22 | #include <qlist.h>␊ |
23 | ␊ |
24 | #include <qgstring.h>␊ |
25 | #include "util.h"␊ |
26 | ␊ |
27 | struct SectionInfo;␊ |
28 | class QFile;␊ |
29 | class EntryNav;␊ |
30 | class FileDef;␊ |
31 | class FileStorage;␊ |
32 | class StorageIntf;␊ |
33 | ␊ |
34 | enum Protection { Public, Protected, Private, Package } ;␊ |
35 | enum Specifier { Normal, Virtual, Pure } ;␊ |
36 | enum MethodTypes { Method, Signal, Slot, DCOP, Property, Event };␊ |
37 | enum RelatesType { Simple, Duplicate, MemberOf };␊ |
38 | enum Relationship { Member, Related, Foreign };␊ |
39 | ␊ |
40 | struct ListItemInfo␊ |
41 | {␊ |
42 | QCString type;␊ |
43 | int itemId;␊ |
44 | };␊ |
45 | ␊ |
46 | /*! \brief This class stores information about an inheritance relation␊ |
47 | */ ␊ |
48 | struct BaseInfo ␊ |
49 | {␊ |
50 | /*! Creates an object representing an inheritance relation */␊ |
51 | BaseInfo(const char *n,Protection p,Specifier v) : ␊ |
52 | name(n),prot(p),virt(v) {}␊ |
53 | QCString name; //!< the name of the base class␊ |
54 | Protection prot; //!< inheritance type␊ |
55 | Specifier virt; //!< virtualness␊ |
56 | };␊ |
57 | ␊ |
58 | /*! \brief This class contains the information about the argument of a␊ |
59 | * function or template␊ |
60 | *␊ |
61 | */␊ |
62 | struct Argument␊ |
63 | {␊ |
64 | /*! Construct a new argument. */␊ |
65 | Argument() {}␊ |
66 | /*! Copy an argument (does a deep copy of all strings). */␊ |
67 | Argument(const Argument &a) ␊ |
68 | { ␊ |
69 | attrib=a.attrib.copy();␊ |
70 | type=a.type.copy(); ␊ |
71 | name=a.name.copy(); ␊ |
72 | defval=a.defval.copy(); ␊ |
73 | docs=a.docs.copy();␊ |
74 | array=a.array.copy();␊ |
75 | }␊ |
76 | /*! Assignment of an argument (does a deep copy of all strings). */␊ |
77 | Argument &operator=(const Argument &a)␊ |
78 | {␊ |
79 | if (this!=&a)␊ |
80 | {␊ |
81 | attrib=a.attrib.copy();␊ |
82 | type=a.type.copy(); ␊ |
83 | name=a.name.copy(); ␊ |
84 | defval=a.defval.copy(); ␊ |
85 | docs=a.docs.copy();␊ |
86 | array=a.array.copy();␊ |
87 | }␊ |
88 | return *this;␊ |
89 | }␊ |
90 | /*! return TRUE if this argument is documentation and the argument has a␊ |
91 | * non empty name.␊ |
92 | */␊ |
93 | bool hasDocumentation() const ␊ |
94 | { ␊ |
95 | return !name.isEmpty() && !docs.isEmpty(); ␊ |
96 | }␊ |
97 | ␊ |
98 | QCString attrib; /*!< Argument's attribute (IDL only) */␊ |
99 | QCString type; /*!< Argument's type */␊ |
100 | QCString canType; /*!< Cached value of canonical type (after type resolution). Empty initially. */␊ |
101 | QCString name; /*!< Argument's name (may be empty) */␊ |
102 | QCString array; /*!< Argument's array specifier (may be empty) */␊ |
103 | QCString defval; /*!< Argument's default value (may be empty) */␊ |
104 | QCString docs; /*!< Argument's documentation (may be empty) */␊ |
105 | };␊ |
106 | ␊ |
107 | /*! \brief This class represents an function or template argument list. ␊ |
108 | *␊ |
109 | * This class also stores some information about member that is typically␊ |
110 | * put after the argument list, such as wether the member is const, ␊ |
111 | * volatile or pure virtual.␊ |
112 | */␊ |
113 | class ArgumentList : public QList<Argument> ␊ |
114 | {␊ |
115 | public:␊ |
116 | /*! Creates an empty argument list */␊ |
117 | ArgumentList() : QList<Argument>(), ␊ |
118 | constSpecifier(FALSE),␊ |
119 | volatileSpecifier(FALSE),␊ |
120 | pureSpecifier(FALSE)␊ |
121 | { setAutoDelete(TRUE); }␊ |
122 | /*! Destroys the argument list */␊ |
123 | ~ArgumentList() {}␊ |
124 | bool hasDocumentation() const;␊ |
125 | /*! Does the member modify the state of the class? default: FALSE. */␊ |
126 | bool constSpecifier;␊ |
127 | /*! Is the member volatile? default: FALSE. */␊ |
128 | bool volatileSpecifier;␊ |
129 | /*! Is this a pure virtual member? default: FALSE */␊ |
130 | bool pureSpecifier;␊ |
131 | };␊ |
132 | ␊ |
133 | typedef QListIterator<Argument> ArgumentListIterator;␊ |
134 | ␊ |
135 | /*! \brief This struct is used to capture the tag file information ␊ |
136 | * for an Entry. ␊ |
137 | */␊ |
138 | struct TagInfo ␊ |
139 | {␊ |
140 | QCString tagName;␊ |
141 | QCString fileName;␊ |
142 | QCString anchor;␊ |
143 | };␊ |
144 | ␊ |
145 | struct Grouping ␊ |
146 | {␊ |
147 | enum GroupPri_t ␊ |
148 | {␊ |
149 | GROUPING_LOWEST,␊ |
150 | GROUPING_AUTO_WEAK = ␊ |
151 | GROUPING_LOWEST, //!< membership in group was defined via \@weakgroup ␊ |
152 | GROUPING_AUTO_ADD, //!< membership in group was defined via \@add[to]group ␊ |
153 | GROUPING_AUTO_DEF, //!< membership in group was defined via \@defgroup␊ |
154 | GROUPING_AUTO_HIGHEST = GROUPING_AUTO_DEF,␊ |
155 | GROUPING_INGROUP, //!< membership in group was defined by \@ingroup␊ |
156 | GROUPING_HIGHEST = GROUPING_INGROUP␊ |
157 | };␊ |
158 | ␊ |
159 | static const char *getGroupPriName( GroupPri_t priority )␊ |
160 | {␊ |
161 | switch( priority )␊ |
162 | {␊ |
163 | case GROUPING_AUTO_WEAK:␊ |
164 | return "@weakgroup";␊ |
165 | case GROUPING_AUTO_ADD:␊ |
166 | return "@addtogroup";␊ |
167 | case GROUPING_AUTO_DEF:␊ |
168 | return "@defgroup";␊ |
169 | case GROUPING_INGROUP:␊ |
170 | return "@ingroup";␊ |
171 | }␉ ␊ |
172 | return "???";␊ |
173 | }␊ |
174 | ␊ |
175 | Grouping( const char *gn, GroupPri_t p ) : groupname(gn), pri(p) {}␊ |
176 | Grouping( const Grouping &g ) : groupname(g.groupname), pri(g.pri) {}␊ |
177 | QCString groupname; //!< name of the group␊ |
178 | GroupPri_t pri; //!< priority of this definition␊ |
179 | ␊ |
180 | };␊ |
181 | ␊ |
182 | /*! \brief Represents an unstructured piece of information, about an␊ |
183 | * entity found in the sources. ␊ |
184 | *␊ |
185 | * parseMain() in scanner.l will generate a tree of these␊ |
186 | * entries.␊ |
187 | */␊ |
188 | class Entry␊ |
189 | {␊ |
190 | public:␊ |
191 | ␊ |
192 | /*! Kind of entries that are supported */␊ |
193 | enum Sections { ␊ |
194 | CLASS_SEC = 0x00000001, ␊ |
195 | NAMESPACE_SEC = 0x00000010,␊ |
196 | COMPOUND_MASK = CLASS_SEC,␊ |
197 | SCOPE_MASK = COMPOUND_MASK | NAMESPACE_SEC,␊ |
198 | ␊ |
199 | CLASSDOC_SEC = 0x00000800, ␊ |
200 | STRUCTDOC_SEC = 0x00001000,␊ |
201 | UNIONDOC_SEC = 0x00002000,␊ |
202 | EXCEPTIONDOC_SEC = 0x00004000,␊ |
203 | NAMESPACEDOC_SEC = 0x00008000,␊ |
204 | INTERFACEDOC_SEC = 0x00010000,␊ |
205 | PROTOCOLDOC_SEC = 0x00020000,␊ |
206 | CATEGORYDOC_SEC = 0x00040000,␊ |
207 | COMPOUNDDOC_MASK = CLASSDOC_SEC | STRUCTDOC_SEC | UNIONDOC_SEC | ␊ |
208 | INTERFACEDOC_SEC | EXCEPTIONDOC_SEC | PROTOCOLDOC_SEC |␊ |
209 | CATEGORYDOC_SEC,␊ |
210 | ␊ |
211 | SOURCE_SEC = 0x00400000,␊ |
212 | HEADER_SEC = 0x00800000,␊ |
213 | FILE_MASK = SOURCE_SEC | HEADER_SEC,␊ |
214 | ␊ |
215 | ENUMDOC_SEC = 0x01000000,␊ |
216 | ENUM_SEC = 0x02000000,␊ |
217 | EMPTY_SEC = 0x03000000, ␊ |
218 | PAGEDOC_SEC = 0x04000000, ␊ |
219 | VARIABLE_SEC = 0x05000000,␊ |
220 | FUNCTION_SEC = 0x06000000,␊ |
221 | TYPEDEF_SEC = 0x07000000,␊ |
222 | MEMBERDOC_SEC = 0x08000000, ␊ |
223 | OVERLOADDOC_SEC = 0x09000000,␊ |
224 | EXAMPLE_SEC = 0x0a000000, ␊ |
225 | VARIABLEDOC_SEC = 0x0b000000,␊ |
226 | FILEDOC_SEC = 0x0c000000,␊ |
227 | DEFINEDOC_SEC = 0x0d000000,␊ |
228 | INCLUDE_SEC = 0x0e000000,␊ |
229 | DEFINE_SEC = 0x0f000000,␊ |
230 | GROUPDOC_SEC = 0x10000000,␊ |
231 | USINGDIR_SEC = 0x11000000,␊ |
232 | MAINPAGEDOC_SEC = 0x12000000,␊ |
233 | MEMBERGRP_SEC = 0x13000000,␊ |
234 | USINGDECL_SEC = 0x14000000,␊ |
235 | PACKAGE_SEC = 0x15000000,␊ |
236 | PACKAGEDOC_SEC = 0x16000000,␊ |
237 | OBJCIMPL_SEC = 0x17000000,␊ |
238 | DIRDOC_SEC = 0x18000000␊ |
239 | };␊ |
240 | enum MemberSpecifier␊ |
241 | {␊ |
242 | Inline = 0x000001,␊ |
243 | Explicit = 0x000002,␊ |
244 | Mutable = 0x000004,␊ |
245 | Settable = 0x000008,␊ |
246 | Gettable = 0x000010,␊ |
247 | Readable = 0x000020,␊ |
248 | Writable = 0x000040,␊ |
249 | Final = 0x000080,␊ |
250 | Abstract = 0x000100,␊ |
251 | Addable = 0x000200,␊ |
252 | Removable = 0x000400,␊ |
253 | Raisable = 0x000800,␊ |
254 | Override = 0x001000,␊ |
255 | New = 0x002000,␊ |
256 | Sealed = 0x004000,␊ |
257 | Initonly = 0x008000,␊ |
258 | Optional = 0x010000,␊ |
259 | Required = 0x020000,␊ |
260 | NonAtomic = 0x040000,␊ |
261 | Copy = 0x080000,␊ |
262 | Retain = 0x100000,␊ |
263 | Assign = 0x200000␊ |
264 | };␊ |
265 | enum ClassSpecifier␊ |
266 | {␊ |
267 | Template = 0x0001,␊ |
268 | Generic = 0x0002,␊ |
269 | Ref = 0x0004,␊ |
270 | Value = 0x0008,␊ |
271 | Interface = 0x0010,␊ |
272 | Struct = 0x0020,␊ |
273 | Union = 0x0040,␊ |
274 | Exception = 0x0080,␊ |
275 | Protocol = 0x0100,␊ |
276 | Category = 0x0200,␊ |
277 | SealedClass = 0x0400,␊ |
278 | AbstractClass = 0x0800␊ |
279 | };␊ |
280 | enum GroupDocType␊ |
281 | {␊ |
282 | GROUPDOC_NORMAL, //!< defgroup␊ |
283 | GROUPDOC_ADD, //!< addgroup␊ |
284 | GROUPDOC_WEAK //!< weakgroup␊ |
285 | }; //!< kind of group␊ |
286 | ␊ |
287 | Entry();␊ |
288 | Entry(const Entry &);␊ |
289 | ~Entry();␊ |
290 | int getSize();␊ |
291 | void addSpecialListItem(const char *listName,int index);␊ |
292 | void createNavigationIndex(EntryNav *rootNav,FileStorage *storage,FileDef *fd);␊ |
293 | ␊ |
294 | // while parsing a file these function can be used to navigate/build the tree␊ |
295 | void setParent(Entry *parent) { m_parent = parent; }␊ |
296 | Entry *parent() const { return m_parent; }␊ |
297 | const QList<Entry> *children() const { return m_sublist; }␊ |
298 | ␊ |
299 | /*! Adds entry \e as a child to this entry */␊ |
300 | void␉addSubEntry (Entry* e) ;␊ |
301 | /*! Restore the state of this Entry to the default value it has␊ |
302 | * at construction time. ␊ |
303 | */␊ |
304 | void reset();␊ |
305 | void marshall(StorageIntf *);␊ |
306 | void unmarshall(StorageIntf *);␊ |
307 | ␊ |
308 | public:␊ |
309 | ␊ |
310 | // identification␊ |
311 | int section; //!< entry type (see Sections);␊ |
312 | QCString␉ type; //!< member type ␊ |
313 | QCString␉ name; //!< member name␊ |
314 | TagInfo *tagInfo; //!< tag file info␊ |
315 | ␊ |
316 | // content␊ |
317 | Protection protection; //!< class protection␊ |
318 | MethodTypes mtype; //!< signal, slot, (dcop) method, or property?␊ |
319 | int spec; //!< class/member specifiers␊ |
320 | int initLines; //!< define/variable initializer lines to show ␊ |
321 | bool stat; //!< static ?␊ |
322 | bool explicitExternal; //!< explicitly defined as external?␊ |
323 | bool proto; //!< prototype ?␊ |
324 | bool subGrouping; //!< automatically group class members?␊ |
325 | bool callGraph; //!< do we need to draw the call graph?␊ |
326 | bool callerGraph; //!< do we need to draw the caller graph?␊ |
327 | Specifier virt; //!< virtualness of the entry ␊ |
328 | QCString args; //!< member argument string␊ |
329 | QCString bitfields; //!< member's bit fields␊ |
330 | ArgumentList *argList; //!< member arguments as a list␊ |
331 | QList<ArgumentList> *tArgLists; //!< template argument declarations␊ |
332 | QGString␉ program; //!< the program text␊ |
333 | QGString initializer; //!< initial value (for variables)␊ |
334 | QCString includeFile; //!< include file (2 arg of \\class, must be unique)␊ |
335 | QCString includeName; //!< include name (3 arg of \\class)␊ |
336 | QCString doc; //!< documentation block (partly parsed)␊ |
337 | int docLine; //!< line number at which the documentation was found␊ |
338 | QCString docFile; //!< file in which the documentation was found␊ |
339 | QCString brief; //!< brief description (doc block)␊ |
340 | int briefLine; //!< line number at which the brief desc. was found␊ |
341 | QCString briefFile; //!< file in which the brief desc. was found␊ |
342 | QCString inbodyDocs; //!< documentation inside the body of a function␊ |
343 | int inbodyLine; //!< line number at which the body doc was found␊ |
344 | QCString inbodyFile; //!< file in which the body doc was found␊ |
345 | QCString relates; //!< related class (doc block)␊ |
346 | RelatesType relatesType; //!< how relates is handled␊ |
347 | QCString read; //!< property read accessor␊ |
348 | QCString write; //!< property write accessor␊ |
349 | QCString inside; //!< name of the class in which documents are found␊ |
350 | QCString exception; //!< throw specification␊ |
351 | ArgumentList *typeConstr; //!< where clause (C#) for type constraints␊ |
352 | int bodyLine; //!< line number of the definition in the source␊ |
353 | int endBodyLine; //!< line number where the definition ends␊ |
354 | int mGrpId; //!< member group id␊ |
355 | QList<BaseInfo> *extends; //!< list of base classes ␊ |
356 | QList<Grouping> *groups; //!< list of groups this entry belongs to␊ |
357 | QList<SectionInfo> *anchors; //!< list of anchors defined in this entry␊ |
358 | QCString␉fileName; //!< file this entry was extracted from␊ |
359 | int␉␉startLine; //!< start line of entry in the source␊ |
360 | QList<ListItemInfo> *sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in␊ |
361 | SrcLangExt lang; //!< programming language in which this entry was found␊ |
362 | bool hidden; //!< does this represent an entity that is hidden from the output␊ |
363 | bool artificial; //!< Artificially introduced item␊ |
364 | GroupDocType groupDocType;␊ |
365 | ␊ |
366 | static int num; //!< counts the total number of entries␊ |
367 | ␊ |
368 | /// return the command name used to define GROUPDOC_SEC␊ |
369 | const char *groupDocCmd() const␊ |
370 | {␊ |
371 | switch( groupDocType ) ␊ |
372 | {␊ |
373 | case GROUPDOC_NORMAL: return "\\defgroup";␊ |
374 | case GROUPDOC_ADD: return "\\addgroup";␊ |
375 | case GROUPDOC_WEAK: return "\\weakgroup";␊ |
376 | default: return "unknown group command";␊ |
377 | }␊ |
378 | }␊ |
379 | Grouping::GroupPri_t groupingPri() const␊ |
380 | {␊ |
381 | if( section != GROUPDOC_SEC ) ␊ |
382 | {␊ |
383 | return Grouping::GROUPING_LOWEST;␊ |
384 | }␊ |
385 | switch( groupDocType ) ␊ |
386 | {␊ |
387 | case GROUPDOC_NORMAL: return Grouping::GROUPING_AUTO_DEF;␊ |
388 | case GROUPDOC_ADD: return Grouping::GROUPING_AUTO_ADD;␊ |
389 | case GROUPDOC_WEAK: return Grouping::GROUPING_AUTO_WEAK;␊ |
390 | default: return Grouping::GROUPING_LOWEST;␊ |
391 | }␊ |
392 | }␊ |
393 | ␊ |
394 | private: ␊ |
395 | void createSubtreeIndex(EntryNav *nav,FileStorage *storage,FileDef *fd);␊ |
396 | Entry *m_parent; //!< parent node in the tree␊ |
397 | QList<Entry> *m_sublist; //!< entries that are children of this one␊ |
398 | Entry &operator=(const Entry &); ␊ |
399 | };␊ |
400 | ␊ |
401 | class EntryNav␊ |
402 | {␊ |
403 | public:␊ |
404 | EntryNav(EntryNav *parent,Entry *e);␊ |
405 | ~EntryNav();␊ |
406 | void addChild(EntryNav *);␊ |
407 | bool loadEntry(FileStorage *storage);␊ |
408 | bool saveEntry(Entry *e,FileStorage *storage);␊ |
409 | void setEntry(Entry *e);␊ |
410 | void releaseEntry();␊ |
411 | void changeSection(int section) { m_section = section; }␊ |
412 | void setFileDef(FileDef *fd) { m_fileDef = fd; }␊ |
413 | ␊ |
414 | Entry *entry() const { return m_info; }␊ |
415 | int section() const { return m_section; }␊ |
416 | SrcLangExt lang() const { return m_lang; }␊ |
417 | const QCString &type() const { return m_type; }␊ |
418 | const QCString &name() const { return m_name; }␊ |
419 | TagInfo *tagInfo() const { return m_tagInfo; }␊ |
420 | const QList<EntryNav> *children() const { return m_subList; }␊ |
421 | EntryNav *parent() const { return m_parent; }␊ |
422 | FileDef *fileDef() const { return m_fileDef; }␊ |
423 | ␊ |
424 | private:␊ |
425 | ␊ |
426 | // navigation ␊ |
427 | EntryNav *m_parent; //!< parent node in the tree␊ |
428 | QList<EntryNav> *m_subList; //!< entries that are children of this one␊ |
429 | ␊ |
430 | // identification␊ |
431 | int m_section; //!< entry type (see Sections);␊ |
432 | QCString␉ m_type; //!< member type ␊ |
433 | QCString␉ m_name; //!< member name␊ |
434 | TagInfo *m_tagInfo; //!< tag file info␊ |
435 | FileDef *m_fileDef;␊ |
436 | SrcLangExt m_lang; //!< programming language in which this entry was found␊ |
437 | ␊ |
438 | Entry *m_info;␊ |
439 | int64 m_offset;␊ |
440 | bool m_noLoad;␊ |
441 | };␊ |
442 | ␊ |
443 | ␊ |
444 | typedef QList<Entry> EntryList;␊ |
445 | typedef QListIterator<Entry> EntryListIterator;␊ |
446 | ␊ |
447 | typedef QList<EntryNav> EntryNavList;␊ |
448 | typedef QListIterator<EntryNav> EntryNavListIterator;␊ |
449 | ␊ |
450 | #endif␊ |
451 |