Fix for UBSan build
[platform/upstream/doxygen.git] / src / pagedef.h
1 /******************************************************************************
2  *
3  * $Id:$
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 PAGEDEF_H
19 #define PAGEDEF_H
20
21 #include "definition.h"
22 #include "sortdict.h"
23
24 class PageSDict;
25 class OutputList;
26
27 /** @brief A model of a page symbol. */
28 class PageDef : public Definition
29 {
30   public:
31     PageDef(const char *f,int l,const char *n,const char *d,const char *t);
32    ~PageDef();
33
34     // setters
35     void setFileName(const char *name) { m_fileName = name; }
36     void setShowToc(bool b);
37
38     // getters
39     DefType definitionType() const { return TypePage; }
40     bool isLinkableInProject() const 
41     { 
42       return /*hasDocumentation() &&*/ !isReference();
43     }
44     bool isLinkable() const 
45     {
46       return isLinkableInProject() || isReference();
47     } 
48
49     // functions to get a uniform interface with Definitions
50     QCString getOutputFileBase() const;
51     QCString anchor() const { return QCString(); }
52     void findSectionsInDocumentation();
53     QCString title() const { return m_title; }
54     GroupDef *  getGroupDef() const;
55     PageSDict * getSubPages() const { return m_subPageDict; }
56     void addInnerCompound(Definition *d);
57     bool visibleInIndex() const;
58     bool documentedPage() const;
59     bool hasSubPages() const;
60     bool hasParentPage() const;
61     bool showToc() const { return m_showToc; }
62     void setPageScope(Definition *d){ m_pageScope = d; }
63     Definition *getPageScope() const { return m_pageScope; }
64     QCString displayName(bool=TRUE) const { return !m_title.isEmpty() ? m_title : Definition::name(); }
65
66     void writeDocumentation(OutputList &ol);
67
68   private:
69     void setNestingLevel(int l);
70     void writePageDocumentation(OutputList &ol);
71     QCString m_fileName;
72     QCString m_title;
73     GroupDef *m_inGroup;
74     PageSDict *m_subPageDict;                 // list of pages in the group
75     Definition *m_pageScope;
76     int m_nestingLevel;
77     bool m_showToc;
78 };
79
80 class PageSDict : public SDict<PageDef>
81 {
82   public:
83     PageSDict(int size) : SDict<PageDef>(size) {}
84     virtual ~PageSDict() {}
85     int compareItems(GCI i1,GCI i2)
86     {
87       return stricmp(((PageDef *)i1)->name(),((PageDef *)i2)->name());
88     }
89 };
90
91 #endif
92