Fix for UBSan build
[platform/upstream/doxygen.git] / src / htmldocvisitor.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 _HTMLDOCVISITOR_H
20 #define _HTMLDOCVISITOR_H
21
22 #include "docvisitor.h"
23 #include <qstack.h>
24 #include <qcstring.h>
25
26 class Definition;
27 class MemberDef;
28 class DocNode;
29 class FTextStream;
30 class CodeOutputInterface;
31
32 /*! @brief Concrete visitor implementation for HTML output. */
33 class HtmlDocVisitor : public DocVisitor
34 {
35   public:
36     HtmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,Definition *ctx,MemberDef *md);
37     
38     //--------------------------------------
39     // visitor functions for leaf nodes
40     //--------------------------------------
41     
42     void visit(DocWord *);
43     void visit(DocLinkedWord *);
44     void visit(DocWhiteSpace *);
45     void visit(DocSymbol *);
46     void visit(DocURL *);
47     void visit(DocLineBreak *);
48     void visit(DocHorRuler *);
49     void visit(DocStyleChange *);
50     void visit(DocVerbatim *);
51     void visit(DocAnchor *);
52     void visit(DocInclude *);
53     void visit(DocIncOperator *);
54     void visit(DocFormula *);
55     void visit(DocIndexEntry *);
56     void visit(DocSimpleSectSep *);
57     void visit(DocCite *);
58
59     //--------------------------------------
60     // visitor functions for compound nodes
61     //--------------------------------------
62     
63     void visitPre(DocAutoList *);
64     void visitPost(DocAutoList *);
65     void visitPre(DocAutoListItem *);
66     void visitPost(DocAutoListItem *);
67     void visitPre(DocPara *) ;
68     void visitPost(DocPara *);
69     void visitPre(DocRoot *);
70     void visitPost(DocRoot *);
71     void visitPre(DocSimpleSect *);
72     void visitPost(DocSimpleSect *);
73     void visitPre(DocTitle *);
74     void visitPost(DocTitle *);
75     void visitPre(DocSimpleList *);
76     void visitPost(DocSimpleList *);
77     void visitPre(DocSimpleListItem *);
78     void visitPost(DocSimpleListItem *);
79     void visitPre(DocSection *);
80     void visitPost(DocSection *);
81     void visitPre(DocHtmlList *);
82     void visitPost(DocHtmlList *) ;
83     void visitPre(DocHtmlListItem *);
84     void visitPost(DocHtmlListItem *);
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     void visitPre(DocMscFile *);
110     void visitPost(DocMscFile *);
111     void visitPre(DocLink *);
112     void visitPost(DocLink *);
113     void visitPre(DocRef *);
114     void visitPost(DocRef *);
115     void visitPre(DocSecRefItem *);
116     void visitPost(DocSecRefItem *);
117     void visitPre(DocSecRefList *);
118     void visitPost(DocSecRefList *);
119     void visitPre(DocParamSect *);
120     void visitPost(DocParamSect *);
121     void visitPre(DocParamList *);
122     void visitPost(DocParamList *);
123     void visitPre(DocXRefItem *);
124     void visitPost(DocXRefItem *);
125     void visitPre(DocInternalRef *);
126     void visitPost(DocInternalRef *);
127     void visitPre(DocCopy *);
128     void visitPost(DocCopy *);
129     void visitPre(DocText *);
130     void visitPost(DocText *);
131     void visitPre(DocHtmlBlockQuote *);
132     void visitPost(DocHtmlBlockQuote *);
133
134   private:
135
136     //--------------------------------------
137     // helper functions 
138     //--------------------------------------
139     
140     void writeObfuscatedMailAddress(const QCString &url);
141     void filter(const char *str);
142     void filterQuotedCdataAttr(const char* str);
143     void startLink(const QCString &ref,const QCString &file,
144                    const QCString &relPath,const QCString &anchor,
145                    const QCString &tooltip = "");
146     void endLink();
147     void writeDotFile(const QCString &fileName,const QCString &relPath,const QCString &context);
148     void writeMscFile(const QCString &fileName,const QCString &relPath,const QCString &context);
149
150     void pushEnabled();
151     void popEnabled();
152
153     void forceEndParagraph(DocNode *n);
154     void forceStartParagraph(DocNode *n);
155
156     //--------------------------------------
157     // state variables
158     //--------------------------------------
159
160     FTextStream &m_t;
161     CodeOutputInterface &m_ci;
162     bool m_insidePre;
163     bool m_hide;
164     QStack<bool> m_enabled;
165     Definition *m_ctx;
166     MemberDef *m_md;
167     QCString m_langExt;
168 };
169
170 #endif