summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/atom.h
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2014-05-23 13:26:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-01 13:40:53 +0200
commit46959875cf7ddeb9bbcee883e4bfaef63992b870 (patch)
tree727c786536dbd21b28eaa8fcaf429259c97f6dc1 /src/tools/qdoc/atom.h
parentbb794270ec6cffb5f95bd7d18056b9e7bede7baa (diff)
qdoc: Give documenter more control of linking
This update is preparation for implementing the actual task described in the bug. To implement it required converting the QML type node and the QML basic type node to be first order tree nodes instead of subtypes of the documentation node. This cleans up a lot of messy logic in some places. It was also necessary to split the getLink() function in the html output generator into two functions, one still called getLink(), which handles the \l command, and one called qetAutoLink() which is called for generating auto links. This should make qdoc run faster. The basic infrastructure was also added for parsing the string in the square brackets for the \l command. There will be a further update to complete this task. Note that some autolinks might not be generated due to this change. I haven't seen any yet, but I believe there will be some. This can be fixed later, if it is a problem. Task-number: QTBUG-39221 Change-Id: I8135229984398408205ba901b9ef95ceac74683c Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc/atom.h')
-rw-r--r--src/tools/qdoc/atom.h54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/tools/qdoc/atom.h b/src/tools/qdoc/atom.h
index 84a52c9257..999919482b 100644
--- a/src/tools/qdoc/atom.h
+++ b/src/tools/qdoc/atom.h
@@ -39,17 +39,16 @@
**
****************************************************************************/
-/*
- atom.h
-*/
-
#ifndef ATOM_H
#define ATOM_H
#include <qstringlist.h>
+#include "node.h"
QT_BEGIN_NAMESPACE
+class Tree;
+
class Atom
{
public:
@@ -169,6 +168,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); }
@@ -186,33 +187,34 @@ public:
int count() const { return strs.size(); }
void dump() const;
- 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:
+ virtual bool qml() const { return false; }
+ virtual bool specifiesDomain() const { return false; }
+ virtual Tree* domain() const { return 0; }
+ virtual Node::Type goal() const { return Node::NoType; }
+
+ protected:
Atom* next_;
Type type_;
QStringList strs;
};
+class LinkAtom : public Atom
+{
+ public:
+ LinkAtom(const QString& p1, const QString& p2);
+ virtual ~LinkAtom() { }
+
+ virtual bool qml() const { return qml_; }
+ virtual bool specifiesDomain() const { return (domain_ != 0); }
+ virtual Tree* domain() const { return domain_; }
+ virtual Node::Type goal() const { return goal_; }
+
+ protected:
+ bool qml_;
+ Node::Type goal_;
+ Tree* domain_;
+};
+
#define ATOM_FORMATTING_BOLD "bold"
#define ATOM_FORMATTING_INDEX "index"
#define ATOM_FORMATTING_ITALIC "italic"