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