summaryrefslogtreecommitdiff
path: root/src/docbookvisitor.h
blob: 15533ffa71e8145496bda92dd8d648cf319b128d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/******************************************************************************
*
* Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/

#ifndef DOCBOOKDOCVISITOR_H
#define DOCBOOKDOCVISITOR_H

#include <iostream>

#include "containers.h"
#include "docvisitor.h"
#include "docnode.h"
#include "qcstring.h"

class CodeOutputInterface;
class QCString;
class TextStream;

/*! @brief Concrete visitor implementation for Docbook output. */
class DocbookDocVisitor : public DocVisitor
{
    public:
    DocbookDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt);
    ~DocbookDocVisitor();
    //-----------------------------------------
    template<class T>
    void visitChildren(const T &t)
    {
      for (const auto &child : t.children())
      {
        std::visit(*this, child);
      }
    }
    //--------------------------------------
    // visitor functions for leaf nodes
    //--------------------------------------
    void operator()(const DocWord &);
    void operator()(const DocLinkedWord &);
    void operator()(const DocWhiteSpace &);
    void operator()(const DocSymbol &);
    void operator()(const DocEmoji &);
    void operator()(const DocURL &);
    void operator()(const DocLineBreak &);
    void operator()(const DocHorRuler &);
    void operator()(const DocStyleChange &);
    void operator()(const DocVerbatim &);
    void operator()(const DocAnchor &);
    void operator()(const DocInclude &);
    void operator()(const DocIncOperator &);
    void operator()(const DocFormula &);
    void operator()(const DocIndexEntry &);
    void operator()(const DocSimpleSectSep &);
    void operator()(const DocCite &);
    void operator()(const DocSeparator &);
    //--------------------------------------
    // visitor functions for compound nodes
    //--------------------------------------
    void operator()(const DocAutoList &);
    void operator()(const DocAutoListItem &);
    void operator()(const DocPara &) ;
    void operator()(const DocRoot &);
    void operator()(const DocSimpleSect &);
    void operator()(const DocTitle &);
    void operator()(const DocSimpleList &);
    void operator()(const DocSimpleListItem &);
    void operator()(const DocSection &);
    void operator()(const DocHtmlList &);
    void operator()(const DocHtmlListItem &);
    void operator()(const DocHtmlDescList &);
    void operator()(const DocHtmlDescTitle &);
    void operator()(const DocHtmlDescData &);
    void operator()(const DocHtmlTable &);
    void operator()(const DocHtmlRow &);
    void operator()(const DocHtmlCell &);
    void operator()(const DocHtmlCaption &);
    void operator()(const DocInternal &);
    void operator()(const DocHRef &);
    void operator()(const DocHtmlDetails &);
    void operator()(const DocHtmlHeader &);
    void operator()(const DocImage &);
    void operator()(const DocDotFile &);
    void operator()(const DocMscFile &);
    void operator()(const DocDiaFile &);
    void operator()(const DocLink &);
    void operator()(const DocRef &);
    void operator()(const DocSecRefItem &);
    void operator()(const DocSecRefList &);
    void operator()(const DocParamSect &);
    void operator()(const DocParamList &);
    void operator()(const DocXRefItem &);
    void operator()(const DocInternalRef &);
    void operator()(const DocText &);
    void operator()(const DocHtmlBlockQuote &);
    void operator()(const DocVhdlFlow &);
    void operator()(const DocParBlock &);

  private:
    //--------------------------------------
    // helper functions
    //--------------------------------------
    void filter(const QCString &str, const bool retainNewLine = false);
    void startLink(const QCString &file,
    const QCString &anchor);
    void endLink();
    void startMscFile(const QCString &fileName,const QCString &width,
                      const QCString &height, bool hasCaption,const DocNodeList &children,
                      const QCString &srcFile, int srcLine);
    void endMscFile(bool hasCaption);
    void writeMscFile(const QCString &fileName, const DocVerbatim &s);
    void startDiaFile(const QCString &fileName,const QCString &width,
                      const QCString &height, bool hasCaption,const DocNodeList &children,
                      const QCString &srcFile, int srcLine);
    void endDiaFile(bool hasCaption);
    void writeDiaFile(const QCString &fileName, const DocVerbatim &s);
    void startDotFile(const QCString &fileName,const QCString &width,
                      const QCString &height, bool hasCaption,const DocNodeList &children,
                      const QCString &srcFile, int srcLine);
    void endDotFile(bool hasCaption);
    void writeDotFile(const QCString &fileName, const DocVerbatim &s);
    void writePlantUMLFile(const QCString &fileName, const DocVerbatim &s);
    void visitPreStart(TextStream &t,
                   const DocNodeList &children,
                   bool hasCaption,
                   const QCString &name,
                   const QCString &width,
                   const QCString &height,
                   bool inlineImage = FALSE);
    void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE);
    void visitCaption(const DocNodeList &children);
    //--------------------------------------
    // state variables
    //--------------------------------------
    TextStream &m_t;
    CodeOutputInterface &m_ci;
    bool m_insidePre = false;
    bool m_hide = false;
    BoolStack m_enabled;
    QCString m_langExt;
    int m_colCnt = 0;
    BoolStack m_bodySet; // it is possible to have tables without a header, needs to be an array as we can have tables in tables
};

#endif