Fix for UBSan build
[platform/upstream/doxygen.git] / src / define.h
1 /******************************************************************************
2  *
3  * $Id: define.h,v 1.21 2001/03/19 19:27:40 root Exp $
4  *
5  * Copyright (C) 1997-2012 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 DEFINE_H
19 #define DEFINE_H
20
21 #include "qtbc.h"
22 #include <qdict.h>
23 #include <qlist.h>
24
25 class FileDef;
26
27 /** A class representing a macro definition. */
28 class Define
29 {
30   public:
31     Define();
32     Define(const Define &d);
33    ~Define();
34     bool hasDocumentation();
35     QCString name;
36     QCString definition;
37     QCString fileName;
38     QCString doc;
39     QCString brief;
40     QCString args;
41     QCString anchor;
42     FileDef *fileDef;
43     int lineNr;
44     int nargs;
45     bool undef;
46     bool varArgs;
47     bool isPredefined;
48     bool nonRecursive;
49 };
50
51 /** A list of Define objects. */
52 class DefineList : public QList<Define>
53 {
54   public:
55     DefineList() : QList<Define>() {}
56    ~DefineList() {}
57     int compareItems(GCI i1,GCI i2) 
58     {
59       return stricmp(((Define *)i1)->name,((Define *)i2)->name); 
60     }
61 };
62
63 /** A list of Define objects associated with a specific name. */
64 class DefineName : public QList<Define>
65 {
66   public:
67     DefineName(const char *n) : QList<Define>() { name=n; }
68    ~DefineName() {}
69     const char *nameString() const { return name; }
70     int compareItems(GCI i1,GCI i2) 
71     {
72       return stricmp(((Define *)i1)->name,((Define *)i2)->name); 
73     }
74     
75   private:
76     QCString name;
77 };
78
79 /** A list of DefineName objects. */
80 class DefineNameList : public QList<DefineName>
81 {
82   public:
83     DefineNameList() : QList<DefineName>() {}
84    ~DefineNameList() {}
85     int compareItems(GCI i1,GCI i2)
86     {
87       return stricmp(((DefineName *)i1)->nameString(),
88                     ((DefineName *)i2)->nameString());
89     }
90 };
91
92 /** An unsorted dictionary of Define objects. */
93 typedef QDict<Define> DefineDict;
94
95 /** A sorted dictionary of DefineName object. */
96 typedef QDict<DefineName> DefineNameDict;
97
98 #endif