Doxygen
Loading...
Searching...
No Matches
docnode.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2022 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 DOCNODE_H
17#define DOCNODE_H
18
19#include <cstdio>
20#include <cstdint>
21#include <vector>
22#include <memory>
23#include <variant>
24#include <type_traits>
25
26#include "qcstring.h"
27#include "docvisitor.h"
28#include "docparser.h"
29#include "htmlattrib.h"
30#include "htmlentity.h"
31#include "growvector.h"
32#include "section.h"
33#include "construct.h"
34#include "doctokenizer.h"
35
36class MemberDef;
37class Definition;
38class DocParser;
39
40//---------------------------------------------------------------------------
41
42#define DOC_NODES \
43/* 0 */ DN(DocWord) DN_SEP DN(DocLinkedWord) DN_SEP DN(DocURL) DN_SEP DN(DocLineBreak) DN_SEP DN(DocHorRuler) DN_SEP \
44/* 5 */ DN(DocAnchor) DN_SEP DN(DocCite) DN_SEP DN(DocStyleChange) DN_SEP DN(DocSymbol) DN_SEP DN(DocEmoji) DN_SEP \
45/* 10 */ DN(DocWhiteSpace) DN_SEP DN(DocSeparator) DN_SEP DN(DocVerbatim) DN_SEP DN(DocInclude) DN_SEP DN(DocIncOperator) DN_SEP \
46/* 15 */ DN(DocFormula) DN_SEP DN(DocIndexEntry) DN_SEP DN(DocAutoList) DN_SEP DN(DocAutoListItem) DN_SEP DN(DocTitle) DN_SEP \
47/* 20 */ DN(DocXRefItem) DN_SEP DN(DocImage) DN_SEP DN(DocDotFile) DN_SEP DN(DocMscFile) DN_SEP DN(DocDiaFile) DN_SEP \
48/* 25 */ DN(DocVhdlFlow) DN_SEP DN(DocLink) DN_SEP DN(DocRef) DN_SEP DN(DocInternalRef) DN_SEP DN(DocHRef) DN_SEP \
49/* 30 */ DN(DocHtmlHeader) DN_SEP DN(DocHtmlDescTitle) DN_SEP DN(DocHtmlDescList) DN_SEP DN(DocSection) DN_SEP DN(DocSecRefItem) DN_SEP \
50/* 35 */ DN(DocSecRefList) DN_SEP DN(DocInternal) DN_SEP DN(DocParBlock) DN_SEP DN(DocSimpleList) DN_SEP DN(DocHtmlList) DN_SEP \
51/* 40 */ DN(DocSimpleSect) DN_SEP DN(DocSimpleSectSep) DN_SEP DN(DocParamSect) DN_SEP DN(DocPara) DN_SEP DN(DocParamList) DN_SEP \
52/* 45 */ DN(DocSimpleListItem) DN_SEP DN(DocHtmlListItem) DN_SEP DN(DocHtmlDescData) DN_SEP DN(DocHtmlCell) DN_SEP DN(DocHtmlCaption) DN_SEP \
53/* 50 */ DN(DocHtmlRow) DN_SEP DN(DocHtmlTable) DN_SEP DN(DocHtmlBlockQuote) DN_SEP DN(DocText) DN_SEP DN(DocRoot) DN_SEP \
54/* 55 */ DN(DocHtmlDetails) DN_SEP DN(DocHtmlSummary) DN_SEP DN(DocPlantUmlFile) \
55
56// forward declarations
57#define DN(x) class x;
58#define DN_SEP
60#undef DN
61#undef DN_SEP
62
63// define a variant type
64#define DN(x) x
65#define DN_SEP ,
66using DocNodeVariant = std::variant<
68>;
69#undef DN
70#undef DN_SEP
71
72// getter functions to return the name of a doc node type
73#define DN(x) constexpr const char *docNodeName(const x &/* n */) { return #x; }
74#define DN_SEP
76#undef DN
77#undef DN_SEP
78
79/** Abstract node interface with type information. */
81{
82 public:
83 /*! Creates a new node */
85 ~DocNode() = default;
87
88 /*! Returns the parent of this node or nullptr for the root node. */
90 const DocNodeVariant *parent() const { return m_parent; }
91
93 const DocNodeVariant *thisVariant() const { return m_thisVariant; }
94
96
97 DocParser *parser() { return m_parser; }
98 const DocParser *parser() const { return m_parser; }
99
100 /*! Sets a new parent for this node. */
102
103 /*! Returns TRUE iff this node is inside a preformatted section */
104 bool isPreformatted() const { return m_insidePre; }
105
106 protected:
107 /*! Sets whether or not this item is inside a preformatted section */
108 void setInsidePreformatted(bool p) { m_insidePre = p; }
110 private:
111 bool m_insidePre = false;
115};
116
117struct DocNodeList : public GrowVector<DocNodeVariant>
118{
119 /** Append a new DocNodeVariant to the list by constructing it with type T and
120 * parameters Args.
121 */
122 template<class T,class...Args>
123 void append(Args&&... args);
124
125 /** moves the element of list \a l at the end of this list.
126 * List \a l will become empty. */
127 void move_append(DocNodeList &l);
128
129 /** Returns a pointer to the last element in the list if that element exists and
130 * holds a T, otherwise nullptr is returned.
131 */
132 template<class T>
133 T *get_last();
134};
135
136/** Base class for nodes with children */
138{
139 public:
143 const DocNodeList &children() const { return m_children; }
144
145 private:
147};
148
149/** Node representing a word
150 */
151class DocWord : public DocNode
152{
153 public:
155 QCString word() const { return m_word; }
156
157 private:
159};
160
161/** Node representing a word that can be linked to something
162 */
163class DocLinkedWord : public DocNode
164{
165 public:
167 const QCString &ref,const QCString &file,
168 const QCString &anchor,const QCString &tooltip);
169 QCString word() const { return m_word; }
170 QCString file() const { return m_file; }
171 QCString relPath() const { return m_relPath; }
172 QCString ref() const { return m_ref; }
173 QCString anchor() const { return m_anchor; }
174 QCString tooltip() const { return m_tooltip; }
175
176 private:
183};
184
185/** Node representing a URL (or email address) */
186class DocURL : public DocNode
187{
188 public:
191 QCString url() const { return m_url; }
192 bool isEmail() const { return m_isEmail; }
193
194 private:
196 bool m_isEmail = false;
197};
198
199/** Node representing a line break */
212
213/** Node representing a horizontal ruler */
214class DocHorRuler : public DocNode
215{
216 public:
219
220 const HtmlAttribList &attribs() const { return m_attribs; }
221
222 private:
224};
225
226/** Node representing an anchor */
227class DocAnchor : public DocNode
228{
229 public:
230 DocAnchor(DocParser *parser,DocNodeVariant *parent,const QCString &id,bool newAnchor);
231 QCString anchor() const { return m_anchor; }
232 QCString file() const { return m_file; }
233
234 const HtmlAttribList &attribs() const { return m_attribs; }
235
236 private:
240};
241
242/** Node representing a citation of some bibliographic reference */
243class DocCite : public DocNode
244{
245 public:
246 DocCite(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &context);
247 QCString file() const { return m_file; }
248 QCString relPath() const { return m_relPath; }
249 QCString ref() const { return m_ref; }
250 QCString anchor() const { return m_anchor; }
251 QCString text() const { return m_text; }
252
253 private:
259};
260
261
262/** Node representing a style change */
264{
265 public:
266 enum Style { Bold = (1<<0),
267 Italic = (1<<1),
268 Code = (1<<2),
269 Center = (1<<3),
270 Small = (1<<4),
271 Subscript = (1<<5),
272 Superscript = (1<<6),
273 Preformatted = (1<<7),
274 Span = (1<<8),
275 Div = (1<<9),
276 Strike = (1<<10),
277 Underline = (1<<11),
278 Del = (1<<12),
279 Ins = (1<<13),
280 S = (1<<14),
281 Cite = (1<<15),
282 Kbd = (1<<16)
283 };
284
302 Style style() const { return m_style; }
303 const char *styleString() const;
304 bool enable() const { return m_enable; }
305 size_t position() const { return m_position; }
306 const HtmlAttribList &attribs() const { return m_attribs; }
307 QCString tagName() const { return m_tagName; }
308 QCString fileName() const { return m_fileName; }
309 int lineNr() const { return m_lineNr; }
310
311 private:
312 size_t m_position = 0;
314 bool m_enable = false;
318 int m_lineNr = -1;
319};
320
321/** Node representing a special symbol */
333
334/** Node representing an emoji */
335class DocEmoji : public DocNode
336{
337 public:
339 QCString name() const { return m_symName; }
340 int index() const { return m_index; }
341
342 private:
344 int m_index = 0;
345};
346
347/** Node representing some amount of white space */
348class DocWhiteSpace : public DocNode
349{
350 public:
353 QCString chars() const { return m_chars; }
354 private:
356};
357
358/** Node representing a separator */
359class DocSeparator : public DocNode
360{
361 public:
364 QCString chars() const { return m_chars; }
365 private:
367};
368
369/** Node representing a verbatim, unparsed text fragment */
370class DocVerbatim : public DocNode
371{
372 public:
375 const QCString &text, Type t,bool isExample,
376 const QCString &exampleFile,bool isBlock=FALSE,const QCString &lang=QCString());
377 Type type() const { return p->type; }
378 QCString text() const { return p->text; }
379 QCString context() const { return p->context; }
380 bool isExample() const { return p->isExample; }
381 QCString exampleFile() const { return p->exampleFile; }
382 QCString relPath() const { return p->relPath; }
383 QCString language() const { return p->lang; }
384 bool isBlock() const { return p->isBlock; }
385 bool hasCaption() const { return !p->children.empty(); }
386 QCString width() const { return p->width; }
387 QCString height() const { return p->height; }
388 QCString engine() const { return p->engine; }
389 bool useBitmap() const { return p->useBitmap; }
390 const DocNodeList &children() const { return p->children; }
391 DocNodeList &children() { return p->children; }
392 QCString srcFile() const { return p->srcFile; }
393 int srcLine() const { return p->srcLine; }
394 void setText(const QCString &t) { p->text=t; }
395 void setWidth(const QCString &w) { p->width=w; }
396 void setHeight(const QCString &h) { p->height=h; }
397 void setEngine(const QCString &e) { p->engine=e; }
398 void setUseBitmap(const bool &u) { p->useBitmap=u; }
399 void setLocation(const QCString &file,int line) { p->srcFile=file; p->srcLine=line; }
400
401 private:
402 struct Private
403 {
404 Private(const QCString &context_,const QCString &text_, Type type_, bool isExample_,
405 const QCString &exampleFile_, const QCString &relPath_,const QCString &lang_, bool isBlock_)
406 : context(context_), text(text_), type(type_), isExample(isExample_),
407 exampleFile(exampleFile_), relPath(relPath_), lang(lang_), isBlock(isBlock_) {}
419 bool useBitmap=false; // some PlantUML engines cannot output data in EPS format so bitmap format is required
422 int srcLine = -1;
423 };
424 std::unique_ptr<Private> p;
425};
426
427
428/** Node representing an included text block from file */
429class DocInclude : public DocNode
430{
431 public:
435 };
444 QCString file() const { return m_file; }
445 QCString extension() const { int i=m_file.findRev('.'); return i!=-1 ? m_file.mid(i) : QCString(); }
446 Type type() const { return m_type; }
447 QCString text() const { return m_text; }
448 QCString context() const { return m_context; }
449 QCString blockId() const { return m_blockId; }
450 bool stripCodeComments() const { return m_stripCodeComments; }
451 bool isExample() const { return m_isExample; }
453 bool isBlock() const { return m_isBlock; }
454 bool trimLeft() const { return m_trimLeft; }
455 void parse();
456
457 private:
468};
469
470/** Node representing a include/dontinclude operator block */
472{
473 public:
480 Type type() const { return m_type; }
481 const char *typeAsString() const
482 {
483 switch(m_type)
484 {
485 case Line: return "line";
486 case SkipLine: return "skipline";
487 case Skip: return "skip";
488 case Until: return "until";
489 }
490 return "";
491 }
492 int line() const { return m_line; }
493 bool showLineNo() const { return m_showLineNo; }
494 QCString text() const { return m_text; }
495 QCString pattern() const { return m_pattern; }
496 QCString context() const { return m_context; }
497 bool isFirst() const { return m_isFirst; }
498 bool isLast() const { return m_isLast; }
499 void markFirst(bool v=TRUE) { m_isFirst = v; }
500 void markLast(bool v=TRUE) { m_isLast = v; }
501 bool stripCodeComments() const { return m_stripCodeComments; }
502 bool isExample() const { return m_isExample; }
505 void parse();
506
507 private:
509 int m_line = 0;
510 bool m_showLineNo = false;
514 bool m_isFirst = false;
515 bool m_isLast = false;
517 bool m_isExample = false;
520};
521
522/** Node representing an item of a cross-referenced list */
523class DocFormula : public DocNode
524{
525 public:
527 QCString name() const { return m_name; }
528 QCString text() const { return m_text; }
529 QCString relPath() const { return m_relPath; }
530 int id() const { return m_id; }
531 bool isInline() const
532 {
533 if (m_text.length()>1 && m_text.at(0)=='\\' && m_text.at(1)=='[') return false;
534 if (m_text.startsWith("\\begin{")) return false;
535 return true;
536 }
537
538 private:
542 int m_id = 0;
543};
544
545/** Node representing an entry in the index. */
546class DocIndexEntry : public DocNode
547{
548 public:
551 Token parse();
552 const Definition *scope() const { return m_scope; }
553 const MemberDef *member() const { return m_member; }
554 QCString entry() const { return m_entry; }
555
556 private:
558 const Definition *m_scope = nullptr;
559 const MemberDef *m_member = nullptr;
560};
561
562//-----------------------------------------------------------------------
563
564/** Node representing an auto List */
566{
567 public:
569 {
570 Unnumbered=1, Unchecked=-2, Checked_x=-3, Checked_X=-4 // positive numbers give the label
571 };
573 int depth, bool isCheckedList);
574
575 bool isEnumList() const { return m_isEnumList; }
576 int indent() const { return m_indent; }
577 bool isCheckedList() const { return m_isCheckedList; }
578 int depth() const { return m_depth; }
579 Token parse();
580
581 private:
582 int m_indent = 0;
583 bool m_isEnumList = false;
584 bool m_isCheckedList = false;
585 int m_depth = 0;
586};
587
588/** Node representing an item of a auto list */
590{
591 public:
593 int itemNumber() const { return m_itemNum; }
594 Token parse();
595
596 private:
597 int m_indent = 0;
598 int m_itemNum = 0;
599};
600
601/** Node representing a simple section title */
603{
604 public:
606 void parse();
607 void parseFromString(DocNodeVariant *,const QCString &title);
608 bool hasTitle() const { return !children().empty(); }
609
610 private:
611};
612
613/** Node representing an item of a cross-referenced list */
615{
616 public:
618 QCString file() const { return m_file; }
619 QCString anchor() const { return m_anchor; }
620 QCString title() const { return m_title; }
621 QCString relPath() const { return m_relPath; }
622 QCString key() const { return m_key; }
623 bool parse();
624
625 private:
626 int m_id = 0;
632};
633
634/** Node representing an image */
636{
637 public:
638 enum Type { Html, Latex, Rtf, DocBook, Xml };
640 const QCString &name,Type t,const QCString &url=QCString(), bool inlineImage = TRUE);
641 Type type() const { return p->type; }
642 QCString name() const { return p->name; }
643 bool hasCaption() const { return !children().empty(); }
644 QCString width() const { return p->width; }
645 QCString height() const { return p->height; }
646 QCString relPath() const { return p->relPath; }
647 QCString url() const { return p->url; }
648 bool isInlineImage() const { return p->inlineImage; }
649 bool isSVG() const;
650 const HtmlAttribList &attribs() const { return p->attribs; }
651 void parse();
652
653 private:
654 struct Private
655 {
656 Private(const HtmlAttribList &attribs_,const QCString &name_,Type type_,
657 const QCString &relPath_, const QCString &url_,bool inlineImage_)
658 : attribs(attribs_), name(name_), type(type_),
659 relPath(relPath_), url(url_), inlineImage(inlineImage_) {}
668 };
669 std::unique_ptr<Private> p;
670};
671
673{
674 public:
678 QCString name() const { return p->name; }
679 QCString file() const { return p->file; }
680 QCString relPath() const { return p->relPath; }
681 bool hasCaption() const { return !children().empty(); }
682 QCString width() const { return p->width; }
683 QCString height() const { return p->height; }
684 QCString context() const { return p->context; }
685 QCString srcFile() const { return p->srcFile; }
686 int srcLine() const { return p->srcLine; }
687
688 protected:
689 struct Private
690 {
691 Private(const QCString &name_,const QCString &context_,const QCString &srcFile_,int srcLine_)
692 : name(name_), context(context_), srcFile(srcFile_), srcLine(srcLine_) {}
701 };
702 std::unique_ptr<Private> p;
703};
704
705/** Node representing a dot file */
707{
708 public:
710 const QCString &srcFile,int srcLine);
711 bool parse();
712};
713
714/** Node representing a msc file */
716{
717 public:
719 const QCString &srcFile,int srcLine);
720 bool parse();
721};
722
723/** Node representing a dia file */
725{
726 public:
728 const QCString &srcFile,int srcLine);
729 bool parse();
730};
731
732/** Node representing a uml file */
734{
735 public:
737 const QCString &srcFile,int srcLine);
738 bool parse();
739};
740
741/** Node representing a VHDL flow chart */
743{
744 public:
746 void parse();
747 bool hasCaption() const { return !children().empty(); }
748 private:
749};
750
751/** Node representing a link to some item */
753{
754 public:
756 QCString parse(bool,bool isXmlLink=FALSE);
757 QCString file() const { return m_file; }
758 QCString relPath() const { return m_relPath; }
759 QCString ref() const { return m_ref; }
760 QCString anchor() const { return m_anchor; }
761
762 private:
768};
769
770/** Node representing a reference to some item */
772{
773 public:
774 DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &context);
775 void parse();
776 QCString file() const { return m_file; }
777 QCString relPath() const { return m_relPath; }
778 QCString ref() const { return m_ref; }
779 QCString anchor() const { return m_anchor; }
780 QCString targetTitle() const { return m_text; }
782 bool hasLinkText() const { return !children().empty(); }
783 bool refToAnchor() const { return m_refType==Anchor; }
784 bool refToSection() const { return m_refType==Section; }
785 bool refToTable() const { return m_refType==Table; }
786 bool isSubPage() const { return m_isSubPage; }
787
788 private:
791 bool m_isSubPage = false;
797};
798
799/** Node representing an internal reference to some item */
801{
802 public:
804 void parse();
805 QCString file() const { return m_file; }
806 QCString relPath() const { return m_relPath; }
807 QCString anchor() const { return m_anchor; }
808
809 private:
813};
814
815/** Node representing a Hypertext reference */
835
836/** Node Html summary */
848
849/** Node Html details */
851{
852 public:
855 const HtmlAttribList &attribs() const { return m_attribs; }
856 Token parse();
858 const DocNodeVariant *summary() const { return m_summary.get(); }
859
860 private:
862 std::unique_ptr<DocNodeVariant> m_summary;
863};
864
865/** Node Html heading */
867{
868 public:
871 int level() const { return m_level; }
872 const HtmlAttribList &attribs() const { return m_attribs; }
873 Token parse();
874
875 private:
876 int m_level = 0;
878};
879
880/** Node representing a Html description item */
892
893/** Node representing a Html description list */
905
906/** Node representing a normal section */
908{
909 public:
912 int level() const { return m_level; }
913 const DocNodeVariant *title() const { return m_title.get(); }
914 QCString anchor() const { return m_anchor; }
915 QCString id() const { return m_id; }
916 QCString file() const { return m_file; }
917 Token parse();
918
919 private:
920 int m_level = 0;
922 std::unique_ptr<DocNodeVariant> m_title;
925};
926
927/** Node representing a reference to a section */
929{
930 public:
932 QCString target() const { return m_target; }
933 QCString file() const { return m_file; }
934 QCString anchor() const { return m_anchor; }
935 QCString relPath() const { return m_relPath; }
936 QCString ref() const { return m_ref; }
937 bool refToTable() const { return m_refType==Table; }
938 bool isSubPage() const { return m_isSubPage; }
939 void parse();
940
941 private:
944 bool m_isSubPage = false;
949};
950
951/** Node representing a list of section references */
953{
954 public:
956 void parse();
957
958 private:
959};
960
961/** Node representing an internal section of documentation */
963{
964 public:
966 Token parse(int);
967
968 private:
969};
970
971/** Node representing an block of paragraphs */
973{
974 public:
976 Token parse();
977
978 private:
979};
980
981
982/** Node representing a simple list */
984{
985 public:
987 Token parse();
988
989 private:
990};
991
992/** Node representing a Html list */
1008
1009/** Node representing a simple section */
1011{
1012 public:
1020 Type type() const { return m_type; }
1021 QCString typeString() const;
1022 Token parse(bool userTitle,bool needsSeparator);
1023 Token parseRcs();
1024 Token parseXml();
1025 void appendLinkWord(const QCString &word);
1026 bool hasTitle() const;
1027 const DocNodeVariant *title() const { return m_title.get(); }
1028
1029 private:
1031 std::unique_ptr<DocNodeVariant> m_title;
1032};
1033
1034/** Node representing a separator between two simple sections of the
1035 * same type.
1036 */
1038{
1039 public:
1041
1042 private:
1043};
1044
1045/** Node representing a parameter section */
1047{
1048 friend class DocParamList;
1049 public:
1055 {
1057 };
1061 Token parse(const QCString &cmdName,bool xmlContext,Direction d);
1062 Type type() const { return m_type; }
1064 bool hasTypeSpecifier() const { return m_hasTypeSpecifier; }
1065
1066 private:
1070};
1071
1072/** Node representing a paragraph in the documentation tree */
1074{
1075 public:
1077 Token parse();
1078 bool isEmpty() const { return children().empty(); }
1079 void markFirst(bool v=TRUE) { m_isFirst=v; }
1080 void markLast(bool v=TRUE) { m_isLast=v; }
1081 bool isFirst() const { return m_isFirst; }
1082 bool isLast() const { return m_isLast; }
1083
1084 Token handleCommand(char cmdChar,const QCString &cmdName);
1085 Token handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs);
1086 Token handleHtmlEndTag(const QCString &tagName);
1089 Token handleParamSection(const QCString &cmdName,DocParamSect::Type t, bool xmlContext, int direction);
1091 template<class T> void handleFile(const QCString &cmdName);
1092 void handleInclude(const QCString &cmdName,DocInclude::Type t);
1093 void handleLink(const QCString &cmdName,bool isJavaLink);
1094 void handleCite(char cmdChar,const QCString &cmdName);
1095 void handleDoxyConfig(char cmdChar,const QCString &cmdName);
1096 void handleEmoji(char cmdChar,const QCString &cmdName);
1097 void handleRef(char cmdChar,const QCString &cmdName);
1098 void handleSection(char cmdChar,const QCString &cmdName);
1099 void handleInheritDoc();
1100 void handleVhdlFlow();
1101 void handleILine(char cmdChar,const QCString &cmdName);
1102 void handleIFile(char cmdChar,const QCString &cmdName);
1103 void handleShowDate(char cmdChar,const QCString &cmdName);
1105 Token handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level);
1106
1107 bool injectToken(Token tok,const QCString &tokText);
1108 const HtmlAttribList &attribs() const { return m_attribs; }
1110
1111 private:
1112 bool m_isFirst = false;
1113 bool m_isLast = false;
1115};
1116
1117/** Node representing a parameter list. */
1144
1145/** Node representing a simple list item */
1147{
1148 public:
1150 Token parse();
1151 const DocNodeVariant *paragraph() const { return m_paragraph.get(); }
1152
1153 private:
1154 std::unique_ptr<DocNodeVariant> m_paragraph;
1155};
1156
1157/** Node representing a HTML list item */
1159{
1160 public:
1163 int itemNumber() const { return m_itemNum; }
1164 const HtmlAttribList &attribs() const { return m_attribs; }
1165 Token parse();
1166 Token parseXml();
1167
1168 private:
1170 int m_itemNum = 0;
1171};
1172
1173/** Node representing a HTML description data */
1184
1185/** Node representing a HTML table cell */
1187{
1188 friend class DocHtmlTable;
1189 public:
1194 bool isHeading() const { return m_isHeading; }
1195 bool isFirst() const { return m_isFirst; }
1196 bool isLast() const { return m_isLast; }
1197 void markFirst(bool v=TRUE) { m_isFirst=v; }
1198 void markLast(bool v=TRUE) { m_isLast=v; }
1199 const HtmlAttribList &attribs() const { return m_attribs; }
1200 Token parse();
1201 Token parseXml();
1202 uint32_t rowIndex() const { return m_rowIdx; }
1203 uint32_t columnIndex() const { return m_colIdx; }
1204 uint32_t rowSpan() const;
1205 uint32_t colSpan() const;
1206 Alignment alignment() const;
1207 Valignment valignment() const;
1208
1209 private:
1210 void setRowIndex(uint32_t idx) { m_rowIdx = idx; }
1211 void setColumnIndex(uint32_t idx) { m_colIdx = idx; }
1212 bool m_isHeading = false;
1213 bool m_isFirst = false;
1214 bool m_isLast = false;
1216 uint32_t m_rowIdx = static_cast<uint32_t>(-1);
1217 uint32_t m_colIdx = static_cast<uint32_t>(-1);
1218};
1219
1220/** Node representing a HTML table caption */
1222{
1223 public:
1225 const HtmlAttribList &attribs() const { return m_attribs; }
1226 Token parse();
1227 bool hasCaptionId() const { return m_hasCaptionId; }
1228 QCString file() const { return m_file; }
1229 QCString anchor() const { return m_anchor; }
1230
1231 private:
1233 bool m_hasCaptionId = false;
1236};
1237
1238/** Node representing a HTML table row */
1240{
1241 friend class DocHtmlTable;
1242 public:
1245 size_t numCells() const { return children().size(); }
1246 const HtmlAttribList &attribs() const { return m_attribs; }
1247 Token parse();
1248 Token parseXml(bool header);
1249 bool isHeading() const;
1250 void setVisibleCells(uint32_t n) { m_visibleCells = n; }
1251 uint32_t visibleCells() const { return m_visibleCells; }
1252 uint32_t rowIndex() const { return m_rowIdx; }
1253
1254 private:
1255 void setRowIndex(uint32_t idx) { m_rowIdx = idx; }
1257 uint32_t m_visibleCells = 0;
1258 uint32_t m_rowIdx = static_cast<uint32_t>(-1);
1259};
1260
1261/** Node representing a HTML table */
1263{
1264 public:
1267 size_t numRows() const { return children().size(); }
1268 bool hasCaption() const;
1269 const HtmlAttribList &attribs() const { return m_attribs; }
1270 Token parse();
1271 Token parseXml();
1272 size_t numColumns() const { return m_numCols; }
1273 const DocNodeVariant *caption() const;
1274 const DocNodeVariant *firstRow() const;
1275
1276 private:
1277 void computeTableGrid();
1278 std::unique_ptr<DocNodeVariant> m_caption;
1280 size_t m_numCols = 0;
1281};
1282
1283/** Node representing an HTML blockquote */
1295
1296/** Root node of a text fragment */
1298{
1299 public:
1301 void parse();
1302 bool isEmpty() const { return children().empty(); }
1303};
1304
1305/** Root node of documentation tree */
1307{
1308 public:
1311 void parse();
1312 bool indent() const { return m_indent; }
1313 bool singleLine() const { return m_singleLine; }
1314 bool isEmpty() const { return children().empty(); }
1315
1316 private:
1317 bool m_indent = false;
1318 bool m_singleLine = false;
1319};
1320
1321//--------------------------------------------------------------------------------------
1322
1323/// returns the parent node of a given node \a n or nullptr if the node has no parent.
1325{
1326 return n ? std::visit([](auto &&x)->decltype(auto) { return x.parent(); }, *n) : nullptr;
1327}
1328
1329/// returns the parent node of a given node \a n or nullptr if the node has no parent.
1330constexpr const DocNodeVariant *parent(const DocNodeVariant *n)
1331{
1332 return n ? std::visit([](auto &&x)->decltype(auto) { return x.parent(); }, *n) : nullptr;
1333}
1334
1335namespace details
1336{
1337
1338template<class T,class... Ts>
1339struct Impl
1340{
1341 static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
1342 {
1343 return std::holds_alternative<T>(v) || Impl<Ts...>::holds_one_of_alternatives(v);
1344 }
1345};
1346
1347template<class T>
1348struct Impl<T>
1349{
1350 static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
1351 {
1352 return std::holds_alternative<T>(v);
1353 }
1354};
1355
1356} // namespace details
1357
1358/// returns true iff \a v holds one of types passed as template parameters
1359template<class... Ts>
1364
1365namespace details
1366{
1367
1368// Helper type trait to check if a type has member function children(). Default case is false.
1369template <typename T, typename = void>
1370struct has_method_children : std::false_type {};
1371
1372// Use SFINAE to have a partial template specialization derived from std::true_type in case T has method children()
1373template <typename T>
1374struct has_method_children<T, std::void_t<decltype(std::declval<T>().children())>> : std::true_type {};
1375
1376} // namespace details
1377
1378// Call children() on variant v if the contained type has this method, otherwise return nullptr
1380{
1381 return std::visit([](auto&& value) -> DocNodeList* {
1382 if constexpr (details::has_method_children<decltype(value)>::value) {
1383 return &value.children();
1384 } else {
1385 return nullptr;
1386 }
1387 }, *v);
1388}
1389
1390//----------------- DocNodeList ---------------------------------------
1391
1392template<class T,class...Args>
1393inline void DocNodeList::append(Args&&... args)
1394{
1395 // add a DocNodeVariant to the list containing an node T as its active member.
1396 emplace_back(T(std::forward<Args>(args)...));
1397 // store a pointer to the variant holding node T inside the node itself.
1398 // Since DocNodeList is a GrowVector this reference will remain valid even if new
1399 // elements are added (which would not be the case if a std::vector was used)
1400 std::get_if<T>(&back())->setThisVariant(&back());
1401}
1402
1403template<class T>
1405{
1406 return std::get_if<T>(&back());
1407}
1408
1409// ---------------- Debug helpers -------------------------------
1410
1411#define DN(x) #x
1412#define DN_SEP ,
1413inline const char *docNodeName(const DocNodeVariant &v)
1414{
1415 static const char *table[] = { DOC_NODES };
1416 return table[v.index()];
1417}
1418#undef DN
1419#undef DN_SEP
1420
1421inline void dumpDocNodeSizes()
1422{
1423#define DN(x) #x
1424#define DN_SEP ,
1425 static const char *tableWithNames[] = { DOC_NODES };
1426#undef DN
1427#undef DN_SEP
1428
1429#define DN(x) sizeof(x)
1430#define DN_SEP ,
1431 static size_t tableWithSizes[] = { DOC_NODES };
1432#undef DN
1433#undef DN_SEP
1434
1435 size_t maxSize=0;
1436 printf("DocNodeVariant(\n");
1437 for (size_t i=0;i<sizeof(tableWithNames)/sizeof(tableWithNames[0]);i++)
1438 {
1439 printf(" /* %2zu */ sizeof(%s)=%zu\n",i,tableWithNames[i],tableWithSizes[i]);
1440 if (tableWithSizes[i]>maxSize) maxSize = tableWithSizes[i];
1441 }
1442 printf(")=%zu\n",maxSize);
1443}
1444
1445inline void dumpDocNodeList(const DocNodeList &children)
1446{
1447 printf("children=[\n");
1448 for (const auto &child : children)
1449 {
1450 const DocWord *w = std::get_if<DocWord>(&child);
1451 printf(" %s (%p) %s\n",docNodeName(child),(void*)&child,qPrint(w?w->word():""));
1452 }
1453 printf("]\n");
1454}
1455
1456//----------------------------------------------------------------------------------
1457
1458/** Class representing the abstract syntax tree of a documentation block */
1460{
1461 public:
1462 // Note that r can only be a rvalue, not a general forwarding reference.
1463 // The compiler will error on lvalues because DotNodeVariant doesn't have a copy constructor
1464 template<class DocNode>
1465 DocNodeAST(DocNode &&r) : root(std::move(r))
1466 {
1467 std::get_if<DocNode>(&root)->setThisVariant(&root);
1468 }
1469 bool isEmpty() const override
1470 {
1471 if (std::holds_alternative<DocRoot>(root))
1472 {
1473 return std::get<DocRoot>(root).isEmpty();
1474 }
1475 else if (std::holds_alternative<DocText>(root))
1476 {
1477 return std::get<DocText>(root).isEmpty();
1478 }
1479 return false;
1480 }
1482};
1483
1484template<class T,class... Args>
1485std::unique_ptr<DocNodeVariant> createDocNode(Args&&...args)
1486{
1487 auto node = std::make_unique<DocNodeVariant>(T(std::forward<Args>(args)...));
1488 std::get_if<T>(node.get())->setThisVariant(node.get());
1489 return node;
1490}
1491
1492#endif
The common base class of all entity definitions found in the sources.
Definition definition.h:76
const HtmlAttribList & attribs() const
Definition docnode.h:234
HtmlAttribList m_attribs
Definition docnode.h:239
DocAnchor(DocParser *parser, DocNodeVariant *parent, const QCString &id, bool newAnchor)
Definition docnode.cpp:208
QCString anchor() const
Definition docnode.h:231
QCString m_anchor
Definition docnode.h:237
QCString m_file
Definition docnode.h:238
QCString file() const
Definition docnode.h:232
int m_depth
Definition docnode.h:585
bool isCheckedList() const
Definition docnode.h:577
bool isEnumList() const
Definition docnode.h:575
int depth() const
Definition docnode.h:578
int m_indent
Definition docnode.h:582
Token parse()
Definition docnode.cpp:2811
bool m_isCheckedList
Definition docnode.h:584
int indent() const
Definition docnode.h:576
DocAutoList(DocParser *parser, DocNodeVariant *parent, int indent, bool isEnumList, int depth, bool isCheckedList)
Definition docnode.cpp:2804
bool m_isEnumList
Definition docnode.h:583
int itemNumber() const
Definition docnode.h:593
DocAutoListItem(DocParser *parser, DocNodeVariant *parent, int indent, int num)
Definition docnode.cpp:2764
QCString m_anchor
Definition docnode.h:257
DocCite(DocParser *parser, DocNodeVariant *parent, const QCString &target, const QCString &context)
Definition docnode.cpp:887
QCString text() const
Definition docnode.h:251
QCString m_relPath
Definition docnode.h:255
QCString relPath() const
Definition docnode.h:248
QCString m_ref
Definition docnode.h:256
QCString anchor() const
Definition docnode.h:250
QCString m_file
Definition docnode.h:254
QCString ref() const
Definition docnode.h:249
QCString file() const
Definition docnode.h:247
QCString m_text
Definition docnode.h:258
DocNodeList & children()
Definition docnode.h:142
const DocNodeList & children() const
Definition docnode.h:143
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
DocNodeList m_children
Definition docnode.h:146
bool parse()
Definition docnode.cpp:1136
DocDiaFile(DocParser *parser, DocNodeVariant *parent, const QCString &name, const QCString &context, const QCString &srcFile, int srcLine)
Definition docnode.cpp:1129
QCString relPath() const
Definition docnode.h:680
QCString height() const
Definition docnode.h:683
QCString srcFile() const
Definition docnode.h:685
QCString file() const
Definition docnode.h:679
std::unique_ptr< Private > p
Definition docnode.h:702
int srcLine() const
Definition docnode.h:686
DocDiagramFileBase(DocParser *parser, DocNodeVariant *parent, const QCString &name, const QCString &context, const QCString &srcFile, int srcLine)
Definition docnode.h:675
bool hasCaption() const
Definition docnode.h:681
QCString context() const
Definition docnode.h:684
QCString width() const
Definition docnode.h:682
QCString name() const
Definition docnode.h:678
bool parse()
Definition docnode.cpp:1058
DocDotFile(DocParser *parser, DocNodeVariant *parent, const QCString &name, const QCString &context, const QCString &srcFile, int srcLine)
Definition docnode.cpp:1051
int index() const
Definition docnode.h:340
DocEmoji(DocParser *parser, DocNodeVariant *parent, const QCString &symName)
Definition docnode.cpp:159
int m_index
Definition docnode.h:344
QCString name() const
Definition docnode.h:339
QCString m_symName
Definition docnode.h:343
QCString m_relPath
Definition docnode.h:541
QCString text() const
Definition docnode.h:528
QCString name() const
Definition docnode.h:527
bool isInline() const
Definition docnode.h:531
QCString m_text
Definition docnode.h:540
int id() const
Definition docnode.h:530
QCString m_name
Definition docnode.h:539
DocFormula(DocParser *parser, DocNodeVariant *parent, int id)
Definition docnode.cpp:514
QCString relPath() const
Definition docnode.h:529
Token parse()
Definition docnode.cpp:1450
HtmlAttribList m_attribs
Definition docnode.h:830
QCString url() const
Definition docnode.h:824
QCString m_file
Definition docnode.h:833
DocHRef(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, const QCString &url, const QCString &relPath, const QCString &file)
Definition docnode.h:819
QCString relPath() const
Definition docnode.h:826
QCString file() const
Definition docnode.h:825
const HtmlAttribList & attribs() const
Definition docnode.h:827
QCString m_url
Definition docnode.h:831
QCString m_relPath
Definition docnode.h:832
DocHorRuler(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:217
const HtmlAttribList & attribs() const
Definition docnode.h:220
HtmlAttribList m_attribs
Definition docnode.h:223
DocHtmlBlockQuote(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:1287
const HtmlAttribList & attribs() const
Definition docnode.h:1290
HtmlAttribList m_attribs
Definition docnode.h:1293
bool hasCaptionId() const
Definition docnode.h:1227
HtmlAttribList m_attribs
Definition docnode.h:1232
bool m_hasCaptionId
Definition docnode.h:1233
DocHtmlCaption(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.cpp:1657
QCString m_file
Definition docnode.h:1234
const HtmlAttribList & attribs() const
Definition docnode.h:1225
QCString anchor() const
Definition docnode.h:1229
QCString file() const
Definition docnode.h:1228
QCString m_anchor
Definition docnode.h:1235
Valignment valignment() const
Definition docnode.cpp:1861
friend class DocHtmlTable
Definition docnode.h:1188
void setColumnIndex(uint32_t idx)
Definition docnode.h:1211
bool isFirst() const
Definition docnode.h:1195
Token parseXml()
Definition docnode.cpp:1765
uint32_t columnIndex() const
Definition docnode.h:1203
void setRowIndex(uint32_t idx)
Definition docnode.h:1210
void markLast(bool v=TRUE)
Definition docnode.h:1198
uint32_t rowSpan() const
Definition docnode.cpp:1799
uint32_t rowIndex() const
Definition docnode.h:1202
DocHtmlCell(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, bool isHeading)
Definition docnode.h:1192
uint32_t m_colIdx
Definition docnode.h:1217
bool m_isFirst
Definition docnode.h:1213
void markFirst(bool v=TRUE)
Definition docnode.h:1197
Alignment alignment() const
Definition docnode.cpp:1823
bool isLast() const
Definition docnode.h:1196
bool isHeading() const
Definition docnode.h:1194
bool m_isLast
Definition docnode.h:1214
const HtmlAttribList & attribs() const
Definition docnode.h:1199
HtmlAttribList m_attribs
Definition docnode.h:1215
bool m_isHeading
Definition docnode.h:1212
Token parse()
Definition docnode.cpp:1731
uint32_t m_rowIdx
Definition docnode.h:1216
uint32_t colSpan() const
Definition docnode.cpp:1811
DocHtmlDescData(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:1177
const HtmlAttribList & attribs() const
Definition docnode.h:1178
HtmlAttribList m_attribs
Definition docnode.h:1182
DocHtmlDescList(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:897
const HtmlAttribList & attribs() const
Definition docnode.h:899
HtmlAttribList m_attribs
Definition docnode.h:903
HtmlAttribList m_attribs
Definition docnode.h:890
DocHtmlDescTitle(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:884
const HtmlAttribList & attribs() const
Definition docnode.h:886
const HtmlAttribList & attribs() const
Definition docnode.h:855
DocHtmlDetails(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:853
void parseSummary(DocNodeVariant *, HtmlAttribList &attribs)
Definition docnode.cpp:1440
const DocNodeVariant * summary() const
Definition docnode.h:858
HtmlAttribList m_attribs
Definition docnode.h:861
std::unique_ptr< DocNodeVariant > m_summary
Definition docnode.h:862
Token parse()
Definition docnode.cpp:1265
HtmlAttribList m_attribs
Definition docnode.h:877
const HtmlAttribList & attribs() const
Definition docnode.h:872
DocHtmlHeader(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, int level)
Definition docnode.h:869
int level() const
Definition docnode.h:871
Type m_type
Definition docnode.h:1005
Token parseXml()
Definition docnode.cpp:2611
const HtmlAttribList & attribs() const
Definition docnode.h:1000
HtmlAttribList m_attribs
Definition docnode.h:1006
Token parse()
Definition docnode.cpp:2536
Type type() const
Definition docnode.h:999
DocHtmlList(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, Type t)
Definition docnode.h:997
const HtmlAttribList & attribs() const
Definition docnode.h:1164
HtmlAttribList m_attribs
Definition docnode.h:1169
int itemNumber() const
Definition docnode.h:1163
DocHtmlListItem(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, int num)
Definition docnode.h:1161
Token parseXml(bool header)
Definition docnode.cpp:1963
uint32_t m_rowIdx
Definition docnode.h:1258
void setVisibleCells(uint32_t n)
Definition docnode.h:1250
friend class DocHtmlTable
Definition docnode.h:1241
DocHtmlRow(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:1243
HtmlAttribList m_attribs
Definition docnode.h:1256
bool isHeading() const
Definition docnode.cpp:1883
size_t numCells() const
Definition docnode.h:1245
uint32_t m_visibleCells
Definition docnode.h:1257
uint32_t rowIndex() const
Definition docnode.h:1252
const HtmlAttribList & attribs() const
Definition docnode.h:1246
void setRowIndex(uint32_t idx)
Definition docnode.h:1255
uint32_t visibleCells() const
Definition docnode.h:1251
Token parse()
Definition docnode.cpp:1898
const HtmlAttribList & attribs() const
Definition docnode.h:842
HtmlAttribList m_attribs
Definition docnode.h:846
DocHtmlSummary(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:840
size_t numRows() const
Definition docnode.h:1267
Token parseXml()
Definition docnode.cpp:2121
std::unique_ptr< DocNodeVariant > m_caption
Definition docnode.h:1278
Token parse()
Definition docnode.cpp:2043
void computeTableGrid()
determines the location of all cells in a grid, resolving row and column spans.
Definition docnode.cpp:2178
size_t numColumns() const
Definition docnode.h:1272
size_t m_numCols
Definition docnode.h:1280
const DocNodeVariant * caption() const
Definition docnode.cpp:2029
const HtmlAttribList & attribs() const
Definition docnode.h:1269
bool hasCaption() const
Definition docnode.cpp:2024
HtmlAttribList m_attribs
Definition docnode.h:1279
DocHtmlTable(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:1265
const DocNodeVariant * firstRow() const
Definition docnode.cpp:2034
const HtmlAttribList & attribs() const
Definition docnode.h:650
QCString relPath() const
Definition docnode.h:646
QCString name() const
Definition docnode.h:642
QCString url() const
Definition docnode.h:647
QCString height() const
Definition docnode.h:645
Type type() const
Definition docnode.h:641
QCString width() const
Definition docnode.h:644
DocImage(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, const QCString &name, Type t, const QCString &url=QCString(), bool inlineImage=TRUE)
Definition docnode.cpp:1242
@ DocBook
Definition docnode.h:638
std::unique_ptr< Private > p
Definition docnode.h:669
void parse()
Definition docnode.cpp:1257
bool isInlineImage() const
Definition docnode.h:648
bool isSVG() const
Definition docnode.cpp:1248
bool hasCaption() const
Definition docnode.h:643
bool m_stripCodeComments
Definition docnode.h:516
const char * typeAsString() const
Definition docnode.h:481
bool stripCodeComments() const
Definition docnode.h:501
bool isLast() const
Definition docnode.h:498
QCString m_exampleFile
Definition docnode.h:518
void markFirst(bool v=TRUE)
Definition docnode.h:499
QCString includeFileName() const
Definition docnode.h:504
QCString text() const
Definition docnode.h:494
QCString m_includeFileName
Definition docnode.h:519
QCString m_context
Definition docnode.h:513
QCString context() const
Definition docnode.h:496
QCString exampleFile() const
Definition docnode.h:503
bool m_isExample
Definition docnode.h:517
int line() const
Definition docnode.h:492
Type type() const
Definition docnode.h:480
bool isFirst() const
Definition docnode.h:497
QCString pattern() const
Definition docnode.h:495
DocIncOperator(DocParser *parser, DocNodeVariant *parent, Type t, const QCString &pat, const QCString &context, bool stripCodeComments, bool isExample, const QCString &exampleFile)
Definition docnode.h:475
bool showLineNo() const
Definition docnode.h:493
QCString m_pattern
Definition docnode.h:512
void markLast(bool v=TRUE)
Definition docnode.h:500
QCString m_text
Definition docnode.h:511
bool m_showLineNo
Definition docnode.h:510
bool isExample() const
Definition docnode.h:502
QCString blockId() const
Definition docnode.h:449
bool m_trimLeft
Definition docnode.h:465
QCString m_context
Definition docnode.h:459
QCString extension() const
Definition docnode.h:445
bool isBlock() const
Definition docnode.h:453
void parse()
Definition docnode.cpp:267
QCString m_text
Definition docnode.h:460
Type m_type
Definition docnode.h:461
bool m_isExample
Definition docnode.h:463
bool m_isBlock
Definition docnode.h:464
DocInclude(DocParser *parser, DocNodeVariant *parent, const QCString &file, const QCString &context, Type t, bool stripCodeComments, bool isExample, const QCString &exampleFile, const QCString &blockId, bool isBlock, bool trimLeft)
Definition docnode.h:436
bool stripCodeComments() const
Definition docnode.h:450
@ LatexInclude
Definition docnode.h:432
@ SnippetWithLines
Definition docnode.h:433
@ DontIncWithLines
Definition docnode.h:434
@ IncWithLines
Definition docnode.h:433
@ HtmlInclude
Definition docnode.h:432
@ VerbInclude
Definition docnode.h:432
@ DontInclude
Definition docnode.h:432
@ DocbookInclude
Definition docnode.h:434
QCString m_blockId
Definition docnode.h:467
Type type() const
Definition docnode.h:446
QCString exampleFile() const
Definition docnode.h:452
QCString text() const
Definition docnode.h:447
bool m_stripCodeComments
Definition docnode.h:462
QCString file() const
Definition docnode.h:444
QCString m_exampleFile
Definition docnode.h:466
bool trimLeft() const
Definition docnode.h:454
bool isExample() const
Definition docnode.h:451
QCString context() const
Definition docnode.h:448
QCString m_file
Definition docnode.h:458
QCString m_entry
Definition docnode.h:557
Token parse()
Definition docnode.cpp:1560
const MemberDef * m_member
Definition docnode.h:559
DocIndexEntry(DocParser *parser, DocNodeVariant *parent, const Definition *scope, const MemberDef *md)
Definition docnode.h:549
QCString entry() const
Definition docnode.h:554
const Definition * m_scope
Definition docnode.h:558
const Definition * scope() const
Definition docnode.h:552
const MemberDef * member() const
Definition docnode.h:553
DocInternal(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:965
Token parse(int)
Definition docnode.cpp:1500
QCString m_file
Definition docnode.h:810
QCString file() const
Definition docnode.h:805
QCString m_anchor
Definition docnode.h:812
DocInternalRef(DocParser *parser, DocNodeVariant *parent, const QCString &target)
Definition docnode.cpp:670
QCString relPath() const
Definition docnode.h:806
QCString anchor() const
Definition docnode.h:807
QCString m_relPath
Definition docnode.h:811
DocLineBreak(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:203
HtmlAttribList m_attribs
Definition docnode.h:210
DocLineBreak(DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
Definition docnode.h:204
const HtmlAttribList & attribs() const
Definition docnode.h:207
QCString m_word
Definition docnode.h:177
QCString m_anchor
Definition docnode.h:181
QCString file() const
Definition docnode.h:170
QCString relPath() const
Definition docnode.h:171
QCString ref() const
Definition docnode.h:172
QCString word() const
Definition docnode.h:169
QCString m_file
Definition docnode.h:179
QCString anchor() const
Definition docnode.h:173
QCString m_ref
Definition docnode.h:178
QCString m_relPath
Definition docnode.h:180
DocLinkedWord(DocParser *parser, DocNodeVariant *parent, const QCString &word, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &tooltip)
Definition docnode.cpp:191
QCString m_tooltip
Definition docnode.h:182
QCString tooltip() const
Definition docnode.h:174
DocMscFile(DocParser *parser, DocNodeVariant *parent, const QCString &name, const QCString &context, const QCString &srcFile, int srcLine)
Definition docnode.cpp:1089
bool parse()
Definition docnode.cpp:1096
bool isEmpty() const override
Definition docnode.h:1469
DocNodeVariant root
Definition docnode.h:1481
DocNodeAST(DocNode &&r)
Definition docnode.h:1465
Abstract node interface with type information.
Definition docnode.h:81
void setParent(DocNodeVariant *parent)
Definition docnode.h:101
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
bool m_insidePre
Definition docnode.h:111
const DocNodeVariant * thisVariant() const
Definition docnode.h:93
void setInsidePreformatted(bool p)
Definition docnode.h:108
DocNodeVariant * thisVariant()
Definition docnode.h:92
DocNodeVariant * m_parent
Definition docnode.h:113
bool isPreformatted() const
Definition docnode.h:104
DocParser * parser()
Definition docnode.h:97
void setThisVariant(DocNodeVariant *thisVariant)
Definition docnode.h:95
DocNodeVariant * parent()
Definition docnode.h:89
DocNodeVariant * m_thisVariant
Definition docnode.h:114
~DocNode()=default
const DocNodeVariant * parent() const
Definition docnode.h:90
const DocParser * parser() const
Definition docnode.h:98
DocParser * m_parser
Definition docnode.h:112
@ Unknown
Definition docnode.h:109
@ Table
Definition docnode.h:109
@ Section
Definition docnode.h:109
@ Anchor
Definition docnode.h:109
DocParBlock(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:975
Token parse()
Definition docnode.cpp:2705
bool isEmpty() const
Definition docnode.h:1078
Token handleSimpleSection(DocSimpleSect::Type t, bool xmlContext=FALSE)
Definition docnode.cpp:3233
void handleLink(const QCString &cmdName, bool isJavaLink)
Definition docnode.cpp:3676
void handleInheritDoc()
Definition docnode.cpp:3934
void handleCite(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3286
DocPara(DocParser *parser, DocNodeVariant *parent)
Definition docnode.cpp:3227
void handleInclude(const QCString &cmdName, DocInclude::Type t)
Definition docnode.cpp:3744
Token handleCommand(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3971
void handleDoxyConfig(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3349
void handleSection(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3849
void handleFile(const QCString &cmdName)
Definition docnode.cpp:3637
bool isLast() const
Definition docnode.h:1082
void handleIFile(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3553
Token handleParamSection(const QCString &cmdName, DocParamSect::Type t, bool xmlContext, int direction)
Definition docnode.cpp:3263
const HtmlAttribList & attribs() const
Definition docnode.h:1108
void markLast(bool v=TRUE)
Definition docnode.h:1080
Token handleHtmlStartTag(const QCString &tagName, const HtmlAttribList &tagHtmlAttribs)
Definition docnode.cpp:4721
void handleEmoji(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3318
void handleIncludeOperator(const QCString &cmdName, DocIncOperator::Type t)
Definition docnode.cpp:3577
bool isFirst() const
Definition docnode.h:1081
void markFirst(bool v=TRUE)
Definition docnode.h:1079
void handleRef(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3717
void handleILine(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3539
void setAttribs(const HtmlAttribList &attribs)
Definition docnode.h:1109
HtmlAttribList m_attribs
Definition docnode.h:1114
bool m_isFirst
Definition docnode.h:1112
Token parse()
Definition docnode.cpp:5459
void handleVhdlFlow()
Definition docnode.cpp:3669
Token handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs, int level)
Definition docnode.cpp:3880
void handleShowDate(char cmdChar, const QCString &cmdName)
Definition docnode.cpp:3468
bool m_isLast
Definition docnode.h:1113
Token handleXRefItem()
Definition docnode.cpp:3447
Token handleHtmlEndTag(const QCString &tagName)
Definition docnode.cpp:5189
Token handleStartCode()
Definition docnode.cpp:3898
bool injectToken(Token tok, const QCString &tokText)
Definition docnode.cpp:3891
DocNodeList m_paramTypes
Definition docnode.h:1138
DocNodeList m_paragraphs
Definition docnode.h:1136
bool m_isFirst
Definition docnode.h:1141
DocParamSect::Direction m_dir
Definition docnode.h:1140
const DocNodeList & parameters() const
Definition docnode.h:1123
bool isFirst() const
Definition docnode.h:1130
const DocNodeList & paramTypes() const
Definition docnode.h:1124
void markFirst(bool b=TRUE)
Definition docnode.h:1128
DocParamSect::Type type() const
Definition docnode.h:1126
Token parseXml(const QCString &paramName)
Definition docnode.cpp:3116
void markLast(bool b=TRUE)
Definition docnode.h:1129
bool isLast() const
Definition docnode.h:1131
Token parse(const QCString &cmdName)
Definition docnode.cpp:3037
bool m_isLast
Definition docnode.h:1142
DocParamList(DocParser *parser, DocNodeVariant *parent, DocParamSect::Type t, DocParamSect::Direction d)
Definition docnode.h:1121
DocParamSect::Type m_type
Definition docnode.h:1139
DocParamSect::Direction direction() const
Definition docnode.h:1127
DocNodeList m_params
Definition docnode.h:1137
const DocNodeList & paragraphs() const
Definition docnode.h:1125
bool hasInOutSpecifier() const
Definition docnode.h:1063
DocParamSect(DocParser *parser, DocNodeVariant *parent, Type t)
Definition docnode.h:1058
friend class DocParamList
Definition docnode.h:1048
bool m_hasTypeSpecifier
Definition docnode.h:1069
Token parse(const QCString &cmdName, bool xmlContext, Direction d)
Definition docnode.cpp:3184
bool m_hasInOutSpecifier
Definition docnode.h:1068
bool hasTypeSpecifier() const
Definition docnode.h:1064
Type type() const
Definition docnode.h:1062
DocPlantUmlFile(DocParser *parser, DocNodeVariant *parent, const QCString &name, const QCString &context, const QCString &srcFile, int srcLine)
Definition docnode.cpp:1168
QCString anchor() const
Definition docnode.h:779
QCString m_file
Definition docnode.h:792
SectionType m_sectionType
Definition docnode.h:790
SectionType sectionType() const
Definition docnode.h:781
QCString m_text
Definition docnode.h:796
QCString relPath() const
Definition docnode.h:777
QCString targetTitle() const
Definition docnode.h:780
void parse()
Definition docnode.cpp:841
bool isSubPage() const
Definition docnode.h:786
bool refToTable() const
Definition docnode.h:785
QCString file() const
Definition docnode.h:776
QCString m_ref
Definition docnode.h:794
bool refToAnchor() const
Definition docnode.h:783
QCString ref() const
Definition docnode.h:778
QCString m_relPath
Definition docnode.h:793
DocRef(DocParser *parser, DocNodeVariant *parent, const QCString &target, const QCString &context)
Definition docnode.cpp:705
RefType m_refType
Definition docnode.h:789
QCString m_anchor
Definition docnode.h:795
bool refToSection() const
Definition docnode.h:784
bool m_isSubPage
Definition docnode.h:791
bool hasLinkText() const
Definition docnode.h:782
bool singleLine() const
Definition docnode.h:1313
bool indent() const
Definition docnode.h:1312
bool m_singleLine
Definition docnode.h:1318
void parse()
Definition docnode.cpp:6048
DocRoot(DocParser *parser, bool indent, bool sl)
Definition docnode.h:1309
bool m_indent
Definition docnode.h:1317
bool isEmpty() const
Definition docnode.h:1314
QCString m_file
Definition docnode.h:945
bool refToTable() const
Definition docnode.h:937
QCString m_target
Definition docnode.h:942
QCString relPath() const
Definition docnode.h:935
bool m_isSubPage
Definition docnode.h:944
QCString m_anchor
Definition docnode.h:948
QCString target() const
Definition docnode.h:932
QCString file() const
Definition docnode.h:933
QCString m_ref
Definition docnode.h:947
DocSecRefItem(DocParser *parser, DocNodeVariant *parent, const QCString &target)
Definition docnode.cpp:533
QCString m_relPath
Definition docnode.h:946
QCString anchor() const
Definition docnode.h:934
RefType m_refType
Definition docnode.h:943
QCString ref() const
Definition docnode.h:936
bool isSubPage() const
Definition docnode.h:938
DocSecRefList(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:955
std::unique_ptr< DocNodeVariant > m_title
Definition docnode.h:922
QCString m_id
Definition docnode.h:921
QCString file() const
Definition docnode.h:916
QCString m_file
Definition docnode.h:924
int level() const
Definition docnode.h:912
Token parse()
Definition docnode.cpp:5764
DocSection(DocParser *parser, DocNodeVariant *parent, int level, const QCString &id)
Definition docnode.h:910
QCString id() const
Definition docnode.h:915
QCString anchor() const
Definition docnode.h:914
const DocNodeVariant * title() const
Definition docnode.h:913
QCString m_anchor
Definition docnode.h:923
int m_level
Definition docnode.h:920
DocSeparator(DocParser *parser, DocNodeVariant *parent, const QCString &chars)
Definition docnode.h:362
QCString m_chars
Definition docnode.h:366
QCString chars() const
Definition docnode.h:364
DocSimpleList(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:986
Token parse()
Definition docnode.cpp:2749
std::unique_ptr< DocNodeVariant > m_paragraph
Definition docnode.h:1154
const DocNodeVariant * paragraph() const
Definition docnode.h:1151
DocSimpleListItem(DocParser *parser, DocNodeVariant *parent)
Definition docnode.cpp:2730
QCString typeString() const
Definition docnode.cpp:3008
Type type() const
Definition docnode.h:1020
Token parse(bool userTitle, bool needsSeparator)
Definition docnode.cpp:2898
Token parseRcs()
Definition docnode.cpp:2935
DocSimpleSect(DocParser *parser, DocNodeVariant *parent, Type t)
Definition docnode.cpp:2888
const DocNodeVariant * title() const
Definition docnode.h:1027
Token parseXml()
Definition docnode.cpp:2952
void appendLinkWord(const QCString &word)
Definition docnode.cpp:2988
bool hasTitle() const
Definition docnode.cpp:2893
std::unique_ptr< DocNodeVariant > m_title
Definition docnode.h:1031
DocSimpleSectSep(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:1040
DocStyleChange(DocParser *parser, DocNodeVariant *parent, size_t position, Style s, const QCString &tagName, bool enable, const HtmlAttribList *attribs=nullptr)
Definition docnode.h:285
DocStyleChange(DocParser *parser, DocNodeVariant *parent, size_t position, Style s, const QCString &tagName, bool enable, const QCString &fileName, int lineNr, const HtmlAttribList *attribs=nullptr)
Definition docnode.h:292
const char * styleString() const
Definition docnode.cpp:125
const HtmlAttribList & attribs() const
Definition docnode.h:306
int lineNr() const
Definition docnode.h:309
QCString tagName() const
Definition docnode.h:307
Style style() const
Definition docnode.h:302
QCString fileName() const
Definition docnode.h:308
Style m_style
Definition docnode.h:313
size_t position() const
Definition docnode.h:305
HtmlAttribList m_attribs
Definition docnode.h:315
QCString m_fileName
Definition docnode.h:317
bool enable() const
Definition docnode.h:304
size_t m_position
Definition docnode.h:312
QCString m_tagName
Definition docnode.h:316
HtmlEntityMapper::SymType m_symbol
Definition docnode.h:331
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:327
DocSymbol(DocParser *parser, DocNodeVariant *parent, HtmlEntityMapper::SymType s)
Definition docnode.h:325
static HtmlEntityMapper::SymType decodeSymbol(const QCString &symName)
Definition docnode.cpp:152
DocText(DocParser *parser)
Definition docnode.h:1300
void parse()
Definition docnode.cpp:5934
bool isEmpty() const
Definition docnode.h:1302
void parse()
Definition docnode.cpp:2857
void parseFromString(DocNodeVariant *, const QCString &title)
Definition docnode.cpp:2875
DocTitle(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:605
bool hasTitle() const
Definition docnode.h:608
QCString url() const
Definition docnode.h:191
QCString m_url
Definition docnode.h:195
bool m_isEmail
Definition docnode.h:196
DocURL(DocParser *parser, DocNodeVariant *parent, const QCString &url, bool isEmail)
Definition docnode.h:189
bool isEmail() const
Definition docnode.h:192
QCString srcFile() const
Definition docnode.h:392
int srcLine() const
Definition docnode.h:393
QCString height() const
Definition docnode.h:387
DocVerbatim(DocParser *parser, DocNodeVariant *parent, const QCString &context, const QCString &text, Type t, bool isExample, const QCString &exampleFile, bool isBlock=FALSE, const QCString &lang=QCString())
Definition docnode.cpp:257
bool hasCaption() const
Definition docnode.h:385
QCString language() const
Definition docnode.h:383
const DocNodeList & children() const
Definition docnode.h:390
DocNodeList & children()
Definition docnode.h:391
void setWidth(const QCString &w)
Definition docnode.h:395
std::unique_ptr< Private > p
Definition docnode.h:424
bool isBlock() const
Definition docnode.h:384
bool isExample() const
Definition docnode.h:380
QCString context() const
Definition docnode.h:379
Type type() const
Definition docnode.h:377
QCString text() const
Definition docnode.h:378
QCString exampleFile() const
Definition docnode.h:381
void setHeight(const QCString &h)
Definition docnode.h:396
QCString engine() const
Definition docnode.h:388
bool useBitmap() const
Definition docnode.h:389
void setLocation(const QCString &file, int line)
Definition docnode.h:399
QCString relPath() const
Definition docnode.h:382
void setUseBitmap(const bool &u)
Definition docnode.h:398
void setEngine(const QCString &e)
Definition docnode.h:397
@ JavaDocLiteral
Definition docnode.h:373
void setText(const QCString &t)
Definition docnode.h:394
QCString width() const
Definition docnode.h:386
bool hasCaption() const
Definition docnode.h:747
DocVhdlFlow(DocParser *parser, DocNodeVariant *parent)
Definition docnode.cpp:1212
void parse()
Definition docnode.cpp:1216
QCString m_chars
Definition docnode.h:355
QCString chars() const
Definition docnode.h:353
DocWhiteSpace(DocParser *parser, DocNodeVariant *parent, const QCString &chars)
Definition docnode.h:351
Node representing a word.
Definition docnode.h:152
DocWord(DocParser *parser, DocNodeVariant *parent, const QCString &word)
Definition docnode.cpp:179
QCString m_word
Definition docnode.h:158
QCString word() const
Definition docnode.h:155
QCString m_anchor
Definition docnode.h:629
DocXRefItem(DocParser *parser, DocNodeVariant *parent, int id, const QCString &key)
Definition docnode.cpp:472
QCString anchor() const
Definition docnode.h:619
QCString key() const
Definition docnode.h:622
QCString relPath() const
Definition docnode.h:621
QCString m_file
Definition docnode.h:628
QCString file() const
Definition docnode.h:618
QCString m_key
Definition docnode.h:627
QCString m_title
Definition docnode.h:630
bool parse()
Definition docnode.cpp:477
QCString m_relPath
Definition docnode.h:631
QCString title() const
Definition docnode.h:620
std::vector like container optimized for pushing elements to the back.
Definition growvector.h:40
size_t size() const
returns the number of elements
Definition growvector.h:93
DocNodeVariant & back()
Definition growvector.h:135
bool empty() const
checks whether the container is empty
Definition growvector.h:140
void emplace_back(Args &&...args)
Definition growvector.h:108
Class representing a list of HTML attributes.
Definition htmlattrib.h:33
opaque representation of the abstract syntax tree (AST)
Definition docparser.h:49
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
This is an alternative implementation of QCString.
Definition qcstring.h:101
static constexpr int Anchor
Definition section.h:40
#define ONLY_DEFAULT_MOVABLE(cls)
Macro to help implementing the rule of 5 for a class that can be moved but not copied.
Definition construct.h:44
void dumpDocNodeSizes()
Definition docnode.h:1421
std::variant< DocWord, DocLinkedWord, DocURL, DocLineBreak, DocHorRuler, DocAnchor, DocCite, DocStyleChange, DocSymbol, DocEmoji, DocWhiteSpace, DocSeparator, DocVerbatim, DocInclude, DocIncOperator, DocFormula, DocIndexEntry, DocAutoList, DocAutoListItem, DocTitle, DocXRefItem, DocImage, DocDotFile, DocMscFile, DocDiaFile, DocVhdlFlow, DocLink, DocRef, DocInternalRef, DocHRef, DocHtmlHeader, DocHtmlDescTitle, DocHtmlDescList, DocSection, DocSecRefItem, DocSecRefList, DocInternal, DocParBlock, DocSimpleList, DocHtmlList, DocSimpleSect, DocSimpleSectSep, DocParamSect, DocPara, DocParamList, DocSimpleListItem, DocHtmlListItem, DocHtmlDescData, DocHtmlCell, DocHtmlCaption, DocHtmlRow, DocHtmlTable, DocHtmlBlockQuote, DocText, DocRoot, DocHtmlDetails, DocHtmlSummary, DocPlantUmlFile > DocNodeVariant
Definition docnode.h:66
constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
returns true iff v holds one of types passed as template parameters
Definition docnode.h:1360
DocNodeList * call_method_children(DocNodeVariant *v)
Definition docnode.h:1379
#define DOC_NODES
Definition docnode.h:42
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324
std::unique_ptr< DocNodeVariant > createDocNode(Args &&...args)
Definition docnode.h:1485
void dumpDocNodeList(const DocNodeList &children)
Definition docnode.h:1445
constexpr const char * docNodeName(const DocWord &)
Definition docnode.h:75
Alignment
Definition markdown.cpp:194
const char * qPrint(const char *s)
Definition qcstring.h:672
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
Private(const QCString &name_, const QCString &context_, const QCString &srcFile_, int srcLine_)
Definition docnode.h:691
QCString name
Definition docnode.h:661
QCString relPath
Definition docnode.h:665
HtmlAttribList attribs
Definition docnode.h:660
Private(const HtmlAttribList &attribs_, const QCString &name_, Type type_, const QCString &relPath_, const QCString &url_, bool inlineImage_)
Definition docnode.h:656
QCString height
Definition docnode.h:664
QCString width
Definition docnode.h:663
void move_append(DocNodeList &l)
moves the element of list l at the end of this list.
Definition docnode.cpp:800
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1393
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1404
QCString exampleFile
Definition docnode.h:412
DocNodeList children
Definition docnode.h:420
Private(const QCString &context_, const QCString &text_, Type type_, bool isExample_, const QCString &exampleFile_, const QCString &relPath_, const QCString &lang_, bool isBlock_)
Definition docnode.h:404
static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
Definition docnode.h:1341
static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
Definition docnode.h:1350
std::string_view word
Definition util.cpp:980