Imported Upstream version 1.8.18
[platform/upstream/doxygen.git] / src / docbookvisitor.h
1 /******************************************************************************
2 *
3 * Copyright (C) 1997-2020 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16 #ifndef _DOCBOOKDOCVISITOR_H
17 #define _DOCBOOKDOCVISITOR_H
18
19 #include <stack>
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(DocText *);
131     void visitPost(DocText *);
132     void visitPre(DocHtmlBlockQuote *);
133     void visitPost(DocHtmlBlockQuote *);
134     void visitPre(DocVhdlFlow *);
135     void visitPost(DocVhdlFlow *);
136     void visitPre(DocParBlock *);
137     void visitPost(DocParBlock *);
138
139   private:
140     //--------------------------------------
141     // helper functions
142     //--------------------------------------
143     void filter(const char *str);
144     void startLink(const QCString &file,
145     const QCString &anchor);
146     void endLink();
147     void pushEnabled();
148     void popEnabled();
149     void startMscFile(const QCString &fileName,const QCString &width,
150     const QCString &height, bool hasCaption,const QList<DocNode> &children);
151     void endMscFile(bool hasCaption);
152     void writeMscFile(const QCString &fileName, DocVerbatim *s);
153     void startDiaFile(const QCString &fileName,const QCString &width,
154                       const QCString &height, bool hasCaption,const QList<DocNode> &children);
155     void endDiaFile(bool hasCaption);
156     void writeDiaFile(const QCString &fileName, DocVerbatim *s);
157     void startDotFile(const QCString &fileName,const QCString &width,
158     const QCString &height, bool hasCaption,const QList<DocNode> &children);
159     void endDotFile(bool hasCaption);
160     void writeDotFile(const QCString &fileName, DocVerbatim *s);
161     void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
162     void visitPreStart(FTextStream &t,
163                    const QList<DocNode> &children,
164                    bool hasCaption,
165                    const QCString &name,
166                    const QCString &width,
167                    const QCString &height,
168                    bool inlineImage = FALSE);
169     void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE);
170     void visitCaption(const QList<DocNode> &children);
171     //--------------------------------------
172     // state variables
173     //--------------------------------------
174     FTextStream &m_t;
175     CodeOutputInterface &m_ci;
176     bool m_insidePre = false;
177     bool m_hide = false;
178     std::stack<bool> m_enabled;
179     QCString m_langExt;
180     int m_colCnt = 0;
181     std::stack<bool> m_bodySet; // it is possible to have tables without a header, needs to be an array as we can have tables in tables
182 };
183
184 #endif