1 /******************************************************************************
3 * $Id: entry.h,v 1.36 2001/03/19 19:27:40 root Exp $
5 * Copyright (C) 1997-2012 by Dimitri van Heesch.
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.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
36 /** This class stores information about an inheritance relation
40 /*! Creates an object representing an inheritance relation */
41 BaseInfo(const char *n,Protection p,Specifier v) :
42 name(n),prot(p),virt(v) {}
43 QCString name; //!< the name of the base class
44 Protection prot; //!< inheritance type
45 Specifier virt; //!< virtualness
48 /** This struct is used to capture the tag file information
58 /** Represents an unstructured piece of information, about an
59 * entity found in the sources.
61 * parseMain() in scanner.l will generate a tree of these
68 /*! Kind of entries that are supported */
70 CLASS_SEC = 0x00000001,
71 NAMESPACE_SEC = 0x00000010,
72 COMPOUND_MASK = CLASS_SEC,
73 SCOPE_MASK = COMPOUND_MASK | NAMESPACE_SEC,
75 CLASSDOC_SEC = 0x00000800,
76 STRUCTDOC_SEC = 0x00001000,
77 UNIONDOC_SEC = 0x00002000,
78 EXCEPTIONDOC_SEC = 0x00004000,
79 NAMESPACEDOC_SEC = 0x00008000,
80 INTERFACEDOC_SEC = 0x00010000,
81 PROTOCOLDOC_SEC = 0x00020000,
82 CATEGORYDOC_SEC = 0x00040000,
83 COMPOUNDDOC_MASK = CLASSDOC_SEC | STRUCTDOC_SEC | UNIONDOC_SEC |
84 INTERFACEDOC_SEC | EXCEPTIONDOC_SEC | PROTOCOLDOC_SEC |
87 SOURCE_SEC = 0x00400000,
88 HEADER_SEC = 0x00800000,
89 FILE_MASK = SOURCE_SEC | HEADER_SEC,
91 ENUMDOC_SEC = 0x01000000,
92 ENUM_SEC = 0x02000000,
93 EMPTY_SEC = 0x03000000,
94 PAGEDOC_SEC = 0x04000000,
95 VARIABLE_SEC = 0x05000000,
96 FUNCTION_SEC = 0x06000000,
97 TYPEDEF_SEC = 0x07000000,
98 MEMBERDOC_SEC = 0x08000000,
99 OVERLOADDOC_SEC = 0x09000000,
100 EXAMPLE_SEC = 0x0a000000,
101 VARIABLEDOC_SEC = 0x0b000000,
102 FILEDOC_SEC = 0x0c000000,
103 DEFINEDOC_SEC = 0x0d000000,
104 INCLUDE_SEC = 0x0e000000,
105 DEFINE_SEC = 0x0f000000,
106 GROUPDOC_SEC = 0x10000000,
107 USINGDIR_SEC = 0x11000000,
108 MAINPAGEDOC_SEC = 0x12000000,
109 MEMBERGRP_SEC = 0x13000000,
110 USINGDECL_SEC = 0x14000000,
111 PACKAGE_SEC = 0x15000000,
112 PACKAGEDOC_SEC = 0x16000000,
113 OBJCIMPL_SEC = 0x17000000,
114 DIRDOC_SEC = 0x18000000
119 Explicit = 0x00000002,
120 Mutable = 0x00000004,
121 Settable = 0x00000008,
122 Gettable = 0x00000010,
123 Readable = 0x00000020,
124 Writable = 0x00000040,
126 Abstract = 0x00000100,
127 Addable = 0x00000200,
128 Removable = 0x00000400,
129 Raisable = 0x00000800,
130 Override = 0x00001000,
133 Initonly = 0x00008000,
134 Optional = 0x00010000,
135 Required = 0x00020000,
136 NonAtomic = 0x00040000,
142 Unretained = 0x01000000,
144 ConstExp = 0x04000000,
145 Default = 0x08000000,
147 NoExcept = 0x20000000
161 SealedClass = 0x0400,
162 AbstractClass = 0x0800,
163 Enum = 0x1000 // for Java-style enums
167 GROUPDOC_NORMAL, //!< defgroup
168 GROUPDOC_ADD, //!< addgroup
169 GROUPDOC_WEAK //!< weakgroup
170 }; //!< kind of group
173 Entry(const Entry &);
176 /*! Returns the static size of the Entry (so excluding any dynamic memory) */
179 void addSpecialListItem(const char *listName,int index);
180 void createNavigationIndex(EntryNav *rootNav,FileStorage *storage,FileDef *fd);
182 // while parsing a file these function can be used to navigate/build the tree
183 void setParent(Entry *parent) { m_parent = parent; }
185 /*! Returns the parent for this Entry or 0 if this entry has no parent. */
186 Entry *parent() const { return m_parent; }
188 /*! Returns the list of children for this Entry
189 * @see addSubEntry() and removeSubEntry()
191 const QList<Entry> *children() const { return m_sublist; }
193 /*! Adds entry \a e as a child to this entry */
194 void addSubEntry (Entry* e) ;
196 /*! Removes entry \a e from the list of children.
197 * Returns a pointer to the entry or 0 if the entry was not a child.
198 * Note the entry will not be deleted.
200 Entry *removeSubEntry(Entry *e);
202 /*! Restore the state of this Entry to the default value it has
203 * at construction time.
207 /*! Serialize this entry to a persistent storage stream. */
208 void marshall(StorageIntf *);
210 /*! Reinitialize this entry from a persistent storage stream. */
211 void unmarshall(StorageIntf *);
216 int section; //!< entry type (see Sections);
217 QCString type; //!< member type
218 QCString name; //!< member name
219 TagInfo *tagInfo; //!< tag file info
222 Protection protection; //!< class protection
223 MethodTypes mtype; //!< signal, slot, (dcop) method, or property?
224 int spec; //!< class/member specifiers
225 int initLines; //!< define/variable initializer lines to show
226 bool stat; //!< static ?
227 bool explicitExternal; //!< explicitly defined as external?
228 bool proto; //!< prototype ?
229 bool subGrouping; //!< automatically group class members?
230 bool callGraph; //!< do we need to draw the call graph?
231 bool callerGraph; //!< do we need to draw the caller graph?
232 Specifier virt; //!< virtualness of the entry
233 QCString args; //!< member argument string
234 QCString bitfields; //!< member's bit fields
235 ArgumentList *argList; //!< member arguments as a list
236 QList<ArgumentList> *tArgLists; //!< template argument declarations
237 QGString program; //!< the program text
238 QGString initializer; //!< initial value (for variables)
239 QCString includeFile; //!< include file (2 arg of \\class, must be unique)
240 QCString includeName; //!< include name (3 arg of \\class)
241 QCString doc; //!< documentation block (partly parsed)
242 int docLine; //!< line number at which the documentation was found
243 QCString docFile; //!< file in which the documentation was found
244 QCString brief; //!< brief description (doc block)
245 int briefLine; //!< line number at which the brief desc. was found
246 QCString briefFile; //!< file in which the brief desc. was found
247 QCString inbodyDocs; //!< documentation inside the body of a function
248 int inbodyLine; //!< line number at which the body doc was found
249 QCString inbodyFile; //!< file in which the body doc was found
250 QCString relates; //!< related class (doc block)
251 RelatesType relatesType; //!< how relates is handled
252 QCString read; //!< property read accessor
253 QCString write; //!< property write accessor
254 QCString inside; //!< name of the class in which documents are found
255 QCString exception; //!< throw specification
256 ArgumentList *typeConstr; //!< where clause (C#) for type constraints
257 int bodyLine; //!< line number of the definition in the source
258 int endBodyLine; //!< line number where the definition ends
259 int mGrpId; //!< member group id
260 QList<BaseInfo> *extends; //!< list of base classes
261 QList<Grouping> *groups; //!< list of groups this entry belongs to
262 QList<SectionInfo> *anchors; //!< list of anchors defined in this entry
263 QCString fileName; //!< file this entry was extracted from
264 int startLine; //!< start line of entry in the source
265 QList<ListItemInfo> *sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in
266 SrcLangExt lang; //!< programming language in which this entry was found
267 bool hidden; //!< does this represent an entity that is hidden from the output
268 bool artificial; //!< Artificially introduced item
269 GroupDocType groupDocType;
272 static int num; //!< counts the total number of entries
274 /// return the command name used to define GROUPDOC_SEC
275 const char *groupDocCmd() const
277 switch( groupDocType )
279 case GROUPDOC_NORMAL: return "\\defgroup";
280 case GROUPDOC_ADD: return "\\addgroup";
281 case GROUPDOC_WEAK: return "\\weakgroup";
282 default: return "unknown group command";
285 Grouping::GroupPri_t groupingPri() const
287 if( section != GROUPDOC_SEC )
289 return Grouping::GROUPING_LOWEST;
291 switch( groupDocType )
293 case GROUPDOC_NORMAL: return Grouping::GROUPING_AUTO_DEF;
294 case GROUPDOC_ADD: return Grouping::GROUPING_AUTO_ADD;
295 case GROUPDOC_WEAK: return Grouping::GROUPING_AUTO_WEAK;
296 default: return Grouping::GROUPING_LOWEST;
301 void createSubtreeIndex(EntryNav *nav,FileStorage *storage,FileDef *fd);
302 Entry *m_parent; //!< parent node in the tree
303 QList<Entry> *m_sublist; //!< entries that are children of this one
304 Entry &operator=(const Entry &);
307 /** Wrapper for a node in the Entry tree.
309 * Allows navigating through the Entry tree and load and storing Entry
310 * objects persistently to disk.
315 EntryNav(EntryNav *parent,Entry *e);
317 void addChild(EntryNav *);
318 bool loadEntry(FileStorage *storage);
319 bool saveEntry(Entry *e,FileStorage *storage);
320 void setEntry(Entry *e);
322 void changeSection(int section) { m_section = section; }
323 void setFileDef(FileDef *fd) { m_fileDef = fd; }
325 Entry *entry() const { return m_info; }
326 int section() const { return m_section; }
327 SrcLangExt lang() const { return m_lang; }
328 const QCString &type() const { return m_type; }
329 const QCString &name() const { return m_name; }
330 TagInfo *tagInfo() const { return m_tagInfo; }
331 const QList<EntryNav> *children() const { return m_subList; }
332 EntryNav *parent() const { return m_parent; }
333 FileDef *fileDef() const { return m_fileDef; }
338 EntryNav *m_parent; //!< parent node in the tree
339 QList<EntryNav> *m_subList; //!< entries that are children of this one
342 int m_section; //!< entry type (see Sections);
343 QCString m_type; //!< member type
344 QCString m_name; //!< member name
345 TagInfo *m_tagInfo; //!< tag file info
347 SrcLangExt m_lang; //!< programming language in which this entry was found
355 typedef QList<Entry> EntryList;
356 typedef QListIterator<Entry> EntryListIterator;
358 typedef QList<EntryNav> EntryNavList;
359 typedef QListIterator<EntryNav> EntryNavListIterator;