1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the tools applications of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | /*
|
---|
43 | atom.h
|
---|
44 | */
|
---|
45 |
|
---|
46 | #ifndef ATOM_H
|
---|
47 | #define ATOM_H
|
---|
48 |
|
---|
49 | #include <qstring.h>
|
---|
50 |
|
---|
51 | #define QDOC_QML
|
---|
52 |
|
---|
53 | QT_BEGIN_NAMESPACE
|
---|
54 |
|
---|
55 | class Atom
|
---|
56 | {
|
---|
57 | public:
|
---|
58 | enum Type {
|
---|
59 | AbstractLeft,
|
---|
60 | AbstractRight,
|
---|
61 | AutoLink,
|
---|
62 | BaseName,
|
---|
63 | BriefLeft,
|
---|
64 | BriefRight,
|
---|
65 | C,
|
---|
66 | CaptionLeft,
|
---|
67 | CaptionRight,
|
---|
68 | Code,
|
---|
69 | CodeBad,
|
---|
70 | CodeNew,
|
---|
71 | CodeOld,
|
---|
72 | CodeQuoteArgument,
|
---|
73 | CodeQuoteCommand,
|
---|
74 | #ifdef QDOC_QML
|
---|
75 | EndQmlText,
|
---|
76 | #endif
|
---|
77 | FootnoteLeft,
|
---|
78 | FootnoteRight,
|
---|
79 | FormatElse,
|
---|
80 | FormatEndif,
|
---|
81 | FormatIf,
|
---|
82 | FormattingLeft,
|
---|
83 | FormattingRight,
|
---|
84 | GeneratedList,
|
---|
85 | Image,
|
---|
86 | ImageText,
|
---|
87 | InlineImage,
|
---|
88 | LegaleseLeft,
|
---|
89 | LegaleseRight,
|
---|
90 | LineBreak,
|
---|
91 | Link,
|
---|
92 | LinkNode,
|
---|
93 | ListLeft,
|
---|
94 | ListItemNumber,
|
---|
95 | ListTagLeft,
|
---|
96 | ListTagRight,
|
---|
97 | ListItemLeft,
|
---|
98 | ListItemRight,
|
---|
99 | ListRight,
|
---|
100 | Nop,
|
---|
101 | ParaLeft,
|
---|
102 | ParaRight,
|
---|
103 | #ifdef QDOC_QML
|
---|
104 | Qml,
|
---|
105 | QmlText,
|
---|
106 | #endif
|
---|
107 | QuotationLeft,
|
---|
108 | QuotationRight,
|
---|
109 | RawString,
|
---|
110 | SectionLeft,
|
---|
111 | SectionRight,
|
---|
112 | SectionHeadingLeft,
|
---|
113 | SectionHeadingRight,
|
---|
114 | SidebarLeft, SidebarRight,
|
---|
115 | SnippetCommand,
|
---|
116 | SnippetIdentifier,
|
---|
117 | SnippetLocation,
|
---|
118 | String,
|
---|
119 | TableLeft,
|
---|
120 | TableRight,
|
---|
121 | TableHeaderLeft,
|
---|
122 | TableHeaderRight,
|
---|
123 | TableRowLeft,
|
---|
124 | TableRowRight,
|
---|
125 | TableItemLeft,
|
---|
126 | TableItemRight,
|
---|
127 | TableOfContents,
|
---|
128 | Target,
|
---|
129 | UnhandledFormat,
|
---|
130 | UnknownCommand,
|
---|
131 | Last = UnknownCommand
|
---|
132 | };
|
---|
133 |
|
---|
134 | Atom(Type type, const QString &string = "")
|
---|
135 | : nxt(0), typ(type), str(string) { }
|
---|
136 | Atom(Atom *prev, Type type, const QString &string = "")
|
---|
137 | : nxt(prev->nxt), typ(type), str(string) { prev->nxt = this; }
|
---|
138 |
|
---|
139 | void appendChar(QChar ch) { str += ch; }
|
---|
140 | void appendString(const QString& string) { str += string; }
|
---|
141 | void chopString() { str.chop(1); }
|
---|
142 | void setString(const QString &string) { str = string; }
|
---|
143 | Atom *next() { return nxt; }
|
---|
144 | void setNext(Atom *newNext) { nxt = newNext; }
|
---|
145 |
|
---|
146 | const Atom *next() const { return nxt; }
|
---|
147 | const Atom *next(Type t) const;
|
---|
148 | const Atom *next(Type t, const QString& s) const;
|
---|
149 | Type type() const { return typ; }
|
---|
150 | QString typeString() const;
|
---|
151 | const QString& string() const { return str; }
|
---|
152 | void dump() const;
|
---|
153 |
|
---|
154 | static QString BOLD_;
|
---|
155 | static QString INDEX_;
|
---|
156 | static QString ITALIC_;
|
---|
157 | static QString LINK_;
|
---|
158 | static QString PARAMETER_;
|
---|
159 | static QString SUBSCRIPT_;
|
---|
160 | static QString SUPERSCRIPT_;
|
---|
161 | static QString TELETYPE_;
|
---|
162 | static QString UNDERLINE_;
|
---|
163 |
|
---|
164 | static QString BULLET_;
|
---|
165 | static QString TAG_;
|
---|
166 | static QString VALUE_;
|
---|
167 | static QString LOWERALPHA_;
|
---|
168 | static QString LOWERROMAN_;
|
---|
169 | static QString NUMERIC_;
|
---|
170 | static QString UPPERALPHA_;
|
---|
171 | static QString UPPERROMAN_;
|
---|
172 |
|
---|
173 | private:
|
---|
174 | Atom *nxt;
|
---|
175 | Type typ;
|
---|
176 | QString str;
|
---|
177 | };
|
---|
178 |
|
---|
179 | #define ATOM_FORMATTING_BOLD "bold"
|
---|
180 | #define ATOM_FORMATTING_INDEX "index"
|
---|
181 | #define ATOM_FORMATTING_ITALIC "italic"
|
---|
182 | #define ATOM_FORMATTING_LINK "link"
|
---|
183 | #define ATOM_FORMATTING_PARAMETER "parameter"
|
---|
184 | #define ATOM_FORMATTING_SUBSCRIPT "subscript"
|
---|
185 | #define ATOM_FORMATTING_SUPERSCRIPT "superscript"
|
---|
186 | #define ATOM_FORMATTING_TELETYPE "teletype"
|
---|
187 | #define ATOM_FORMATTING_UNDERLINE "underline"
|
---|
188 |
|
---|
189 | #define ATOM_LIST_BULLET "bullet"
|
---|
190 | #define ATOM_LIST_TAG "tag"
|
---|
191 | #define ATOM_LIST_VALUE "value"
|
---|
192 | #define ATOM_LIST_LOWERALPHA "loweralpha"
|
---|
193 | #define ATOM_LIST_LOWERROMAN "lowerroman"
|
---|
194 | #define ATOM_LIST_NUMERIC "numeric"
|
---|
195 | #define ATOM_LIST_UPPERALPHA "upperalpha"
|
---|
196 | #define ATOM_LIST_UPPERROMAN "upperroman"
|
---|
197 |
|
---|
198 | QT_END_NAMESPACE
|
---|
199 |
|
---|
200 | #endif
|
---|