summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/atom.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdoc/atom.h')
-rw-r--r--src/tools/qdoc/atom.h87
1 files changed, 53 insertions, 34 deletions
diff --git a/src/tools/qdoc/atom.h b/src/tools/qdoc/atom.h
index 84a52c9257..36a7390ae2 100644
--- a/src/tools/qdoc/atom.h
+++ b/src/tools/qdoc/atom.h
@@ -39,17 +39,18 @@
**
****************************************************************************/
-/*
- atom.h
-*/
-
#ifndef ATOM_H
#define ATOM_H
#include <qstringlist.h>
+#include "node.h"
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
+class Tree;
+class LinkAtom;
+
class Atom
{
public:
@@ -64,7 +65,7 @@ public:
BriefRight,
C,
CaptionLeft,
- CaptionRight,
+ CaptionRight, // 10
Code,
CodeBad,
CodeNew,
@@ -74,7 +75,7 @@ public:
DivLeft,
DivRight,
EndQmlText,
- FootnoteLeft,
+ FootnoteLeft, // 20
FootnoteRight,
FormatElse,
FormatEndif,
@@ -84,7 +85,7 @@ public:
GeneratedList,
GuidLink,
HR,
- Image,
+ Image, // 30
ImageText,
ImportantLeft,
ImportantRight,
@@ -94,7 +95,7 @@ public:
LegaleseLeft,
LegaleseRight,
LineBreak,
- Link,
+ Link, // 40
LinkNode,
ListLeft,
ListItemNumber,
@@ -104,7 +105,7 @@ public:
ListItemRight,
ListRight,
Nop,
- NoteLeft,
+ NoteLeft, // 50
NoteRight,
ParaLeft,
ParaRight,
@@ -114,7 +115,7 @@ public:
QuotationRight,
RawString,
SectionLeft,
- SectionRight,
+ SectionRight, // 60
SectionHeadingLeft,
SectionHeadingRight,
SidebarLeft,
@@ -124,7 +125,7 @@ public:
SnippetIdentifier,
SnippetLocation,
String,
- TableLeft,
+ TableLeft, // 70
TableRight,
TableHeaderLeft,
TableHeaderRight,
@@ -134,11 +135,21 @@ public:
TableItemRight,
TableOfContents,
Target,
- UnhandledFormat,
+ UnhandledFormat, // 80
UnknownCommand,
Last = UnknownCommand
};
+ enum NodeGenus { DontCare, CPP, QML };
+
+ friend class LinkAtom;
+
+ Atom(const QString& string)
+ : next_(0), type_(Link)
+ {
+ strs << string;
+ }
+
Atom(Type type, const QString& string = "")
: next_(0), type_(type)
{
@@ -169,6 +180,8 @@ public:
previous->next_ = this;
}
+ virtual ~Atom() { }
+
void appendChar(QChar ch) { strs[0] += ch; }
void appendString(const QString& string) { strs[0] += string; }
void chopString() { strs[0].chop(1); }
@@ -185,34 +198,40 @@ public:
const QString& string(int i) const { return strs[i]; }
int count() const { return strs.size(); }
void dump() const;
+ const QStringList& strings() const { return strs; }
+
+ virtual bool isLinkAtom() const { return false; }
+ virtual NodeGenus genus() const { return DontCare; }
+ virtual bool specifiesDomain() const { return false; }
+ virtual Tree* domain() const { return 0; }
+ virtual Node::Type goal() const { return Node::NoType; }
- static QLatin1String BOLD_;
- static QLatin1String INDEX_;
- static QLatin1String ITALIC_;
- static QLatin1String LINK_;
- static QLatin1String PARAMETER_;
- static QLatin1String SPAN_;
- static QLatin1String SUBSCRIPT_;
- static QLatin1String SUPERSCRIPT_;
- static QLatin1String TELETYPE_;
- static QLatin1String UICONTROL_;
- static QLatin1String UNDERLINE_;
-
- static QLatin1String BULLET_;
- static QLatin1String TAG_;
- static QLatin1String VALUE_;
- static QLatin1String LOWERALPHA_;
- static QLatin1String LOWERROMAN_;
- static QLatin1String NUMERIC_;
- static QLatin1String UPPERALPHA_;
- static QLatin1String UPPERROMAN_;
-
-private:
+ protected:
Atom* next_;
Type type_;
QStringList strs;
};
+class LinkAtom : public Atom
+{
+ public:
+ LinkAtom(const QString& p1, const QString& p2);
+ LinkAtom(const LinkAtom& t);
+ LinkAtom(Atom* previous, const LinkAtom& t);
+ virtual ~LinkAtom() { }
+
+ virtual bool isLinkAtom() const { return true; }
+ virtual NodeGenus genus() const { return genus_; }
+ virtual bool specifiesDomain() const { return (domain_ != 0); }
+ virtual Tree* domain() const { return domain_; }
+ virtual Node::Type goal() const { return goal_; }
+
+ protected:
+ NodeGenus genus_;
+ Node::Type goal_;
+ Tree* domain_;
+};
+
#define ATOM_FORMATTING_BOLD "bold"
#define ATOM_FORMATTING_INDEX "index"
#define ATOM_FORMATTING_ITALIC "italic"