summaryrefslogtreecommitdiffstats
path: root/src/entry.h
blob: 9141bbdb63b0647d2b7153515619d0e89f70b516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/******************************************************************************
 *
 * $Id$
 *
 * Copyright (C) 1997-2000 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * All output generated with Doxygen is not covered by this license.
 *
 */

#ifndef ENTRY_H
#define ENTRY_H

#include "qtbc.h"
#include <qlist.h>

enum Protection { Public, Protected, Private } ;
enum Specifier { Normal, Virtual, Pure } ;

struct BaseInfo 
{
  BaseInfo(const char *n,Protection p,Specifier v) : name(n),prot(p),virt(v) {}
  QCString   name; // the name of the base class
  Protection prot; // inheritance type
  Specifier  virt; // virtualness
};

struct Argument
{
  Argument() {}
  Argument(const Argument &a) 
  { 
    attrib=a.attrib.copy();
    type=a.type.copy(); 
    name=a.name.copy(); 
    defval=a.defval.copy(); 
    docs=a.docs.copy();
    array=a.array.copy();
  }
  Argument &operator=(const Argument &a)
  {
    if (this!=&a)
    {
      attrib=a.attrib.copy();
      type=a.type.copy(); 
      name=a.name.copy(); 
      defval=a.defval.copy(); 
      docs=a.docs.copy();
      array=a.array.copy();
    }
    return *this;
  }
  bool hasDocumentation() const 
  { 
    return !name.isEmpty() && !docs.isEmpty(); 
  }
  
  QCString attrib;   // argument attribute (IDL only)
  QCString type;     // argument type
  QCString name;     // argument name (if any)
  QCString array;    // argument array specifier (if any)
  QCString defval;   // argument default value (if any)
  QCString docs;     // arguments documentation (if any)
};

class ArgumentList : public QList<Argument> 
{
  public:
   ~ArgumentList() {}
    ArgumentList() : QList<Argument>(), 
                     constSpecifier(FALSE),
                     volatileSpecifier(FALSE),
                     pureSpecifier(FALSE) {}
    bool hasDocumentation() const;
    bool constSpecifier;
    bool volatileSpecifier;
    bool pureSpecifier;
};

typedef QListIterator<Argument> ArgumentListIterator;

/*! Raw entry. parseMain() in scanner.l will generate a tree of these
 *  entries.
 */
class Entry
{
  public:

    enum Sections { 
      CLASS_SEC        = 0x00000001, 
      STRUCT_SEC       = 0x00000002,
      UNION_SEC        = 0x00000004, 
      ENUM_SEC         = 0x00000008,
      EMPTY_SEC        = 0x00000010, 
      PAGEDOC_SEC      = 0x00000020, 
      VARIABLE_SEC     = 0x00000040,
      FUNCTION_SEC     = 0x00000080,
      TYPEDEF_SEC      = 0x00000100,
      CLASSDOC_SEC     = 0x00000200, 
      MEMBERDOC_SEC    = 0x00000400, 
      OVERLOADDOC_SEC  = 0x00000800,
      EXAMPLE_SEC      = 0x00001000, 
      VARIABLEDOC_SEC  = 0x00002000,
      ENUMDOC_SEC      = 0x00004000,
      UNIONDOC_SEC     = 0x00008000,
      STRUCTDOC_SEC    = 0x00010000,
      SOURCE_SEC       = 0x00020000,
      HEADER_SEC       = 0x00040000,
      FILEDOC_SEC      = 0x00080000,
      DEFINEDOC_SEC    = 0x00100000,
      INCLUDE_SEC      = 0x00200000,
      DEFINE_SEC       = 0x00400000,
      GROUPDOC_SEC     = 0x00800000,
      NAMESPACE_SEC    = 0x01000000,
      NAMESPACEDOC_SEC = 0x02000000,
      INTERFACE_SEC    = 0x04000000,
      INTERFACEDOC_SEC = 0x08000000,
      MAINPAGEDOC_SEC  = 0x10000000,
      USINGDIR_SEC     = 0x20000000,
      COMPOUND_MASK    = CLASS_SEC | STRUCT_SEC | UNION_SEC | INTERFACE_SEC,
      COMPOUNDDOC_MASK = CLASSDOC_SEC | STRUCTDOC_SEC | UNIONDOC_SEC | INTERFACEDOC_SEC,
      SCOPE_MASK       = COMPOUND_MASK | NAMESPACE_SEC,
      FILE_MASK        = SOURCE_SEC | HEADER_SEC
    };

    Entry();
    Entry(const Entry &);
    ~Entry();
    int getSize();

    void	addSubEntry (Entry* e) ;
    void        reset();

    int        section;       // entry type (see Sections);
    Protection protection;    // class protection
    bool sig;                 // a Qt signal ?
    bool slot;                // a Qt slot ?
    bool stat;                // static ?
    bool proto;               // prototype ?
    bool inLine;              // inline ?
    Specifier    virt;        // virtualness of the entry 
    Entry       *parent;      // parent node in the tree
    QCString	 type;        // member type 
    QCString	 name;        // member name
    QCString     args;        // member argument string
    ArgumentList *argList;    // member arguments as a list
    ArgumentList *tArgList;   // template argument list
    ArgumentList *mtArgList;  // member template argument list
    QCString     scopeSpec;   // template specialization of the scope
    QCString     memberSpec;  // template specialization of the member
    QCString	 program;     // the program text
    QCString     initializer; // initial value (for variables)
    int          bodyLine;    // line number of the definition in the source
    int          endBodyLine; // line number where the definition ends
    QCString     includeFile; // include file (2 arg of \class, must be unique)
    QCString     includeName; // include name (3 arg of \class)
    QCString     doc;         // documentation block (partly parsed)
    QCString     relates;     // related class (doc block)
    QCString     brief;       // brief description (doc block)
    QCString     inside;      // name of the class in which documents are found
    QCString     exception;   // throw specification
    int          mGrpId;      // member group id
    QList<Entry>    *sublist; // entries that are children of this one
    QList<BaseInfo> *extends; // list of base classes
    QList<QCString> *groups;  // list of groups this entry belongs to
    QList<QCString> *anchors; // list of anchors defined in this entry
    QCString	fileName;     // file this entry was extracted from
    int		startLine;    // start line of entry in the source
    static int  num;          // counts the total number of entries
  private:
    Entry &operator=(const Entry &); 
} ;

typedef QList<Entry> EntryList;
typedef QListIterator<Entry> EntryListIterator;

#endif