Imported Upstream version 1.8.19
[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 "containers.h"
20 #include "docvisitor.h"
21 #include <qstack.h>
22 #include <qlist.h>
23 #include <qcstring.h>
24 #include <docparser.h>
25
26 class FTextStream;
27 class CodeOutputInterface;
28 class QCString;
29
30 /*! @brief Concrete visitor implementation for Docbook output. */
31 class DocbookDocVisitor : public DocVisitor
32 {
33     public:
34     DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci);
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 char *str);
143     void startLink(const QCString &file,
144     const QCString &anchor);
145     void endLink();
146     void pushEnabled();
147     void popEnabled();
148     void startMscFile(const QCString &fileName,const QCString &width,
149     const QCString &height, bool hasCaption,const QList<DocNode> &children);
150     void endMscFile(bool hasCaption);
151     void writeMscFile(const QCString &fileName, DocVerbatim *s);
152     void startDiaFile(const QCString &fileName,const QCString &width,
153                       const QCString &height, bool hasCaption,const QList<DocNode> &children);
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 QList<DocNode> &children);
158     void endDotFile(bool hasCaption);
159     void writeDotFile(const QCString &fileName, DocVerbatim *s);
160     void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
161     void visitPreStart(FTextStream &t,
162                    const QList<DocNode> &children,
163                    bool hasCaption,
164                    const QCString &name,
165                    const QCString &width,
166                    const QCString &height,
167                    bool inlineImage = FALSE);
168     void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE);
169     void visitCaption(const QList<DocNode> &children);
170     //--------------------------------------
171     // state variables
172     //--------------------------------------
173     FTextStream &m_t;
174     CodeOutputInterface &m_ci;
175     bool m_insidePre = false;
176     bool m_hide = false;
177     BoolStack m_enabled;
178     QCString m_langExt;
179     int m_colCnt = 0;
180     BoolStack m_bodySet; // it is possible to have tables without a header, needs to be an array as we can have tables in tables
181 };
182
183 #endif