diff options
author | Martin Smith <[email protected]> | 2014-05-23 13:26:36 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-06-01 13:40:53 +0200 |
commit | 46959875cf7ddeb9bbcee883e4bfaef63992b870 (patch) | |
tree | 727c786536dbd21b28eaa8fcaf429259c97f6dc1 /src/tools/qdoc/atom.cpp | |
parent | bb794270ec6cffb5f95bd7d18056b9e7bede7baa (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ƶ <[email protected]>
Diffstat (limited to 'src/tools/qdoc/atom.cpp')
-rw-r--r-- | src/tools/qdoc/atom.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/tools/qdoc/atom.cpp b/src/tools/qdoc/atom.cpp index 6f9da3790d7..8816ea5d6f3 100644 --- a/src/tools/qdoc/atom.cpp +++ b/src/tools/qdoc/atom.cpp @@ -42,31 +42,12 @@ #include <qregexp.h> #include "atom.h" #include "location.h" +#include "qdocdatabase.h" #include <stdio.h> +#include <qdebug.h> QT_BEGIN_NAMESPACE -QLatin1String Atom::BOLD_ ("bold"); -QLatin1String Atom::INDEX_ ("index"); -QLatin1String Atom::ITALIC_ ("italic"); -QLatin1String Atom::LINK_ ("link"); -QLatin1String Atom::PARAMETER_ ("parameter"); -QLatin1String Atom::SPAN_ ("span"); -QLatin1String Atom::SUBSCRIPT_ ("subscript"); -QLatin1String Atom::SUPERSCRIPT_ ("superscript"); -QLatin1String Atom::TELETYPE_ ("teletype"); -QLatin1String Atom::UICONTROL_ ("uicontrol"); -QLatin1String Atom::UNDERLINE_ ("underline"); - -QLatin1String Atom::BULLET_ ("bullet"); -QLatin1String Atom::TAG_ ("tag"); -QLatin1String Atom::VALUE_ ("value"); -QLatin1String Atom::LOWERALPHA_ ("loweralpha"); -QLatin1String Atom::LOWERROMAN_ ("lowerroman"); -QLatin1String Atom::NUMERIC_ ("numeric"); -QLatin1String Atom::UPPERALPHA_ ("upperalpha"); -QLatin1String Atom::UPPERROMAN_ ("upperroman"); - /*! \class Atom \brief The Atom class is the fundamental unit for representing documents internally. @@ -387,4 +368,28 @@ void Atom::dump() const str.toLatin1().data()); } +/*! + The only constructor for LinkAtom. It only create an Atom + of type Atom::Link with \a p1 being the link text. \a p2 + contains some search parameters. + */ +LinkAtom::LinkAtom(const QString& p1, const QString& p2) + : Atom(Link, p1), qml_(false), goal_(Node::NoType), domain_(0) +{ + QStringList params = p2.toLower().split(QLatin1Char(' ')); + foreach (const QString& p, params) { + if (p == "qml") + qml_ = true; + else { + if (!domain_) { + domain_ = QDocDatabase::qdocDB()->findTree(p); + if (domain_) + continue; + } + if (goal_ == Node::NoType) + goal_ = Node::goal(p); + } + } +} + QT_END_NAMESPACE |