Imported Upstream version 1.9.2
[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 <iostream>
20
21 #include "containers.h"
22 #include "docvisitor.h"
23 #include "docparser.h"
24 #include "qcstring.h"
25
26 class CodeOutputInterface;
27 class QCString;
28 class TextStream;
29
30 /*! @brief Concrete visitor implementation for Docbook output. */
31 class DocbookDocVisitor : public DocVisitor
32 {
33     public:
34     DocbookDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt);
35     ~DocbookDocVisitor();
36     //--------------------------------------
37     // visitor functions for leaf nodes
38     //--------------------------------------
39     void visit(DocWord *);
40     void visit(DocLinkedWord *);
41     void visit(DocWhiteSpace *);
42     void visit(DocSymbol *);
43     void visit(DocEmoji *);
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     // visitor functions for compound nodes
58     //--------------------------------------
59     void visitPre(DocAutoList *);
60     void visitPost(DocAutoList *);
61     void visitPre(DocAutoListItem *);
62     void visitPost(DocAutoListItem *);
63     void visitPre(DocPara *) ;
64     void visitPost(DocPara *);
65     void visitPre(DocRoot *);
66     void visitPost(DocRoot *);
67     void visitPre(DocSimpleSect *);
68     void visitPost(DocSimpleSect *);
69     void visitPre(DocTitle *);
70     void visitPost(DocTitle *);
71     void visitPre(DocSimpleList *);
72     void visitPost(DocSimpleList *);
73     void visitPre(DocSimpleListItem *);
74     void visitPost(DocSimpleListItem *);
75     void visitPre(DocSection *);
76     void visitPost(DocSection *);
77     void visitPre(DocHtmlList *);
78     void visitPost(DocHtmlList *) ;
79     void visitPre(DocHtmlListItem *);
80     void visitPost(DocHtmlListItem *);
81     //void visitPre(DocHtmlPre *);
82     //void visitPost(DocHtmlPre *);
83     void visitPre(DocHtmlDescList *);
84     void visitPost(DocHtmlDescList *);
85     void visitPre(DocHtmlDescTitle *);
86     void visitPost(DocHtmlDescTitle *);
87     void visitPre(DocHtmlDescData *);
88     void visitPost(DocHtmlDescData *);
89     void visitPre(DocHtmlTable *);
90     void visitPost(DocHtmlTable *);
91     void visitPre(DocHtmlRow *);
92     void visitPost(DocHtmlRow *) ;
93     void visitPre(DocHtmlCell *);
94     void visitPost(DocHtmlCell *);
95     void visitPre(DocHtmlCaption *);
96     void visitPost(DocHtmlCaption *);
97     void visitPre(DocInternal *);
98     void visitPost(DocInternal *);
99     void visitPre(DocHRef *);
100     void visitPost(DocHRef *);
101     void visitPre(DocHtmlHeader *);
102     void visitPost(DocHtmlHeader *);
103     void visitPre(DocImage *);
104     void visitPost(DocImage *);
105     void visitPre(DocDotFile *);
106     void visitPost(DocDotFile *);
107     void visitPre(DocMscFile *);
108     void visitPost(DocMscFile *);
109     void visitPre(DocDiaFile *);
110     void visitPost(DocDiaFile *);
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(DocLanguage *);
120     //void visitPost(DocLanguage *);
121     void visitPre(DocParamSect *);
122     void visitPost(DocParamSect *);
123     void visitPre(DocParamList *);
124     void visitPost(DocParamList *);
125     void visitPre(DocXRefItem *);
126     void visitPost(DocXRefItem *);
127     void visitPre(DocInternalRef *);
128     void visitPost(DocInternalRef *);
129     void visitPre(DocText *);
130     void visitPost(DocText *);
131     void visitPre(DocHtmlBlockQuote *);
132     void visitPost(DocHtmlBlockQuote *);
133     void visitPre(DocVhdlFlow *);
134     void visitPost(DocVhdlFlow *);
135     void visitPre(DocParBlock *);
136     void visitPost(DocParBlock *);
137
138   private:
139     //--------------------------------------
140     // helper functions
141     //--------------------------------------
142     void filter(const QCString &str);
143     void startLink(const QCString &file,
144     const QCString &anchor);
145     void endLink();
146     void startMscFile(const QCString &fileName,const QCString &width,
147                       const QCString &height, bool hasCaption,const DocNodeList &children,
148                       const QCString &srcFile, int srcLine);
149     void endMscFile(bool hasCaption);
150     void writeMscFile(const QCString &fileName, DocVerbatim *s);
151     void startDiaFile(const QCString &fileName,const QCString &width,
152                       const QCString &height, bool hasCaption,const DocNodeList &children,
153                       const QCString &srcFile, int srcLine);
154     void endDiaFile(bool hasCaption);
155     void writeDiaFile(const QCString &fileName, DocVerbatim *s);
156     void startDotFile(const QCString &fileName,const QCString &width,
157                       const QCString &height, bool hasCaption,const DocNodeList &children,
158                       const QCString &srcFile, int srcLine);
159     void endDotFile(bool hasCaption);
160     void writeDotFile(const QCString &fileName, DocVerbatim *s);
161     void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
162     void visitPreStart(TextStream &t,
163                    const DocNodeList &children,
164                    bool hasCaption,
165                    const QCString &name,
166                    const QCString &width,
167                    const QCString &height,
168                    bool inlineImage = FALSE);
169     void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE);
170     void visitCaption(const DocNodeList &children);
171     //--------------------------------------
172     // state variables
173     //--------------------------------------
174     TextStream &m_t;
175     CodeOutputInterface &m_ci;
176     bool m_insidePre = false;
177     bool m_hide = false;
178     BoolStack m_enabled;
179     QCString m_langExt;
180     int m_colCnt = 0;
181     BoolStack 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