Fix for UBSan build
[platform/upstream/doxygen.git] / src / xmldocvisitor.h
1 /******************************************************************************
2  *
3  * $Id: $
4  *
5  *
6  * Copyright (C) 1997-2012 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby 
10  * granted. No representations are made about the suitability of this software 
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18
19 #ifndef _XMLDOCVISITOR_H
20 #define _XMLDOCVISITOR_H
21
22 #include "docvisitor.h"
23 #include <qstack.h>
24 #include <qcstring.h>
25
26 class FTextStream;
27 class CodeOutputInterface;
28 class QCString;
29
30 /*! @brief Concrete visitor implementation for XML output. */
31 class XmlDocVisitor : public DocVisitor
32 {
33   public:
34     XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci);
35     
36     //--------------------------------------
37     // visitor functions for leaf nodes
38     //--------------------------------------
39     
40     void visit(DocWord *);
41     void visit(DocLinkedWord *);
42     void visit(DocWhiteSpace *);
43     void visit(DocSymbol *);
44     void visit(DocURL *);
45     void visit(DocLineBreak *);
46     void visit(DocHorRuler *);
47     void visit(DocStyleChange *);
48     void visit(DocVerbatim *);
49     void visit(DocAnchor *);
50     void visit(DocInclude *);
51     void visit(DocIncOperator *);
52     void visit(DocFormula *);
53     void visit(DocIndexEntry *);
54     void visit(DocSimpleSectSep *);
55     void visit(DocCite *);
56
57     //--------------------------------------
58     // visitor functions for compound nodes
59     //--------------------------------------
60     
61     void visitPre(DocAutoList *);
62     void visitPost(DocAutoList *);
63     void visitPre(DocAutoListItem *);
64     void visitPost(DocAutoListItem *);
65     void visitPre(DocPara *) ;
66     void visitPost(DocPara *);
67     void visitPre(DocRoot *);
68     void visitPost(DocRoot *);
69     void visitPre(DocSimpleSect *);
70     void visitPost(DocSimpleSect *);
71     void visitPre(DocTitle *);
72     void visitPost(DocTitle *);
73     void visitPre(DocSimpleList *);
74     void visitPost(DocSimpleList *);
75     void visitPre(DocSimpleListItem *);
76     void visitPost(DocSimpleListItem *);
77     void visitPre(DocSection *);
78     void visitPost(DocSection *);
79     void visitPre(DocHtmlList *);
80     void visitPost(DocHtmlList *) ;
81     void visitPre(DocHtmlListItem *);
82     void visitPost(DocHtmlListItem *);
83     //void visitPre(DocHtmlPre *);
84     //void visitPost(DocHtmlPre *);
85     void visitPre(DocHtmlDescList *);
86     void visitPost(DocHtmlDescList *);
87     void visitPre(DocHtmlDescTitle *);
88     void visitPost(DocHtmlDescTitle *);
89     void visitPre(DocHtmlDescData *);
90     void visitPost(DocHtmlDescData *);
91     void visitPre(DocHtmlTable *);
92     void visitPost(DocHtmlTable *);
93     void visitPre(DocHtmlRow *);
94     void visitPost(DocHtmlRow *) ;
95     void visitPre(DocHtmlCell *);
96     void visitPost(DocHtmlCell *);
97     void visitPre(DocHtmlCaption *);
98     void visitPost(DocHtmlCaption *);
99     void visitPre(DocInternal *);
100     void visitPost(DocInternal *);
101     void visitPre(DocHRef *);
102     void visitPost(DocHRef *);
103     void visitPre(DocHtmlHeader *);
104     void visitPost(DocHtmlHeader *);
105     void visitPre(DocImage *);
106     void visitPost(DocImage *);
107     void visitPre(DocDotFile *);
108     void visitPost(DocDotFile *);
109
110     void visitPre(DocMscFile *);
111     void visitPost(DocMscFile *);
112     void visitPre(DocLink *);
113     void visitPost(DocLink *);
114     void visitPre(DocRef *);
115     void visitPost(DocRef *);
116     void visitPre(DocSecRefItem *);
117     void visitPost(DocSecRefItem *);
118     void visitPre(DocSecRefList *);
119     void visitPost(DocSecRefList *);
120     //void visitPre(DocLanguage *);
121     //void visitPost(DocLanguage *);
122     void visitPre(DocParamSect *);
123     void visitPost(DocParamSect *);
124     void visitPre(DocParamList *);
125     void visitPost(DocParamList *);
126     void visitPre(DocXRefItem *);
127     void visitPost(DocXRefItem *);
128     void visitPre(DocInternalRef *);
129     void visitPost(DocInternalRef *);
130     void visitPre(DocCopy *);
131     void visitPost(DocCopy *);
132     void visitPre(DocText *);
133     void visitPost(DocText *);
134     void visitPre(DocHtmlBlockQuote *);
135     void visitPost(DocHtmlBlockQuote *);
136
137   private:
138
139     //--------------------------------------
140     // helper functions 
141     //--------------------------------------
142     
143     void filter(const char *str);
144     void startLink(const QCString &ref,const QCString &file,
145                    const QCString &anchor);
146     void endLink();
147
148     void pushEnabled();
149     void popEnabled();
150
151     //--------------------------------------
152     // state variables
153     //--------------------------------------
154
155     FTextStream &m_t;
156     CodeOutputInterface &m_ci;
157     bool m_insidePre;
158     bool m_hide;
159     QStack<bool> m_enabled;
160     QCString m_langExt;
161 };
162
163 #endif