Doxygen
rtfdocvisitor.h
浏览该文件的文档.
1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 #ifndef RTFDOCVISITOR_H
20 #define RTFDOCVISITOR_H
21 
22 #include <iostream>
23 
24 #include "docvisitor.h"
25 #include "qcstring.h"
26 
28 class TextStream;
29 
30 /*! @brief Concrete visitor implementation for RTF output. */
31 class RTFDocVisitor : public DocVisitor
32 {
33  public:
35 
36  //--------------------------------------
37  // visitor functions for leaf nodes
38  //--------------------------------------
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  //--------------------------------------
59  // visitor functions for compound nodes
60  //--------------------------------------
61 
62  void visitPre(DocAutoList *);
63  void visitPost(DocAutoList *);
64  void visitPre(DocAutoListItem *);
65  void visitPost(DocAutoListItem *);
66  void visitPre(DocPara *);
67  void visitPost(DocPara *);
68  void visitPre(DocRoot *);
69  void visitPost(DocRoot *);
70  void visitPre(DocSimpleSect *);
71  void visitPost(DocSimpleSect *);
72  void visitPre(DocTitle *);
73  void visitPost(DocTitle *);
74  void visitPre(DocSimpleList *);
75  void visitPost(DocSimpleList *);
78  void visitPre(DocSection *s);
79  void visitPost(DocSection *);
80  void visitPre(DocHtmlList *s);
81  void visitPost(DocHtmlList *s);
82  void visitPre(DocHtmlListItem *);
83  void visitPost(DocHtmlListItem *);
84  //void visitPre(DocHtmlPre *);
85  //void visitPost(DocHtmlPre *);
86  void visitPre(DocHtmlDescList *);
87  void visitPost(DocHtmlDescList *);
88  void visitPre(DocHtmlDescTitle *);
90  void visitPre(DocHtmlDescData *);
91  void visitPost(DocHtmlDescData *);
92  void visitPre(DocHtmlTable *t);
93  void visitPost(DocHtmlTable *t);
94  void visitPre(DocHtmlCaption *);
95  void visitPost(DocHtmlCaption *);
96  void visitPre(DocHtmlRow *);
97  void visitPost(DocHtmlRow *) ;
98  void visitPre(DocHtmlCell *);
99  void visitPost(DocHtmlCell *);
100  void visitPre(DocInternal *);
101  void visitPost(DocInternal *);
102  void visitPre(DocHRef *);
103  void visitPost(DocHRef *);
104  void visitPre(DocHtmlHeader *);
105  void visitPost(DocHtmlHeader *) ;
106  void visitPre(DocImage *);
107  void visitPost(DocImage *);
108  void visitPre(DocDotFile *);
109  void visitPost(DocDotFile *);
110  void visitPre(DocMscFile *);
111  void visitPost(DocMscFile *);
112  void visitPre(DocDiaFile *);
113  void visitPost(DocDiaFile *);
114  void visitPre(DocLink *);
115  void visitPost(DocLink *);
116  void visitPre(DocRef *ref);
117  void visitPost(DocRef *);
118  void visitPre(DocSecRefItem *);
119  void visitPost(DocSecRefItem *);
120  void visitPre(DocSecRefList *);
121  void visitPost(DocSecRefList *);
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 *);
134  void visitPre(DocVhdlFlow *);
135  void visitPost(DocVhdlFlow *);
136  void visitPre(DocParBlock *);
137  void visitPost(DocParBlock *);
138 
139  private:
140 
141  //--------------------------------------
142  // helper functions
143  //--------------------------------------
144 
145  void filter(const QCString &str,bool verbatim=FALSE);
146  void startLink(const QCString &ref,const QCString &file,
147  const QCString &anchor);
148  void endLink(const QCString &ref);
149  QCString getStyle(const QCString &name);
150 
151  int indentLevel() const;
152  void incIndentLevel();
153  void decIndentLevel();
154 
155  void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
156  void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE);
157  void writeDotFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
158  void writeDotFile(DocDotFile *);
159  void writeMscFile(const QCString &fileName, bool hasCaption,const QCString &srcFile,int srcLine);
160  void writeMscFile(DocMscFile *);
161  void writeDiaFile(DocDiaFile *);
162  void writePlantUMLFile(const QCString &fileName, bool hasCaption);
163 
164  //--------------------------------------
165  // state variables
166  //--------------------------------------
167 
170  bool m_insidePre = false;
171  bool m_hide = false;
172  bool m_lastIsPara = false;
174 
175  static const int maxIndentLevels = 13;
176  int m_indentLevel = 0;
178  {
179  bool isEnum = false;
180  int number = 1;
181  char type = '1';
182  };
184 };
185 
186 #endif
DocHtmlBlockQuote
Node representing an HTML blockquote
Definition: docparser.h:1433
DocAutoListItem
Node representing an item of a auto list
Definition: docparser.h:720
DocHRef
Node representing a Hypertext reference
Definition: docparser.h:936
DocStyleChange
Node representing a style change
Definition: docparser.h:343
DocVerbatim
Node representing a verbatim, unparsed text fragment
Definition: docparser.h:510
DocTitle
Node representing a simple section title
Definition: docparser.h:736
DocPara
Node representing a paragraph in the documentation tree
Definition: docparser.h:1178
RTFDocVisitor::startLink
void startLink(const QCString &ref, const QCString &file, const QCString &anchor)
Definition: rtfdocvisitor.cpp:1816
DocDotFile
Node representing a dot file
Definition: docparser.h:830
DocHtmlTable
Node representing a HTML table
Definition: docparser.h:1405
RTFDocVisitor::endLink
void endLink(const QCString &ref)
Definition: rtfdocvisitor.cpp:1846
DocRoot
Root node of documentation tree
Definition: docparser.h:1457
RTFDocVisitor::m_hide
bool m_hide
Definition: rtfdocvisitor.h:171
RTFDocVisitor::RTFListItemInfo
Definition: rtfdocvisitor.h:177
DocHtmlHeader
Node Html heading
Definition: docparser.h:957
docvisitor.h
DocHtmlListItem
Node representing a HTML list item
Definition: docparser.h:1286
RTFDocVisitor::writePlantUMLFile
void writePlantUMLFile(const QCString &fileName, bool hasCaption)
Definition: rtfdocvisitor.cpp:1909
DocVhdlFlow
Node representing a VHDL flow chart
Definition: docparser.h:860
DocHtmlDescData
Node representing a HTML description data
Definition: docparser.h:1303
DocHtmlDescTitle
Node representing a Html description item
Definition: docparser.h:973
DocEmoji
Node representing a n emoji
Definition: docparser.h:469
DocMscFile
Node representing a msc file
Definition: docparser.h:840
RTFDocVisitor::writeMscFile
void writeMscFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine)
Definition: rtfdocvisitor.cpp:1882
DocSecRefItem
Node representing a reference to a section
Definition: docparser.h:1023
DocAnchor
Node representing an anchor
Definition: docparser.h:303
RTFDocVisitor::m_langExt
QCString m_langExt
Definition: rtfdocvisitor.h:173
RTFDocVisitor::m_indentLevel
int m_indentLevel
Definition: rtfdocvisitor.h:176
TextStream
Text streaming class that buffers data.
Definition: textstream.h:33
DocText
Root node of a text fragment
Definition: docparser.h:1447
DocVisitor
Abstract visitor that participates in the visitor pattern.
Definition: docvisitor.h:92
qcstring.h
RTFDocVisitor::m_lastIsPara
bool m_lastIsPara
Definition: rtfdocvisitor.h:172
DocFormula
Node representing an item of a cross-referenced list
Definition: docparser.h:658
DocHtmlDescList
Node representing a Html description list
Definition: docparser.h:987
RTFDocVisitor::incIndentLevel
void incIndentLevel()
Definition: rtfdocvisitor.cpp:76
DocIncOperator
Node representing a include/dontinclude operator block
Definition: docparser.h:606
DocIndexEntry
Node representing an entry in the index.
Definition: docparser.h:682
DocSecRefList
Node representing a list of section references
Definition: docparser.h:1048
DocLineBreak
Node representing a line break
Definition: docparser.h:272
DocWord
Node representing a word
Definition: docparser.h:217
DocSymbol
Node representing a special symbol
Definition: docparser.h:385
DocXRefItem
Node representing an item of a cross-referenced list
Definition: docparser.h:749
DocImage
Node representing an image
Definition: docparser.h:771
DocURL
Node representing a URL (or email address)
Definition: docparser.h:256
RTFDocVisitor::RTFListItemInfo::type
char type
Definition: rtfdocvisitor.h:181
DocHtmlCaption
Node representing a HTML table caption
Definition: docparser.h:1352
DocParamList
Node representing a parameter list.
Definition: docparser.h:1228
RTFDocVisitor::visit
void visit(DocWord *)
Definition: rtfdocvisitor.cpp:94
DocParBlock
Node representing an block of paragraphs
Definition: docparser.h:1070
DocSimpleSectSep
Node representing a separator between two simple sections of the same type.
Definition: docparser.h:1139
DocCite
Node representing a citation of some bibliographic reference
Definition: docparser.h:321
RTFDocVisitor::writeDotFile
void writeDotFile(const QCString &fileName, bool hasCaption, const QCString &srcFile, int srcLine)
Definition: rtfdocvisitor.cpp:1863
DocRef
Node representing a reference to some item
Definition: docparser.h:891
DocParamSect
Node representing a parameter section
Definition: docparser.h:1150
RTFDocVisitor::indentLevel
int indentLevel() const
Definition: rtfdocvisitor.cpp:71
DocHtmlList
Node representing a Html list
Definition: docparser.h:1093
RTFDocVisitor::maxIndentLevels
static const int maxIndentLevels
Definition: rtfdocvisitor.h:175
RTFDocVisitor::includePicturePreRTF
void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage=FALSE)
Definition: rtfdocvisitor.cpp:1239
RTFDocVisitor::m_listItemInfo
RTFListItemInfo m_listItemInfo[maxIndentLevels]
Definition: rtfdocvisitor.h:183
RTFDocVisitor::m_ci
CodeOutputInterface & m_ci
Definition: rtfdocvisitor.h:169
DocSimpleSect
Node representing a simple section
Definition: docparser.h:1111
DocSection
Node representing a normal section
Definition: docparser.h:1001
RTFDocVisitor::m_insidePre
bool m_insidePre
Definition: rtfdocvisitor.h:170
DocHorRuler
Node representing a horizontal ruler
Definition: docparser.h:288
DocInclude
Node representing an included text block from file
Definition: docparser.h:563
RTFDocVisitor::decIndentLevel
void decIndentLevel()
Definition: rtfdocvisitor.cpp:85
RTFDocVisitor::writeDiaFile
void writeDiaFile(DocDiaFile *)
Definition: rtfdocvisitor.cpp:1896
DocAutoList
Node representing an auto List
Definition: docparser.h:703
RTFDocVisitor::visitPre
void visitPre(DocAutoList *)
Definition: rtfdocvisitor.cpp:664
DocInternal
Node representing an internal section of documentation
Definition: docparser.h:1059
RTFDocVisitor::filter
void filter(const QCString &str, bool verbatim=FALSE)
Definition: rtfdocvisitor.cpp:1770
DocLinkedWord
Node representing a word that can be linked to something
Definition: docparser.h:231
RTFDocVisitor::m_t
TextStream & m_t
Definition: rtfdocvisitor.h:168
RTFDocVisitor::includePicturePostRTF
void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage=FALSE)
Definition: rtfdocvisitor.cpp:1282
CodeOutputInterface
Output interface for code parser.
Definition: outputgen.h:61
DocDiaFile
Node representing a dia file
Definition: docparser.h:850
RTFDocVisitor::RTFListItemInfo::number
int number
Definition: rtfdocvisitor.h:180
DocSimpleList
Node representing a simple list
Definition: docparser.h:1082
DocSimpleListItem
Node representing a simple list item
Definition: docparser.h:1266
DocWhiteSpace
Node representing some amount of white space
Definition: docparser.h:484
RTFDocVisitor::RTFListItemInfo::isEnum
bool isEnum
Definition: rtfdocvisitor.h:179
RTFDocVisitor
Concrete visitor implementation for RTF output.
Definition: rtfdocvisitor.h:31
DocHtmlCell
Node representing a HTML table cell
Definition: docparser.h:1316
DocInternalRef
Node representing an internal reference to some item
Definition: docparser.h:919
DocHtmlRow
Node representing a HTML table row
Definition: docparser.h:1371
RTFDocVisitor::getStyle
QCString getStyle(const QCString &name)
Definition: rtfdocvisitor.cpp:64
RTFDocVisitor::visitPost
void visitPost(DocAutoList *)
Definition: rtfdocvisitor.cpp:676
RTFDocVisitor::RTFDocVisitor
RTFDocVisitor(TextStream &t, CodeOutputInterface &ci, const QCString &langExt)
Definition: rtfdocvisitor.cpp:58
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108