Imported Upstream version 1.8.15
[platform/upstream/doxygen.git] / src / docbookvisitor.h
1 /******************************************************************************
2 *
3
4 *
5 * Copyright (C) 1997-2015 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 _DOCBOOKDOCVISITOR_H
19 #define _DOCBOOKDOCVISITOR_H
20
21 #include "docvisitor.h"
22 #include <qstack.h>
23 #include <qlist.h>
24 #include <qcstring.h>
25 #include <docparser.h>
26
27 class FTextStream;
28 class CodeOutputInterface;
29 class QCString;
30
31 /*! @brief Concrete visitor implementation for Docbook output. */
32 class DocbookDocVisitor : public DocVisitor
33 {
34     public:
35     DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci);
36     ~DocbookDocVisitor();
37     //--------------------------------------
38     // visitor functions for leaf nodes
39     //--------------------------------------
40     void visit(DocWord *);
41     void visit(DocLinkedWord *);
42     void visit(DocWhiteSpace *);
43     void visit(DocSymbol *);
44     void visit(DocEmoji *);
45     void visit(DocURL *);
46     void visit(DocLineBreak *);
47     void visit(DocHorRuler *);
48     void visit(DocStyleChange *);
49     void visit(DocVerbatim *);
50     void visit(DocAnchor *);
51     void visit(DocInclude *);
52     void visit(DocIncOperator *);
53     void visit(DocFormula *);
54     void visit(DocIndexEntry *);
55     void visit(DocSimpleSectSep *);
56     void visit(DocCite *);
57     //--------------------------------------
58     // visitor functions for compound nodes
59     //--------------------------------------
60     void visitPre(DocAutoList *);
61     void visitPost(DocAutoList *);
62     void visitPre(DocAutoListItem *);
63     void visitPost(DocAutoListItem *);
64     void visitPre(DocPara *) ;
65     void visitPost(DocPara *);
66     void visitPre(DocRoot *);
67     void visitPost(DocRoot *);
68     void visitPre(DocSimpleSect *);
69     void visitPost(DocSimpleSect *);
70     void visitPre(DocTitle *);
71     void visitPost(DocTitle *);
72     void visitPre(DocSimpleList *);
73     void visitPost(DocSimpleList *);
74     void visitPre(DocSimpleListItem *);
75     void visitPost(DocSimpleListItem *);
76     void visitPre(DocSection *);
77     void visitPost(DocSection *);
78     void visitPre(DocHtmlList *);
79     void visitPost(DocHtmlList *) ;
80     void visitPre(DocHtmlListItem *);
81     void visitPost(DocHtmlListItem *);
82     //void visitPre(DocHtmlPre *);
83     //void visitPost(DocHtmlPre *);
84     void visitPre(DocHtmlDescList *);
85     void visitPost(DocHtmlDescList *);
86     void visitPre(DocHtmlDescTitle *);
87     void visitPost(DocHtmlDescTitle *);
88     void visitPre(DocHtmlDescData *);
89     void visitPost(DocHtmlDescData *);
90     void visitPre(DocHtmlTable *);
91     void visitPost(DocHtmlTable *);
92     void visitPre(DocHtmlRow *);
93     void visitPost(DocHtmlRow *) ;
94     void visitPre(DocHtmlCell *);
95     void visitPost(DocHtmlCell *);
96     void visitPre(DocHtmlCaption *);
97     void visitPost(DocHtmlCaption *);
98     void visitPre(DocInternal *);
99     void visitPost(DocInternal *);
100     void visitPre(DocHRef *);
101     void visitPost(DocHRef *);
102     void visitPre(DocHtmlHeader *);
103     void visitPost(DocHtmlHeader *);
104     void visitPre(DocImage *);
105     void visitPost(DocImage *);
106     void visitPre(DocDotFile *);
107     void visitPost(DocDotFile *);
108     void visitPre(DocMscFile *);
109     void visitPost(DocMscFile *);
110     void visitPre(DocDiaFile *);
111     void visitPost(DocDiaFile *);
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     void visitPre(DocVhdlFlow *);
137     void visitPost(DocVhdlFlow *);
138     void visitPre(DocParBlock *);
139     void visitPost(DocParBlock *);
140
141   private:
142     //--------------------------------------
143     // helper functions
144     //--------------------------------------
145     void filter(const char *str);
146     void startLink(const QCString &file,
147     const QCString &anchor);
148     void endLink();
149     void pushEnabled();
150     void popEnabled();
151     void startMscFile(const QCString &fileName,const QCString &width,
152     const QCString &height, bool hasCaption,const QList<DocNode> &children);
153     void endMscFile(bool hasCaption);
154     void writeMscFile(const QCString &fileName, DocVerbatim *s);
155     void startDiaFile(const QCString &fileName,const QCString &width,
156                       const QCString &height, bool hasCaption,const QList<DocNode> &children);
157     void endDiaFile(bool hasCaption);
158     void writeDiaFile(const QCString &fileName, DocVerbatim *s);
159     void startDotFile(const QCString &fileName,const QCString &width,
160     const QCString &height, bool hasCaption,const QList<DocNode> &children);
161     void endDotFile(bool hasCaption);
162     void writeDotFile(const QCString &fileName, DocVerbatim *s);
163     void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
164     void visitPreStart(FTextStream &t,
165                    const QList<DocNode> &children,
166                    bool hasCaption,
167                    const QCString &name,
168                    const QCString &width,
169                    const QCString &height,
170                    bool inlineImage = FALSE);
171     void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE);
172     void visitCaption(const QList<DocNode> &children);
173     //--------------------------------------
174     // state variables
175     //--------------------------------------
176     FTextStream &m_t;
177     CodeOutputInterface &m_ci;
178     bool m_insidePre;
179     bool m_hide;
180     QStack<bool> m_enabled;
181     QCString m_langExt;
182 };
183
184 #endif