summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/bootstrap/bootstrap.pro7
-rw-r--r--src/tools/moc/preprocessor.cpp25
-rw-r--r--src/tools/moc/preprocessor.h2
-rw-r--r--src/tools/moc/symbols.h6
-rw-r--r--src/tools/qdoc/atom.cpp24
-rw-r--r--src/tools/qdoc/atom.h26
-rw-r--r--src/tools/qdoc/codemarker.cpp23
-rw-r--r--src/tools/qdoc/codemarker.h15
-rw-r--r--src/tools/qdoc/codeparser.cpp36
-rw-r--r--src/tools/qdoc/config.cpp12
-rw-r--r--src/tools/qdoc/config.h2
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp60
-rw-r--r--src/tools/qdoc/cppcodemarker.h4
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp374
-rw-r--r--src/tools/qdoc/cppcodeparser.h49
-rw-r--r--src/tools/qdoc/doc.cpp63
-rw-r--r--src/tools/qdoc/doc.h3
-rw-r--r--src/tools/qdoc/doc/examples/examples.qdoc7
-rw-r--r--src/tools/qdoc/doc/qdoc-guide/qdoc-guide.qdoc37
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc2
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc79
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc58
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc296
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc6
-rw-r--r--src/tools/qdoc/doc/qdoc-manual.qdoc2
-rw-r--r--src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc25
-rw-r--r--src/tools/qdoc/doc/qtgui-qdocconf.qdoc117
-rw-r--r--src/tools/qdoc/generator.cpp289
-rw-r--r--src/tools/qdoc/generator.h23
-rw-r--r--src/tools/qdoc/helpprojectwriter.cpp125
-rw-r--r--src/tools/qdoc/helpprojectwriter.h5
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp400
-rw-r--r--src/tools/qdoc/htmlgenerator.h24
-rw-r--r--src/tools/qdoc/jscodemarker.cpp6
-rw-r--r--src/tools/qdoc/jscodemarker.h2
-rw-r--r--src/tools/qdoc/location.cpp21
-rw-r--r--src/tools/qdoc/location.h4
-rw-r--r--src/tools/qdoc/main.cpp15
-rw-r--r--src/tools/qdoc/node.cpp626
-rw-r--r--src/tools/qdoc/node.h385
-rw-r--r--src/tools/qdoc/openedlist.h1
-rw-r--r--src/tools/qdoc/plaincodemarker.cpp4
-rw-r--r--src/tools/qdoc/plaincodemarker.h4
-rw-r--r--src/tools/qdoc/puredocparser.cpp14
-rw-r--r--src/tools/qdoc/qdoc.pro3
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp71
-rw-r--r--src/tools/qdoc/qdocdatabase.h51
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp621
-rw-r--r--src/tools/qdoc/qdocindexfiles.h7
-rw-r--r--src/tools/qdoc/qdoctagfiles.cpp15
-rw-r--r--src/tools/qdoc/qdoctagfiles.h6
-rw-r--r--src/tools/qdoc/qmlcodemarker.cpp8
-rw-r--r--src/tools/qdoc/qmlcodemarker.h4
-rw-r--r--src/tools/qdoc/qmlcodeparser.cpp6
-rw-r--r--src/tools/qdoc/qmlmarkupvisitor.cpp15
-rw-r--r--src/tools/qdoc/qmlmarkupvisitor.h7
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsastfwd_p.h45
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsengine_p.cpp3
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsengine_p.h6
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp25
-rw-r--r--src/tools/qdoc/qmlvisitor.h2
-rw-r--r--src/tools/qdoc/quoter.cpp20
-rw-r--r--src/tools/qdoc/quoter.h2
-rw-r--r--src/tools/qdoc/text.cpp4
-rw-r--r--src/tools/qdoc/text.h4
-rw-r--r--src/tools/qdoc/tokenizer.cpp2
-rw-r--r--src/tools/qdoc/tokenizer.h1
-rw-r--r--src/tools/qdoc/tree.cpp79
-rw-r--r--src/tools/qdoc/tree.h25
-rw-r--r--src/tools/qlalr/compress.cpp2
-rw-r--r--src/tools/qlalr/cppgenerator.cpp4
-rw-r--r--src/tools/qlalr/lalr.cpp8
-rw-r--r--src/tools/qlalr/lalr.h6
-rw-r--r--src/tools/qlalr/parsetable.cpp2
-rw-r--r--src/tools/rcc/rcc.cpp15
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.h1
-rw-r--r--src/tools/uic/uic.h1
77 files changed, 2421 insertions, 1958 deletions
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index a92e5b8f3d..d5909e68a3 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -4,9 +4,6 @@ TARGET = QtBootstrap
QT =
CONFIG += internal_module force_bootstrap
-# otherwise mingw headers do not declare common functions like putenv
-mingw:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-
MODULE_DEFINES = \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
@@ -49,6 +46,9 @@ QMAKE_SYNCQT_OPTIONS += -version $$QT_VERSION
load(qt_module)
+# otherwise mingw headers do not declare common functions like putenv
+mingw: CONFIG -= strict_c++
+
SOURCES += \
../../corelib/codecs/qlatincodec.cpp \
../../corelib/codecs/qtextcodec.cpp \
@@ -97,6 +97,7 @@ SOURCES += \
../../corelib/tools/qlocale_tools.cpp \
../../corelib/tools/qmap.cpp \
../../corelib/tools/qregexp.cpp \
+ ../../corelib/tools/qringbuffer.cpp \
../../corelib/tools/qpoint.cpp \
../../corelib/tools/qrect.cpp \
../../corelib/tools/qsize.cpp \
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index f253c49995..d036c40f35 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -529,7 +529,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
return symbols;
}
-Symbols Preprocessor::macroExpand(Preprocessor *that, Symbols &toExpand, int &index,
+void Preprocessor::macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, int &index,
int lineNum, bool one, const QSet<QByteArray> &excludeSymbols)
{
SymbolStack symbols;
@@ -539,16 +539,18 @@ Symbols Preprocessor::macroExpand(Preprocessor *that, Symbols &toExpand, int &in
sf.excludedSymbols = excludeSymbols;
symbols.push(sf);
- Symbols result;
if (toExpand.isEmpty())
- return result;
+ return;
for (;;) {
QByteArray macro;
Symbols newSyms = macroExpandIdentifier(that, symbols, lineNum, &macro);
if (macro.isEmpty()) {
- result += newSyms;
+ // not a macro
+ Symbol s = symbols.symbol();
+ s.lineNum = lineNum;
+ *into += s;
} else {
SafeSymbols sf;
sf.symbols = newSyms;
@@ -565,8 +567,6 @@ Symbols Preprocessor::macroExpand(Preprocessor *that, Symbols &toExpand, int &in
index = symbols.top().index;
else
index = toExpand.size();
-
- return result;
}
@@ -576,10 +576,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
// not a macro
if (s.token != PP_IDENTIFIER || !that->macros.contains(s) || symbols.dontReplaceSymbol(s.lexem())) {
- Symbols syms;
- syms += s;
- syms.last().lineNum = lineNum;
- return syms;
+ return Symbols();
}
const Macro &macro = that->macros.value(s);
@@ -600,7 +597,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
syms.last().lineNum = lineNum;
return syms;
}
- QList<Symbols> arguments;
+ QVarLengthArray<Symbols, 5> arguments;
while (symbols.hasNext()) {
Symbols argument;
// strip leading space
@@ -653,7 +650,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
if (i == macro.symbols.size() - 1 || macro.symbols.at(i + 1).token != PP_HASHHASH) {
Symbols arg = arguments.at(index);
int idx = 1;
- expansion += macroExpand(that, arg, idx, lineNum, false, symbols.excludeSymbols());
+ macroExpand(&expansion, that, arg, idx, lineNum, false, symbols.excludeSymbols());
} else {
expansion += arguments.at(index);
}
@@ -726,7 +723,7 @@ void Preprocessor::substituteUntilNewline(Symbols &substituted)
while (hasNext()) {
Token token = next();
if (token == PP_IDENTIFIER) {
- substituted += macroExpand(this, symbols, index, symbol().lineNum, true);
+ macroExpand(&substituted, this, symbols, index, symbol().lineNum, true);
} else if (token == PP_DEFINED) {
bool braces = test(PP_LPAREN);
next(PP_IDENTIFIER);
@@ -1148,7 +1145,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
}
case PP_IDENTIFIER: {
// substitute macros
- preprocessed += macroExpand(this, symbols, index, symbol().lineNum, true);
+ macroExpand(&preprocessed, this, symbols, index, symbol().lineNum, true);
continue;
}
case PP_HASH:
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index 28691d316b..9c81f86f9c 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -76,7 +76,7 @@ public:
void substituteUntilNewline(Symbols &substituted);
static Symbols macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName);
- static Symbols macroExpand(Preprocessor *that, Symbols &toExpand, int &index, int lineNum, bool one,
+ static void macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, int &index, int lineNum, bool one,
const QSet<QByteArray> &excludeSymbols = QSet<QByteArray>());
int evaluateCondition();
diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h
index 13f9ada606..5f442e75ed 100644
--- a/src/tools/moc/symbols.h
+++ b/src/tools/moc/symbols.h
@@ -113,8 +113,11 @@ struct Symbol
Token token;
inline QByteArray lexem() const { return lex.mid(from, len); }
inline QByteArray unquotedLexem() const { return lex.mid(from+1, len-2); }
- inline operator QByteArray() const { return lex.mid(from, len); }
inline operator SubArray() const { return SubArray(lex, from, len); }
+ bool operator==(const Symbol& o) const
+ {
+ return SubArray(lex, from, len) == SubArray(o.lex, o.from, o.len);
+ }
QByteArray lex;
int from, len;
@@ -130,6 +133,7 @@ struct SafeSymbols {
QSet<QByteArray> excludedSymbols;
int index;
};
+Q_DECLARE_TYPEINFO(SafeSymbols, Q_MOVABLE_TYPE);
class SymbolStack : public QStack<SafeSymbols>
{
diff --git a/src/tools/qdoc/atom.cpp b/src/tools/qdoc/atom.cpp
index 745da21b30..f50f401c5b 100644
--- a/src/tools/qdoc/atom.cpp
+++ b/src/tools/qdoc/atom.cpp
@@ -64,10 +64,8 @@ QT_BEGIN_NAMESPACE
\also Text
*/
-/*! \enum Atom::Type
+/*! \enum Atom::AtomType
- \value AbstractLeft
- \value AbstractRight
\value AnnotatedList
\value AutoLink
\value BaseName
@@ -149,8 +147,6 @@ static const struct {
const char *english;
int no;
} atms[] = {
- { "AbstractLeft", Atom::AbstractLeft },
- { "AbstractRight", Atom::AbstractRight },
{ "AnnotatedList", Atom::AnnotatedList },
{ "AutoLink", Atom::AutoLink },
{ "BaseName", Atom::BaseName },
@@ -237,27 +233,27 @@ static const struct {
{ 0, 0 }
};
-/*! \fn Atom::Atom(Type type, const QString& string)
+/*! \fn Atom::Atom(AtomType type, const QString& string)
Constructs an atom of the specified \a type with the single
parameter \a string and does not put the new atom in a list.
*/
-/*! \fn Atom::Atom(Type type, const QString& p1, const QString& p2)
+/*! \fn Atom::Atom(AtomType type, const QString& p1, const QString& p2)
Constructs an atom of the specified \a type with the two
parameters \a p1 and \a p2 and does not put the new atom
in a list.
*/
-/*! \fn Atom(Atom *previous, Type type, const QString& string)
+/*! \fn Atom(Atom *previous, AtomType type, const QString& string)
Constructs an atom of the specified \a type with the single
parameter \a string and inserts the new atom into the list
after the \a previous atom.
*/
-/*! \fn Atom::Atom(Atom* previous, Type type, const QString& p1, const QString& p2)
+/*! \fn Atom::Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
Constructs an atom of the specified \a type with the two
parameters \a p1 and \a p2 and inserts the new atom into
@@ -289,19 +285,19 @@ static const struct {
*/
/*!
- Return the next Atom in the list if it is of Type \a t.
+ Return the next Atom in the list if it is of AtomType \a t.
Otherwise return 0.
*/
-const Atom* Atom::next(Type t) const
+const Atom* Atom::next(AtomType t) const
{
return (next_ && (next_->type() == t)) ? next_ : 0;
}
/*!
- Return the next Atom in the list if it is of Type \a t
+ Return the next Atom in the list if it is of AtomType \a t
and its string part is \a s. Otherwise return 0.
*/
-const Atom* Atom::next(Type t, const QString& s) const
+const Atom* Atom::next(AtomType t, const QString& s) const
{
return (next_ && (next_->type() == t) && (next_->string() == s)) ? next_ : 0;
}
@@ -311,7 +307,7 @@ const Atom* Atom::next(Type t, const QString& s) const
\also type(), string()
*/
-/*! \fn Type Atom::type() const
+/*! \fn AtomType Atom::type() const
Return the type of this atom.
\also string(), next()
*/
diff --git a/src/tools/qdoc/atom.h b/src/tools/qdoc/atom.h
index ebbba8917e..86b8ba7b3c 100644
--- a/src/tools/qdoc/atom.h
+++ b/src/tools/qdoc/atom.h
@@ -46,9 +46,7 @@ class LinkAtom;
class Atom
{
public:
- enum Type {
- AbstractLeft,
- AbstractRight,
+ enum AtomType {
AnnotatedList,
AutoLink,
BaseName,
@@ -143,13 +141,13 @@ public:
strs << string;
}
- Atom(Type type, const QString& string = "")
+ Atom(AtomType type, const QString& string = "")
: next_(0), type_(type)
{
strs << string;
}
- Atom(Type type, const QString& p1, const QString& p2)
+ Atom(AtomType type, const QString& p1, const QString& p2)
: next_(0), type_(type)
{
strs << p1;
@@ -157,14 +155,14 @@ public:
strs << p2;
}
- Atom(Atom* previous, Type type, const QString& string = "")
+ Atom(Atom* previous, AtomType type, const QString& string = "")
: next_(previous->next_), type_(type)
{
strs << string;
previous->next_ = this;
}
- Atom(Atom* previous, Type type, const QString& p1, const QString& p2)
+ Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
: next_(previous->next_), type_(type)
{
strs << p1;
@@ -183,9 +181,9 @@ public:
void setNext(Atom* newNext) { next_ = newNext; }
const Atom* next() const { return next_; }
- const Atom* next(Type t) const;
- const Atom* next(Type t, const QString& s) const;
- Type type() const { return type_; }
+ const Atom* next(AtomType t) const;
+ const Atom* next(AtomType t, const QString& s) const;
+ AtomType type() const { return type_; }
QString typeString() const;
const QString& string() const { return strs[0]; }
const QString& string(int i) const { return strs[i]; }
@@ -197,14 +195,14 @@ public:
virtual Node::Genus genus() { return Node::DontCare; }
virtual bool specifiesDomain() { return false; }
virtual Tree* domain() { return 0; }
- virtual Node::Type goal() { return Node::NoType; }
+ virtual Node::NodeType goal() { return Node::NoType; }
virtual const QString& error() { return noError_; }
virtual void resolveSquareBracketParams() { }
protected:
static QString noError_;
Atom* next_;
- Type type_;
+ AtomType type_;
QStringList strs;
};
@@ -220,14 +218,14 @@ class LinkAtom : public Atom
virtual Node::Genus genus() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return genus_; }
virtual bool specifiesDomain() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return (domain_ != 0); }
virtual Tree* domain() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return domain_; }
- virtual Node::Type goal() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return goal_; }
+ virtual Node::NodeType goal() Q_DECL_OVERRIDE { resolveSquareBracketParams(); return goal_; }
virtual const QString& error() Q_DECL_OVERRIDE { return error_; }
virtual void resolveSquareBracketParams() Q_DECL_OVERRIDE;
protected:
bool resolved_;
Node::Genus genus_;
- Node::Type goal_;
+ Node::NodeType goal_;
Tree* domain_;
QString error_;
QString squareBracketParams_;
diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp
index 2253aca183..458799fc27 100644
--- a/src/tools/qdoc/codemarker.cpp
+++ b/src/tools/qdoc/codemarker.cpp
@@ -194,6 +194,22 @@ QString CodeMarker::protect(const QString& str)
return marked;
}
+void CodeMarker::appendProtectedString(QString *output, const QStringRef &str)
+{
+ int n = str.length();
+ output->reserve(output->size() + n * 2 + 30);
+ const QChar *data = str.constData();
+ for (int i = 0; i != n; ++i) {
+ switch (data[i].unicode()) {
+ case '&': *output += samp; break;
+ case '<': *output += slt; break;
+ case '>': *output += sgt; break;
+ case '"': *output += squot; break;
+ default : *output += data[i];
+ }
+ }
+}
+
QString CodeMarker::typified(const QString &string)
{
QString result;
@@ -361,8 +377,7 @@ QString CodeMarker::sortName(const Node *node, const QString* name)
else
sortNo = QLatin1String("E");
}
- return sortNo + nodeName + QLatin1Char(' ')
- + QString::number(func->overloadNumber(), 36);
+ return sortNo + nodeName + QLatin1Char(' ') + QString::number(func->overloadNumber(), 36);
}
if (node->type() == Node::Class)
@@ -390,7 +405,7 @@ void CodeMarker::insert(FastSection &fastSection,
bool irrelevant = false;
bool inheritedMember = false;
if (!node->relates()) {
- InnerNode* p = node->parent();
+ Aggregate* p = node->parent();
if (p->isQmlPropertyGroup())
p = p->parent();
if (p != fastSection.parent_) {
@@ -440,7 +455,7 @@ void CodeMarker::insert(FastSection &fastSection,
if (node->parent()->isClass() || node->parent()->isNamespace()) {
if (fastSection.inherited.isEmpty()
|| fastSection.inherited.last().first != node->parent()) {
- QPair<InnerNode *, int> p(node->parent(), 0);
+ QPair<Aggregate *, int> p(node->parent(), 0);
fastSection.inherited.append(p);
}
fastSection.inherited.last().second++;
diff --git a/src/tools/qdoc/codemarker.h b/src/tools/qdoc/codemarker.h
index 7983aa532c..31a9f3a254 100644
--- a/src/tools/qdoc/codemarker.h
+++ b/src/tools/qdoc/codemarker.h
@@ -64,7 +64,7 @@ struct Section
QStringList keys;
NodeList members;
NodeList reimpMembers;
- QList<QPair<InnerNode *, int> > inherited;
+ QList<QPair<Aggregate *, int> > inherited;
ClassKeysNodesList classKeysNodesList_;
Section() { }
@@ -83,7 +83,7 @@ struct Section
struct FastSection
{
- const InnerNode *parent_;
+ const Aggregate *parent_;
QString name;
QString divClass;
QString singularMember;
@@ -91,9 +91,9 @@ struct FastSection
QMultiMap<QString, Node *> memberMap;
QMultiMap<QString, Node *> reimpMemberMap;
ClassMapList classMapList_;
- QList<QPair<InnerNode *, int> > inherited;
+ QList<QPair<Aggregate *, int> > inherited;
- FastSection(const InnerNode *parent,
+ FastSection(const Aggregate *parent,
const QString& name0,
const QString& divClass0,
const QString& singularMember0,
@@ -127,7 +127,7 @@ public:
virtual bool recognizeCode(const QString& code) = 0;
virtual bool recognizeExtension(const QString& ext) = 0;
virtual bool recognizeLanguage(const QString& lang) = 0;
- virtual Atom::Type atomType() const = 0;
+ virtual Atom::AtomType atomType() const = 0;
virtual QString markedUpCode(const QString& code,
const Node *relative,
const Location &location) = 0;
@@ -143,7 +143,7 @@ public:
virtual QString markedUpIncludes(const QStringList& includes) = 0;
virtual QString functionBeginRegExp(const QString& funcName) = 0;
virtual QString functionEndRegExp(const QString& funcName) = 0;
- virtual QList<Section> sections(const InnerNode *inner,
+ virtual QList<Section> sections(const Aggregate *inner,
SynopsisStyle style,
Status status) = 0;
virtual QList<Section> qmlSections(QmlTypeNode* qmlTypeNode,
@@ -163,7 +163,8 @@ public:
protected:
virtual QString sortName(const Node *node, const QString* name = 0);
- QString protect(const QString &string);
+ static QString protect(const QString &string);
+ static void appendProtectedString(QString *output, const QStringRef &str);
QString taggedNode(const Node* node);
QString taggedQmlNode(const Node* node);
QString linkTag(const Node *node, const QString& body);
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp
index a99a446cc2..92a0d52129 100644
--- a/src/tools/qdoc/codeparser.cpp
+++ b/src/tools/qdoc/codeparser.cpp
@@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE
#define COMMAND_THREADSAFE Doc::alias(QLatin1String("threadsafe"))
#define COMMAND_TITLE Doc::alias(QLatin1String("title"))
#define COMMAND_WRAPPER Doc::alias(QLatin1String("wrapper"))
+#define COMMAND_NOAUTOLIST Doc::alias(QLatin1String("noautolist"))
QList<CodeParser *> CodeParser::parsers;
bool CodeParser::showInternal_ = false;
@@ -219,8 +220,9 @@ const QSet<QString>& CodeParser::commonMetaCommands()
<< COMMAND_THREADSAFE
<< COMMAND_TITLE
<< COMMAND_WRAPPER
- << COMMAND_INJSMODULE;
- }
+ << COMMAND_INJSMODULE
+ << COMMAND_NOAUTOLIST;
+ }
return commonMetaCommands_;
}
@@ -317,6 +319,9 @@ void CodeParser::processCommonMetaCommand(const Location& location,
location.warning(tr("Command '\\%1' is only meanigfule in '\\module' and '\\qmlmodule'.")
.arg(COMMAND_QTVARIABLE));
}
+ else if (command == COMMAND_NOAUTOLIST) {
+ node->setNoAutoList(true);
+ }
}
/*!
@@ -423,33 +428,6 @@ void CodeParser::checkModuleInclusion(Node* n)
.arg(n->name()).arg(Generator::defaultModuleName()));
}
break;
-#if 0
- case Node::Document:
- if (n->access() != Node::Private && !n->doc().isEmpty()) {
- if (n->subType() == Node::HeaderFile) {
-#if 0
- n->doc().location().warning(tr("Header file with title \"%1\" has no \\inmodule command; "
- "using project name by default: %2")
- .arg(n->title()).arg(Generator::defaultModuleName()));
-#endif
- }
- else if (n->subType() == Node::Page) {
-#if 0
- n->doc().location().warning(tr("Page with title \"%1\" has no \\inmodule command; "
- "using project name by default: %2")
- .arg(n->title()).arg(Generator::defaultModuleName()));
-#endif
- }
- else if (n->subType() == Node::Example) {
-#if 0
- n->doc().location().warning(tr("Example with title \"%1\" has no \\inmodule command; "
- "using project name by default: %2")
- .arg(n->title()).arg(Generator::defaultModuleName()));
-#endif
- }
- }
- break;
-#endif
default:
break;
}
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index 606bb1c619..beb0bae291 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -91,6 +91,7 @@ QString ConfigStrings::OUTPUTENCODING = QStringLiteral("outputencoding");
QString ConfigStrings::OUTPUTLANGUAGE = QStringLiteral("outputlanguage");
QString ConfigStrings::OUTPUTFORMATS = QStringLiteral("outputformats");
QString ConfigStrings::OUTPUTPREFIXES = QStringLiteral("outputprefixes");
+QString ConfigStrings::OUTPUTSUFFIXES = QStringLiteral("outputsuffixes");
QString ConfigStrings::PROJECT = QStringLiteral("project");
QString ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL = QStringLiteral("redirectdocumentationtodevnull");
QString ConfigStrings::QHP = QStringLiteral("qhp");
@@ -134,6 +135,7 @@ public:
QStringList accum;
QStringList next;
};
+Q_DECLARE_TYPEINFO(MetaStackEntry, Q_MOVABLE_TYPE);
/*!
Start accumulating values in a list by appending an empty
@@ -912,8 +914,10 @@ QStringList Config::loadMaster(const QString& fileName)
*/
void Config::load(Location location, const QString& fileName)
{
- pushWorkingDir(QFileInfo(fileName).path());
- QDir::setCurrent(QFileInfo(fileName).path());
+ QFileInfo fileInfo(fileName);
+ QString path = fileInfo.canonicalPath();
+ pushWorkingDir(path);
+ QDir::setCurrent(path);
QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*"));
#define SKIP_CHAR() \
@@ -935,7 +939,7 @@ void Config::load(Location location, const QString& fileName)
if (location.depth() > 16)
location.fatal(tr("Too many nested includes"));
- QFile fin(fileName);
+ QFile fin(fileInfo.fileName());
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
@@ -1030,7 +1034,7 @@ void Config::load(Location location, const QString& fileName)
/*
Here is the recursive call.
*/
- load(location, QFileInfo(QFileInfo(fileName).dir(), includeFile).filePath());
+ load(location, QFileInfo(QDir(path), includeFile).filePath());
}
else {
/*
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
index 802bcf929d..8d6a124bd1 100644
--- a/src/tools/qdoc/config.h
+++ b/src/tools/qdoc/config.h
@@ -203,6 +203,7 @@ struct ConfigStrings
static QString OUTPUTLANGUAGE;
static QString OUTPUTFORMATS;
static QString OUTPUTPREFIXES;
+ static QString OUTPUTSUFFIXES;
static QString PROJECT;
static QString REDIRECTDOCUMENTATIONTODEVNULL;
static QString QHP;
@@ -278,6 +279,7 @@ struct ConfigStrings
#define CONFIG_OUTPUTLANGUAGE ConfigStrings::OUTPUTLANGUAGE
#define CONFIG_OUTPUTFORMATS ConfigStrings::OUTPUTFORMATS
#define CONFIG_OUTPUTPREFIXES ConfigStrings::OUTPUTPREFIXES
+#define CONFIG_OUTPUTSUFFIXES ConfigStrings::OUTPUTSUFFIXES
#define CONFIG_PROJECT ConfigStrings::PROJECT
#define CONFIG_REDIRECTDOCUMENTATIONTODEVNULL ConfigStrings::REDIRECTDOCUMENTATIONTODEVNULL
#define CONFIG_QHP ConfigStrings::QHP
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 4c1e84fe3c..868b249290 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -103,7 +103,7 @@ bool CppCodeMarker::recognizeLanguage(const QString &lang)
/*!
Returns the type of atom used to represent C++ code in the documentation.
*/
-Atom::Type CppCodeMarker::atomType() const
+Atom::AtomType CppCodeMarker::atomType() const
{
return Atom::Code;
}
@@ -436,7 +436,7 @@ QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */)
return "^\\}$";
}
-QList<Section> CppCodeMarker::sections(const InnerNode *inner,
+QList<Section> CppCodeMarker::sections(const Aggregate *inner,
SynopsisStyle style,
Status status)
{
@@ -522,10 +522,10 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
++r;
}
- QStack<const InnerNode *> stack;
+ QStack<const Aggregate *> stack;
stack.push(inner);
while (!stack.isEmpty()) {
- const InnerNode* ancestor = stack.pop();
+ const Aggregate* ancestor = stack.pop();
NodeList::ConstIterator c = ancestor->childNodes().constBegin();
while (c != ancestor->childNodes().constEnd()) {
@@ -537,11 +537,9 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
isSlot = (func->metaness() == FunctionNode::Slot);
isSignal = (func->metaness() == FunctionNode::Signal);
isStatic = func->isStatic();
- if (func->associatedProperty()) {
- if (func->associatedProperty()->status() == Node::Obsolete) {
- ++c;
- continue;
- }
+ if (func->hasAssociatedProperties() && !func->hasActiveAssociatedProperty()) {
+ ++c;
+ continue;
}
}
else if ((*c)->type() == Node::Variable) {
@@ -685,7 +683,7 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
}
else if ((*c)->type() == Node::Function) {
FunctionNode *function = static_cast<FunctionNode *>(*c);
- if (!function->associatedProperty())
+ if (!function->hasAssociatedProperties() || !function->doc().isEmpty())
insert(memberFunctions, function, style, status);
}
++c;
@@ -701,11 +699,11 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
else {
FastSection all(inner,QString(),QString(),"member","members");
- QStack<const InnerNode*> stack;
+ QStack<const Aggregate*> stack;
stack.push(inner);
while (!stack.isEmpty()) {
- const InnerNode* ancestor = stack.pop();
+ const Aggregate* ancestor = stack.pop();
NodeList::ConstIterator c = ancestor->childNodes().constBegin();
while (c != ancestor->childNodes().constEnd()) {
if ((*c)->access() != Node::Private && (*c)->type() != Node::Property)
@@ -812,8 +810,8 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
if (!ns->orphans().isEmpty()) {
foreach (Node* n, ns->orphans()) {
// Use inner as a temporary parent when inserting orphans
- InnerNode* p = n->parent();
- n->setParent(const_cast<InnerNode*>(inner));
+ Aggregate* p = n->parent();
+ n->setParent(const_cast<Aggregate*>(inner));
if (n->isClass())
insert(classes, n, style, status);
else if (n->isNamespace())
@@ -895,8 +893,8 @@ QString CppCodeMarker::addMarkUp(const QString &in,
ch = (i < (int)code.length()) ? code[i++].cell() : EOF
QString code = in;
- QStringList out;
- QString text;
+ QString out;
+ QStringRef text;
int braceDepth = 0;
int parenDepth = 0;
int i = 0;
@@ -931,8 +929,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
} else if (keywords.contains(ident)) {
tag = QStringLiteral("keyword");
} else if (braceDepth == 0 && parenDepth == 0) {
- if (QString(code.unicode() + i - 1, code.length() - (i - 1))
- .indexOf(findFunctionRegExp) == 0)
+ if (code.indexOf(findFunctionRegExp, i - 1) == i - 1)
tag = QStringLiteral("func");
target = true;
}
@@ -1071,27 +1068,34 @@ QString CppCodeMarker::addMarkUp(const QString &in,
}
}
- text = code.mid(start, finish - start);
+ text = code.midRef(start, finish - start);
start = finish;
if (!tag.isEmpty()) {
- out << QStringLiteral("<@") << tag;
- if (target)
- out << QStringLiteral(" target=\"") << text << QStringLiteral("()\"");
- out << QStringLiteral(">");
+ out += QStringLiteral("<@");
+ out += tag;
+ if (target) {
+ out += QStringLiteral(" target=\"");
+ out += text;
+ out += QStringLiteral("()\"");
+ }
+ out += QStringLiteral(">");
}
- out << protect(text);
+ appendProtectedString(&out, text);
- if (!tag.isEmpty())
- out << QStringLiteral("</@") << tag << QStringLiteral(">");
+ if (!tag.isEmpty()) {
+ out += QStringLiteral("</@");
+ out += tag;
+ out += QStringLiteral(">");
+ }
}
if (start < code.length()) {
- out << protect(code.mid(start));
+ appendProtectedString(&out, code.midRef(start));
}
- return out.join(QString());
+ return out;
}
/*!
diff --git a/src/tools/qdoc/cppcodemarker.h b/src/tools/qdoc/cppcodemarker.h
index 509d130a27..aa759f2993 100644
--- a/src/tools/qdoc/cppcodemarker.h
+++ b/src/tools/qdoc/cppcodemarker.h
@@ -53,7 +53,7 @@ public:
virtual bool recognizeCode(const QString& code) Q_DECL_OVERRIDE;
virtual bool recognizeExtension(const QString& ext) Q_DECL_OVERRIDE;
virtual bool recognizeLanguage(const QString& lang) Q_DECL_OVERRIDE;
- virtual Atom::Type atomType() const Q_DECL_OVERRIDE;
+ virtual Atom::AtomType atomType() const Q_DECL_OVERRIDE;
virtual QString markedUpCode(const QString& code,
const Node *relative,
const Location &location) Q_DECL_OVERRIDE;
@@ -67,7 +67,7 @@ public:
virtual QString markedUpIncludes(const QStringList& includes) Q_DECL_OVERRIDE;
virtual QString functionBeginRegExp(const QString& funcName) Q_DECL_OVERRIDE;
virtual QString functionEndRegExp(const QString& funcName) Q_DECL_OVERRIDE;
- virtual QList<Section> sections(const InnerNode *innerNode,
+ virtual QList<Section> sections(const Aggregate *innerNode,
SynopsisStyle style,
Status status) Q_DECL_OVERRIDE;
virtual QList<Section> qmlSections(QmlTypeNode* qmlTypeNode,
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index f12fb70227..cab416370a 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
/* qmake ignore Q_OBJECT */
static bool inMacroCommand_ = false;
+static bool parsingHeaderFile_ = false;
QStringList CppCodeParser::exampleFiles;
QStringList CppCodeParser::exampleDirs;
@@ -166,7 +167,9 @@ void CppCodeParser::parseHeaderFile(const Location& location, const QString& fil
Tokenizer fileTokenizer(fileLocation, in);
tokenizer = &fileTokenizer;
readToken();
+ parsingHeaderFile_ = true;
matchDeclList(qdb_->primaryTreeRoot());
+ parsingHeaderFile_ = false;
if (!fileTokenizer.version().isEmpty())
qdb_->setVersion(fileTokenizer.version());
in.close();
@@ -250,16 +253,11 @@ void CppCodeParser::doneParsingHeaderFiles()
/*!
This is called after all the source files (i.e., not the
- header files) have been parsed. It traverses the tree to
- resolve property links, normalize overload signatures, and
- do other housekeeping of the database.
+ header files) have been parsed. Currently nothing to do.
*/
void CppCodeParser::doneParsingSourceFiles()
{
- qdb_->primaryTreeRoot()->normalizeOverloads();
- qdb_->fixInheritance();
- qdb_->resolveProperties();
- qdb_->primaryTreeRoot()->makeUndocumentedChildrenInternal();
+ // contents moved to QdocDatabase::resolveIssues()
}
static QSet<QString> topicCommands_;
@@ -408,7 +406,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
this way to allow the writer to refer to the entity
without including the namespace qualifier.
*/
- Node::Type type = nodeTypeMap[command];
+ Node::NodeType type = nodeTypeMap[command];
QStringList paths = arg.first.split(QLatin1Char(' '));
QStringList path = paths[0].split("::");
Node *node = 0;
@@ -422,7 +420,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
lastPath_ = path;
}
- else if (node->isInnerNode()) {
+ else if (node->isAggregate()) {
if (type == Node::Namespace) {
NamespaceNode* ns = static_cast<NamespaceNode*>(node);
ns->markSeen();
@@ -520,16 +518,6 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
else if (t == "ditamap")
ptype = Node::DitaMapPage;
}
-
-#if 0
- const Node* n = qdb_->checkForCollision(args[0]);
- if (n) {
- QString other = n->doc().location().fileName();
- doc.location().warning(tr("Name/title collision detected: '%1' in '\\%2'")
- .arg(args[0]).arg(command),
- tr("Also used here: %1").arg(other));
- }
-#endif
DocumentNode* dn = 0;
if (ptype == Node::DitaMapPage)
dn = new DitaMapNode(qdb_->primaryTreeRoot(), args[0]);
@@ -572,7 +560,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
QmlTypeNode* qmlType = qdb_->findQmlType(module, qmlTypeName);
if (qmlType) {
bool attached = false;
- Node::Type nodeType = Node::QmlMethod;
+ Node::NodeType nodeType = Node::QmlMethod;
if ((command == COMMAND_QMLSIGNAL) ||
(command == COMMAND_JSSIGNAL))
nodeType = Node::QmlSignal;
@@ -870,7 +858,8 @@ const QSet<QString>& CppCodeParser::otherMetaCommands()
<< COMMAND_QMLINSTANTIATES
<< COMMAND_QMLDEFAULT
<< COMMAND_QMLREADONLY
- << COMMAND_QMLABSTRACT;
+ << COMMAND_QMLABSTRACT
+ << COMMAND_ABSTRACT;
}
return otherMetaCommands_;
}
@@ -887,22 +876,18 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
{
QString arg = argLocPair.first;
if (command == COMMAND_INHEADERFILE) {
- if (node != 0 && node->isInnerNode()) {
- ((InnerNode *) node)->addInclude(arg);
+ if (node != 0 && node->isAggregate()) {
+ ((Aggregate *) node)->addInclude(arg);
}
else {
- doc.location().warning(tr("Ignored '\\%1'")
- .arg(COMMAND_INHEADERFILE));
+ doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
}
}
else if (command == COMMAND_OVERLOAD) {
- if (node != 0 && node->type() == Node::Function) {
- ((FunctionNode *) node)->setOverload(true);
- }
- else {
- doc.location().warning(tr("Ignored '\\%1'")
- .arg(COMMAND_OVERLOAD));
- }
+ if (node && node->isFunction())
+ ((FunctionNode *) node)->setOverloadFlag(true);
+ else
+ doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
}
else if (command == COMMAND_REIMP) {
if (node != 0 && node->parent() && !node->parent()->isInternal()) {
@@ -928,12 +913,10 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
"because its base function is private "
"or internal").arg(COMMAND_REIMP).arg(node->name()));
}
- func->setReimp(true);
+ func->setReimplemented(true);
}
else {
- doc.location().warning(tr("Ignored '\\%1' in %2")
- .arg(COMMAND_REIMP)
- .arg(node->name()));
+ doc.location().warning(tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
}
}
}
@@ -943,7 +926,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
if (!n)
doc.location().warning(tr("Cannot find '%1' in '\\%2'").arg(arg).arg(COMMAND_RELATES));
else
- node->setRelates(static_cast<InnerNode*>(n));
+ node->setRelates(static_cast<Aggregate*>(n));
}
else if (command == COMMAND_CONTENTSPAGE) {
setLink(node, Node::ContentsLink, arg);
@@ -1014,7 +997,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
}
}
}
- else if (command == COMMAND_QMLABSTRACT) {
+ else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
if (node->isQmlType() || node->isJsType())
node->setAbstract(true);
}
@@ -1051,7 +1034,7 @@ void CppCodeParser::reset()
tokenizer = 0;
tok = 0;
access = Node::Public;
- metaness = FunctionNode::Plain;
+ metaness_ = FunctionNode::Plain;
lastPath_.clear();
physicalModuleName.clear();
}
@@ -1096,8 +1079,7 @@ bool CppCodeParser::match(int target)
readToken();
return true;
}
- else
- return false;
+ return false;
}
/*!
@@ -1236,8 +1218,9 @@ bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var)
dataType->append(previousLexeme());
}
else if (match(Tok_void) || match(Tok_int) || match(Tok_char) ||
- match(Tok_double) || match(Tok_Ellipsis))
+ match(Tok_double) || match(Tok_Ellipsis)) {
dataType->append(previousLexeme());
+ }
else {
return false;
}
@@ -1323,37 +1306,72 @@ bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var)
return true;
}
-bool CppCodeParser::matchParameter(FunctionNode *func)
+/*!
+ Parse the next function parameter, if there is one, and
+ append it to parameter list \a p. Return true if a parameter
+ is parsed and appended to \a p. Otherwise return false.
+ */
+bool CppCodeParser::matchParameter(ParsedParameterList& pplist)
{
- CodeChunk dataType;
- QString name;
- CodeChunk defaultValue;
-
+ ParsedParameter pp;
if (match(Tok_QPrivateSignal)) {
- func->setPrivateSignal();
+ pp.qPrivateSignal_ = true;
+ pplist.append(pp);
return true;
}
- if (!matchDataType(&dataType, &name)) {
+ CodeChunk chunk;
+ if (!matchDataType(&chunk, &pp.name_)) {
return false;
}
+ pp.dataType_ = chunk.toString();
+ chunk.clear();
match(Tok_Comment);
if (match(Tok_Equal)) {
- int parenDepth0 = tokenizer->parenDepth();
-
- while (tokenizer->parenDepth() >= parenDepth0 &&
- (tok != Tok_Comma ||
- tokenizer->parenDepth() > parenDepth0) &&
+ int pdepth = tokenizer->parenDepth();
+ while (tokenizer->parenDepth() >= pdepth &&
+ (tok != Tok_Comma || (tokenizer->parenDepth() > pdepth)) &&
tok != Tok_Eoi) {
- defaultValue.append(lexeme());
+ chunk.append(lexeme());
readToken();
}
}
- func->addParameter(Parameter(dataType.toString(), "", name, defaultValue.toString())); // ###
+ pp.defaultValue_ = chunk.toString();
+ pplist.append(pp);
return true;
}
-bool CppCodeParser::matchFunctionDecl(InnerNode *parent,
+/*!
+ If the current token is any of several function modifiers,
+ return that token value after reading the next token. If it
+ is not one of the function modieifer tokens, return -1 but
+ don\t read the next token.
+ */
+int CppCodeParser::matchFunctionModifier()
+{
+ switch (tok) {
+ case Tok_friend:
+ case Tok_inline:
+ case Tok_explicit:
+ case Tok_static:
+ case Tok_QT_DEPRECATED:
+ readToken();
+ return tok;
+ case Tok_QT_COMPAT:
+ case Tok_QT_COMPAT_CONSTRUCTOR:
+ case Tok_QT_MOC_COMPAT:
+ case Tok_QT3_SUPPORT:
+ case Tok_QT3_SUPPORT_CONSTRUCTOR:
+ case Tok_QT3_MOC_SUPPORT:
+ readToken();
+ return Tok_QT_COMPAT;
+ default:
+ break;
+ }
+ return -1;
+}
+
+bool CppCodeParser::matchFunctionDecl(Aggregate *parent,
QStringList *parentPathPtr,
FunctionNode **funcPtr,
const QString &templateStuff,
@@ -1362,25 +1380,44 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent,
CodeChunk returnType;
QStringList parentPath;
QString name;
- bool compat = false;
- if (match(Tok_friend)) {
- return false;
- }
- match(Tok_explicit);
- if (matchCompat())
- compat = true;
- bool sta = false;
- if (match(Tok_static)) {
- sta = true;
- if (matchCompat())
- compat = true;
+ bool matched_QT_DEPRECATED = false;
+ bool matched_friend = false;
+ bool matched_static = false;
+ bool matched_inline = false;
+ bool matched_explicit = false;
+ bool matched_compat = false;
+
+ int token = tok;
+ while (token != -1) {
+ switch (token) {
+ case Tok_friend:
+ matched_friend = true;
+ break;
+ case Tok_inline:
+ matched_inline = true;
+ break;
+ case Tok_explicit:
+ matched_explicit = true;
+ break;
+ case Tok_static:
+ matched_static = true;
+ break;
+ case Tok_QT_DEPRECATED:
+ // no break here.
+ matched_QT_DEPRECATED = true;
+ case Tok_QT_COMPAT:
+ matched_compat = true;
+ break;
+ }
+ token = matchFunctionModifier();
}
- FunctionNode::Virtualness vir = FunctionNode::NonVirtual;
+
+ FunctionNode::Virtualness virtuality = FunctionNode::NonVirtual;
if (match(Tok_virtual)) {
- vir = FunctionNode::ImpureVirtual;
- if (matchCompat())
- compat = true;
+ virtuality = FunctionNode::NormalVirtual;
+ if (!matched_compat)
+ matched_compat = matchCompat();
}
if (!matchDataType(&returnType)) {
@@ -1397,8 +1434,8 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent,
if (returnType.toString() == "QBool")
returnType = CodeChunk("bool");
- if (matchCompat())
- compat = true;
+ if (!matched_compat)
+ matched_compat = matchCompat();
if (tok == Tok_operator &&
(returnType.toString().isEmpty() ||
@@ -1437,12 +1474,10 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent,
else {
while (match(Tok_Ident)) {
name = previousLexeme();
-
/*
This is a hack to let QML module identifiers through.
*/
matchModuleQualifier(name);
-
matchTemplateAngles();
if (match(Tok_Gulbrandsen))
@@ -1496,68 +1531,113 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent,
var->setLocation(location());
var->setLeftType(returnType.left());
var->setRightType(returnType.right());
- if (compat)
+ if (matched_compat)
var->setStatus(Node::Compat);
- var->setStatic(sta);
+ var->setStatic(matched_static);
return false;
}
- if (tok != Tok_LeftParen) {
+ if (tok != Tok_LeftParen)
return false;
- }
}
readToken();
- FunctionNode *func = new FunctionNode(extra.type, parent, name, extra.isAttached);
- func->setAccess(access);
- func->setLocation(location());
- func->setReturnType(returnType.toString());
- func->setParentPath(parentPath);
- func->setTemplateStuff(templateStuff);
- if (compat)
- func->setStatus(Node::Compat);
-
- func->setMetaness(metaness);
- if (parent) {
- if (name == parent->name()) {
- func->setMetaness(FunctionNode::Ctor);
- } else if (name.startsWith(QLatin1Char('~'))) {
- func->setMetaness(FunctionNode::Dtor);
- }
- }
- func->setStatic(sta);
-
+ // A left paren was seen. Parse the parameters
+ ParsedParameterList pplist;
if (tok != Tok_RightParen) {
do {
- if (!matchParameter(func)) {
+ if (!matchParameter(pplist))
return false;
- }
} while (match(Tok_Comma));
}
- if (!match(Tok_RightParen)) {
+ // The parameters must end with a right paren
+ if (!match(Tok_RightParen))
return false;
- }
- func->setConst(match(Tok_const));
+ // look for const
+ bool matchedConst = match(Tok_const);
+ // look for 0 indicating pure virtual
if (match(Tok_Equal) && match(Tok_Number))
- vir = FunctionNode::PureVirtual;
- func->setVirtualness(vir);
+ virtuality = FunctionNode::PureVirtual;
+ // look for colon indicating ctors which must be skipped
if (match(Tok_Colon)) {
while (tok != Tok_LeftBrace && tok != Tok_Eoi)
readToken();
}
+ // If no ';' expect a body, which must be skipped.
+ bool body_expected = false;
+ bool body_present = false;
if (!match(Tok_Semicolon) && tok != Tok_Eoi) {
- int braceDepth0 = tokenizer->braceDepth();
-
- if (!match(Tok_LeftBrace)) {
+ body_expected = true;
+ int nesting = tokenizer->braceDepth();
+ if (!match(Tok_LeftBrace))
return false;
- }
- while (tokenizer->braceDepth() >= braceDepth0 && tok != Tok_Eoi)
+ // skip the body
+ while (tokenizer->braceDepth() >= nesting && tok != Tok_Eoi)
readToken();
+ body_present = true;
match(Tok_RightBrace);
}
+
+ FunctionNode *func = 0;
+ bool createFunctionNode = false;
+ if (parsingHeaderFile_) {
+ if (matched_friend) {
+ if (matched_inline) {
+ // nothing yet
+ }
+ if (body_present) {
+ if (body_expected) {
+ // nothing yet
+ }
+ createFunctionNode = true;
+ if (parent && parent->parent())
+ parent = parent->parent();
+ else
+ return false;
+ }
+ }
+ else
+ createFunctionNode = true;
+ }
+ else
+ createFunctionNode = true;
+
+ if (createFunctionNode) {
+ func = new FunctionNode(extra.type, parent, name, extra.isAttached);
+ if (matched_friend)
+ access = Node::Public;
+ func->setAccess(access);
+ func->setLocation(location());
+ func->setReturnType(returnType.toString());
+ func->setParentPath(parentPath);
+ func->setTemplateStuff(templateStuff);
+ if (matched_compat)
+ func->setStatus(Node::Compat);
+ if (matched_QT_DEPRECATED)
+ func->setStatus(Node::Deprecated);
+ if (matched_explicit) { /* What can be done? */ }
+ func->setMetaness(metaness_);
+ if (parent) {
+ if (name == parent->name())
+ func->setMetaness(FunctionNode::Ctor);
+ else if (name.startsWith(QLatin1Char('~')))
+ func->setMetaness(FunctionNode::Dtor);
+ }
+ func->setStatic(matched_static);
+ func->setConst(matchedConst);
+ func->setVirtualness(virtuality);
+ if (!pplist.isEmpty()) {
+ foreach (const ParsedParameter& pp, pplist) {
+ if (pp.qPrivateSignal_)
+ func->setPrivateSignal();
+ else
+ func->addParameter(Parameter(pp.dataType_, "", pp.name_, pp.defaultValue_));
+ }
+ }
+ }
if (parentPathPtr != 0)
*parentPathPtr = parentPath;
if (funcPtr != 0)
@@ -1616,7 +1696,7 @@ bool CppCodeParser::matchBaseList(ClassNode *classe, bool isClass)
sufficient for Qt because there are no cases of class nesting more
than one level deep.
*/
-bool CppCodeParser::matchClassDecl(InnerNode *parent,
+bool CppCodeParser::matchClassDecl(Aggregate *parent,
const QString &templateStuff)
{
bool isClass = (tok == Tok_class);
@@ -1631,7 +1711,7 @@ bool CppCodeParser::matchClassDecl(InnerNode *parent,
if (tok == Tok_Gulbrandsen) {
Node* n = parent->findChildNode(previousLexeme(),Node::Class);
if (n) {
- parent = static_cast<InnerNode*>(n);
+ parent = static_cast<Aggregate*>(n);
if (parent) {
readToken();
if (tok != Tok_Ident)
@@ -1663,17 +1743,17 @@ bool CppCodeParser::matchClassDecl(InnerNode *parent,
Node::Access outerAccess = access;
access = isClass ? Node::Private : Node::Public;
- FunctionNode::Metaness outerMetaness = metaness;
- metaness = FunctionNode::Plain;
+ FunctionNode::Metaness outerMetaness = metaness_;
+ metaness_ = FunctionNode::Plain;
bool matches = (matchDeclList(classe) && match(Tok_RightBrace) &&
match(Tok_Semicolon));
access = outerAccess;
- metaness = outerMetaness;
+ metaness_ = outerMetaness;
return matches;
}
-bool CppCodeParser::matchNamespaceDecl(InnerNode *parent)
+bool CppCodeParser::matchNamespaceDecl(Aggregate *parent)
{
readToken(); // skip 'namespace'
if (tok != Tok_Ident)
@@ -1712,7 +1792,7 @@ bool CppCodeParser::matchNamespaceDecl(InnerNode *parent)
member function is added to \a parent as an unresolved
\c using clause.
*/
-bool CppCodeParser::matchUsingDecl(InnerNode* parent)
+bool CppCodeParser::matchUsingDecl(Aggregate* parent)
{
bool usingNamespace = false;
readToken(); // skip 'using'
@@ -1774,17 +1854,25 @@ bool CppCodeParser::matchUsingDecl(InnerNode* parent)
return true;
}
-bool CppCodeParser::matchEnumItem(InnerNode *parent, EnumNode *enume)
+bool CppCodeParser::matchEnumItem(Aggregate *parent, EnumNode *enume)
{
if (!match(Tok_Ident))
return false;
QString name = previousLexeme();
CodeChunk val;
+ int parenLevel = 0;
if (match(Tok_Equal)) {
- while (tok != Tok_Comma && tok != Tok_RightBrace &&
- tok != Tok_Eoi) {
+ while (tok != Tok_RightBrace && tok != Tok_Eoi) {
+ if (tok == Tok_LeftParen)
+ parenLevel++;
+ else if (tok == Tok_RightParen)
+ parenLevel--;
+ else if (tok == Tok_Comma) {
+ if (parenLevel <= 0)
+ break;
+ }
val.append(lexeme());
readToken();
}
@@ -1825,7 +1913,7 @@ bool CppCodeParser::matchEnumItem(InnerNode *parent, EnumNode *enume)
return true;
}
-bool CppCodeParser::matchEnumDecl(InnerNode *parent)
+bool CppCodeParser::matchEnumDecl(Aggregate *parent)
{
QString name;
@@ -1856,7 +1944,7 @@ bool CppCodeParser::matchEnumDecl(InnerNode *parent)
return match(Tok_RightBrace) && match(Tok_Semicolon);
}
-bool CppCodeParser::matchTypedefDecl(InnerNode *parent)
+bool CppCodeParser::matchTypedefDecl(Aggregate *parent)
{
CodeChunk dataType;
QString name;
@@ -1876,7 +1964,7 @@ bool CppCodeParser::matchTypedefDecl(InnerNode *parent)
return true;
}
-bool CppCodeParser::matchProperty(InnerNode *parent)
+bool CppCodeParser::matchProperty(Aggregate *parent)
{
int expected_tok = Tok_LeftParen;
if (match(Tok_Q_PRIVATE_PROPERTY)) {
@@ -1989,7 +2077,7 @@ bool CppCodeParser::matchProperty(InnerNode *parent)
/*!
Parse a C++ declaration.
*/
-bool CppCodeParser::matchDeclList(InnerNode *parent)
+bool CppCodeParser::matchDeclList(Aggregate *parent)
{
ExtraFuncData extra;
QString templateStuff;
@@ -2030,28 +2118,28 @@ bool CppCodeParser::matchDeclList(InnerNode *parent)
case Tok_private:
readToken();
access = Node::Private;
- metaness = FunctionNode::Plain;
+ metaness_ = FunctionNode::Plain;
break;
case Tok_protected:
readToken();
access = Node::Protected;
- metaness = FunctionNode::Plain;
+ metaness_ = FunctionNode::Plain;
break;
case Tok_public:
readToken();
access = Node::Public;
- metaness = FunctionNode::Plain;
+ metaness_ = FunctionNode::Plain;
break;
case Tok_signals:
case Tok_Q_SIGNALS:
readToken();
access = Node::Public;
- metaness = FunctionNode::Signal;
+ metaness_ = FunctionNode::Signal;
break;
case Tok_slots:
case Tok_Q_SLOTS:
readToken();
- metaness = FunctionNode::Slot;
+ metaness_ = FunctionNode::Slot;
break;
case Tok_Q_OBJECT:
readToken();
@@ -2069,29 +2157,25 @@ bool CppCodeParser::matchDeclList(InnerNode *parent)
case Tok_Q_DECLARE_SEQUENTIAL_ITERATOR:
readToken();
if (match(Tok_LeftParen) && match(Tok_Ident))
- sequentialIteratorClasses.insert(previousLexeme(),
- location().fileName());
+ sequentialIteratorClasses.insert(previousLexeme(), location().fileName());
match(Tok_RightParen);
break;
case Tok_Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR:
readToken();
if (match(Tok_LeftParen) && match(Tok_Ident))
- mutableSequentialIteratorClasses.insert(previousLexeme(),
- location().fileName());
+ mutableSequentialIteratorClasses.insert(previousLexeme(), location().fileName());
match(Tok_RightParen);
break;
case Tok_Q_DECLARE_ASSOCIATIVE_ITERATOR:
readToken();
if (match(Tok_LeftParen) && match(Tok_Ident))
- associativeIteratorClasses.insert(previousLexeme(),
- location().fileName());
+ associativeIteratorClasses.insert(previousLexeme(), location().fileName());
match(Tok_RightParen);
break;
case Tok_Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR:
readToken();
if (match(Tok_LeftParen) && match(Tok_Ident))
- mutableAssociativeIteratorClasses.insert(previousLexeme(),
- location().fileName());
+ mutableAssociativeIteratorClasses.insert(previousLexeme(), location().fileName());
match(Tok_RightParen);
break;
case Tok_Q_DECLARE_FLAGS:
@@ -2256,15 +2340,15 @@ bool CppCodeParser::matchDocsAndStuff()
processOtherMetaCommands(*d, *n);
(*n)->setDoc(*d);
checkModuleInclusion(*n);
- if ((*n)->isInnerNode() && ((InnerNode *)*n)->includes().isEmpty()) {
- InnerNode *m = static_cast<InnerNode *>(*n);
+ if ((*n)->isAggregate() && ((Aggregate *)*n)->includes().isEmpty()) {
+ Aggregate *m = static_cast<Aggregate *>(*n);
while (m->parent() && m->physicalModuleName().isEmpty()) {
m = m->parent();
}
if (m == *n)
- ((InnerNode *)*n)->addInclude((*n)->name());
+ ((Aggregate *)*n)->addInclude((*n)->name());
else
- ((InnerNode *)*n)->setIncludes(m->includes());
+ ((Aggregate *)*n)->setIncludes(m->includes());
}
++d;
++n;
@@ -2346,8 +2430,8 @@ bool CppCodeParser::makeFunctionNode(const QString& signature,
*/
FunctionNode* CppCodeParser::makeFunctionNode(const Doc& doc,
const QString& sig,
- InnerNode* parent,
- Node::Type type,
+ Aggregate* parent,
+ Node::NodeType type,
bool attached,
QString qdoctag)
{
diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h
index f9ddcab88c..733418e27a 100644
--- a/src/tools/qdoc/cppcodeparser.h
+++ b/src/tools/qdoc/cppcodeparser.h
@@ -44,20 +44,30 @@ class ClassNode;
class CodeChunk;
class CppCodeParserPrivate;
class FunctionNode;
-class InnerNode;
+class Aggregate;
class Tokenizer;
class CppCodeParser : public CodeParser
{
Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
+ struct ParsedParameter {
+ bool qPrivateSignal_;
+ QString dataType_;
+ QString name_;
+ QString defaultValue_;
+ ParsedParameter() : qPrivateSignal_(false) { }
+ };
+ friend class QTypeInfo<ParsedParameter>;
+ typedef QVector<ParsedParameter> ParsedParameterList;
+
struct ExtraFuncData {
- InnerNode* root; // Used as the parent.
- Node::Type type; // The node type: Function, etc.
+ Aggregate* root; // Used as the parent.
+ Node::NodeType type; // The node type: Function, etc.
bool isAttached; // If true, the method is attached.
bool isMacro; // If true, we are parsing a macro signature.
ExtraFuncData() : root(0), type(Node::Function), isAttached(false), isMacro(false) { }
- ExtraFuncData(InnerNode* r, Node::Type t, bool a)
+ ExtraFuncData(Aggregate* r, Node::NodeType t, bool a)
: root(r), type(t), isAttached(a), isMacro(false) { }
};
@@ -116,23 +126,23 @@ protected:
bool matchTemplateAngles(CodeChunk *type = 0);
bool matchTemplateHeader();
bool matchDataType(CodeChunk *type, QString *var = 0);
- bool matchParameter(FunctionNode *func);
- bool matchFunctionDecl(InnerNode *parent,
+ bool matchParameter(ParsedParameterList& pplist);
+ bool matchFunctionDecl(Aggregate *parent,
QStringList *parentPathPtr,
FunctionNode **funcPtr,
const QString &templateStuff,
ExtraFuncData& extra);
bool matchBaseSpecifier(ClassNode *classe, bool isClass);
bool matchBaseList(ClassNode *classe, bool isClass);
- bool matchClassDecl(InnerNode *parent,
+ bool matchClassDecl(Aggregate *parent,
const QString &templateStuff = QString());
- bool matchNamespaceDecl(InnerNode *parent);
- bool matchUsingDecl(InnerNode* parent);
- bool matchEnumItem(InnerNode *parent, EnumNode *enume);
- bool matchEnumDecl(InnerNode *parent);
- bool matchTypedefDecl(InnerNode *parent);
- bool matchProperty(InnerNode *parent);
- bool matchDeclList(InnerNode *parent);
+ bool matchNamespaceDecl(Aggregate *parent);
+ bool matchUsingDecl(Aggregate* parent);
+ bool matchEnumItem(Aggregate *parent, EnumNode *enume);
+ bool matchEnumDecl(Aggregate *parent);
+ bool matchTypedefDecl(Aggregate *parent);
+ bool matchProperty(Aggregate *parent);
+ bool matchDeclList(Aggregate *parent);
bool matchDocsAndStuff();
bool makeFunctionNode(const QString &synopsis,
QStringList *parentPathPtr,
@@ -140,8 +150,8 @@ protected:
ExtraFuncData& params);
FunctionNode* makeFunctionNode(const Doc& doc,
const QString& sig,
- InnerNode* parent,
- Node::Type type,
+ Aggregate* parent,
+ Node::NodeType type,
bool attached,
QString qdoctag);
void parseQiteratorDotH(const Location &location, const QString &filePath);
@@ -149,13 +159,14 @@ protected:
const QString &includeFile,
const QString &macroDef);
void createExampleFileNodes(DocumentNode *dn);
+ int matchFunctionModifier();
protected:
- QMap<QString, Node::Type> nodeTypeMap;
+ QMap<QString, Node::NodeType> nodeTypeMap;
Tokenizer *tokenizer;
int tok;
Node::Access access;
- FunctionNode::Metaness metaness;
+ FunctionNode::Metaness metaness_;
QString physicalModuleName;
QStringList lastPath_;
QRegExp varComment;
@@ -176,7 +187,9 @@ protected:
QString exampleNameFilter;
QString exampleImageFilter;
};
+Q_DECLARE_TYPEINFO(CppCodeParser::ParsedParameter, Q_MOVABLE_TYPE);
+#define COMMAND_ABSTRACT Doc::alias("abstract")
#define COMMAND_CLASS Doc::alias("class")
#define COMMAND_CONTENTSPAGE Doc::alias("contentspage")
#define COMMAND_DITAMAP Doc::alias("ditamap")
diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp
index 92c6d405de..4ed5894543 100644
--- a/src/tools/qdoc/doc.cpp
+++ b/src/tools/qdoc/doc.cpp
@@ -69,7 +69,6 @@ struct Macro
enum {
CMD_A,
- CMD_ABSTRACT,
CMD_ANNOTATEDLIST,
CMD_B,
CMD_BADCODE,
@@ -85,7 +84,6 @@ enum {
CMD_DOTS,
CMD_E,
CMD_ELSE,
- CMD_ENDABSTRACT,
CMD_ENDCHAPTER,
CMD_ENDCODE,
CMD_ENDDIV,
@@ -187,7 +185,6 @@ static struct {
QString *alias;
} cmds[] = {
{ "a", CMD_A, 0 },
- { "abstract", CMD_ABSTRACT, 0 },
{ "annotatedlist", CMD_ANNOTATEDLIST, 0 },
{ "b", CMD_B, 0 },
{ "badcode", CMD_BADCODE, 0 },
@@ -203,7 +200,6 @@ static struct {
{ "dots", CMD_DOTS, 0 },
{ "e", CMD_E, 0 },
{ "else", CMD_ELSE, 0 },
- { "endabstract", CMD_ENDABSTRACT, 0 },
{ "endchapter", CMD_ENDCHAPTER, 0 },
{ "endcode", CMD_ENDCODE, 0 },
{ "enddiv", CMD_ENDDIV, 0 },
@@ -312,7 +308,7 @@ public:
Doc::Sections granularity_;
Doc::Sections section_; // ###
QList<Atom*> tableOfContents_;
- QList<int> tableOfContentsLevels_;
+ QVector<int> tableOfContentsLevels_;
QList<Atom*> keywords_;
QList<Atom*> targets_;
QStringMultiMap metaMap_;
@@ -469,16 +465,16 @@ private:
void endSection(int unit, int endCmd);
void parseAlso();
void append(const QString &string);
- void append(Atom::Type type, const QString& string = QString());
- void append(Atom::Type type, const QString& p1, const QString& p2);
+ void append(Atom::AtomType type, const QString& string = QString());
+ void append(Atom::AtomType type, const QString& p1, const QString& p2);
void append(const QString& p1, const QString& p2);
void appendChar(QChar ch);
void appendWord(const QString &word);
void appendToCode(const QString &code);
- void appendToCode(const QString &code, Atom::Type defaultType);
+ void appendToCode(const QString &code, Atom::AtomType defaultType);
void startNewPara();
- void enterPara(Atom::Type leftType = Atom::ParaLeft,
- Atom::Type rightType = Atom::ParaRight,
+ void enterPara(Atom::AtomType leftType = Atom::ParaLeft,
+ Atom::AtomType rightType = Atom::ParaRight,
const QString& string = QString());
void leavePara();
void leaveValue();
@@ -525,8 +521,8 @@ private:
bool inTableRow;
bool inTableItem;
bool indexStartedPara; // ### rename
- Atom::Type pendingParaLeftType;
- Atom::Type pendingParaRightType;
+ Atom::AtomType pendingParaLeftType;
+ Atom::AtomType pendingParaRightType;
QString pendingParaString;
int braceDepth;
@@ -631,12 +627,6 @@ void DocParser::parse(const QString& source,
append(Atom::FormattingRight,ATOM_FORMATTING_PARAMETER);
priv->params.insert(p1);
break;
- case CMD_ABSTRACT:
- if (openCommand(cmd)) {
- leavePara();
- append(Atom::AbstractLeft);
- }
- break;
case CMD_BADCODE:
leavePara();
append(Atom::CodeBad,getCode(CMD_BADCODE, marker));
@@ -748,12 +738,6 @@ void DocParser::parse(const QString& source,
location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ELSE)));
}
break;
- case CMD_ENDABSTRACT:
- if (closeCommand(cmd)) {
- leavePara();
- append(Atom::AbstractRight);
- }
- break;
case CMD_ENDCHAPTER:
endSection(Doc::Chapter, cmd);
break;
@@ -1830,11 +1814,6 @@ bool DocParser::openCommand(int cmd)
if (outer == CMD_LIST) {
ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST);
}
- else if (outer == CMD_ABSTRACT) {
- ok = (cmd == CMD_LIST ||
- cmd == CMD_QUOTATION ||
- cmd == CMD_TABLE);
- }
else if (outer == CMD_SIDEBAR) {
ok = (cmd == CMD_LIST ||
cmd == CMD_QUOTATION ||
@@ -1984,9 +1963,9 @@ void DocParser::parseAlso()
}
}
-void DocParser::append(Atom::Type type, const QString &string)
+void DocParser::append(Atom::AtomType type, const QString &string)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
priv->text.lastAtom()->chopString();
priv->text << Atom(type, string);
@@ -1994,15 +1973,15 @@ void DocParser::append(Atom::Type type, const QString &string)
void DocParser::append(const QString &string)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
priv->text.lastAtom()->chopString();
priv->text << Atom(string); // The Atom type is Link.
}
-void DocParser::append(Atom::Type type, const QString& p1, const QString& p2)
+void DocParser::append(Atom::AtomType type, const QString& p1, const QString& p2)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
priv->text.lastAtom()->chopString();
priv->text << Atom(type, p1, p2);
@@ -2010,7 +1989,7 @@ void DocParser::append(Atom::Type type, const QString& p1, const QString& p2)
void DocParser::append(const QString& p1, const QString& p2)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
priv->text.lastAtom()->chopString();
if (p2.isEmpty())
@@ -2043,15 +2022,15 @@ void DocParser::appendWord(const QString &word)
void DocParser::appendToCode(const QString& markedCode)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
append(Atom::Qml);
priv->text.lastAtom()->appendString(markedCode);
}
-void DocParser::appendToCode(const QString &markedCode, Atom::Type defaultType)
+void DocParser::appendToCode(const QString &markedCode, Atom::AtomType defaultType)
{
- Atom::Type lastType = priv->text.lastAtom()->type();
+ Atom::AtomType lastType = priv->text.lastAtom()->type();
if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
append(defaultType, markedCode);
else
@@ -2064,8 +2043,8 @@ void DocParser::startNewPara()
enterPara();
}
-void DocParser::enterPara(Atom::Type leftType,
- Atom::Type rightType,
+void DocParser::enterPara(Atom::AtomType leftType,
+ Atom::AtomType rightType,
const QString& string)
{
if (paraState == OutsideParagraph) {
@@ -2674,8 +2653,6 @@ void DocParser::skipToNextPreprocessorCommand()
int DocParser::endCmdFor(int cmd)
{
switch (cmd) {
- case CMD_ABSTRACT:
- return CMD_ENDABSTRACT;
case CMD_BADCODE:
return CMD_ENDCODE;
case CMD_CHAPTER:
@@ -3110,7 +3087,7 @@ const QList<Atom *> &Doc::tableOfContents() const
return priv->extra->tableOfContents_;
}
-const QList<int> &Doc::tableOfContentsLevels() const
+const QVector<int> &Doc::tableOfContentsLevels() const
{
priv->constructExtra();
return priv->extra->tableOfContentsLevels_;
diff --git a/src/tools/qdoc/doc.h b/src/tools/qdoc/doc.h
index 80d47287bb..b064b5878e 100644
--- a/src/tools/qdoc/doc.h
+++ b/src/tools/qdoc/doc.h
@@ -168,7 +168,7 @@ public:
bool hasKeywords() const;
bool hasTargets() const;
const QList<Atom *> &tableOfContents() const;
- const QList<int> &tableOfContentsLevels() const;
+ const QVector<int> &tableOfContentsLevels() const;
const QList<Atom *> &keywords() const;
const QList<Atom *> &targets() const;
const QStringMultiMap &metaTagMap() const;
@@ -188,6 +188,7 @@ private:
DocPrivate *priv;
static const Config* config_;
};
+Q_DECLARE_TYPEINFO(Doc, Q_MOVABLE_TYPE);
typedef QList<Doc> DocList;
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/doc/examples/examples.qdoc b/src/tools/qdoc/doc/examples/examples.qdoc
index 777c869c65..ce67dea20e 100644
--- a/src/tools/qdoc/doc/examples/examples.qdoc
+++ b/src/tools/qdoc/doc/examples/examples.qdoc
@@ -89,10 +89,9 @@
\title UI Components
\brief Basic set of UI components
- This is a listing of a list of UI components implemented by QML types. These
-
- files are available for general import and they are based off the \l{Qt
- Quick Code Samples}.
+ This is a listing of a list of UI components implemented by QML types.
+ These files are available for general import and they are based off the
+ \e {Qt Quick Code Samples}.
This module is part of the \l{componentset}{UIComponents} example.
*/
diff --git a/src/tools/qdoc/doc/qdoc-guide/qdoc-guide.qdoc b/src/tools/qdoc/doc/qdoc-guide/qdoc-guide.qdoc
index a8c9c73b5c..af1fa1ba14 100644
--- a/src/tools/qdoc/doc/qdoc-guide/qdoc-guide.qdoc
+++ b/src/tools/qdoc/doc/qdoc-guide/qdoc-guide.qdoc
@@ -112,7 +112,7 @@
Specifying the path to the source directories allow QDoc to find sources and
generate documentation.
- \code
+ \badcode
sourcedirs = <path to source code>
exampledirs = <path to examples directory>
imagedirs = <path to image directory>
@@ -129,7 +129,7 @@
Likewise, QDoc needs the path to the output directory. The \c outputformats
variable determines the type of documentation. These variables should be
in separate configuration files to modularize the documentation build.
- \code
+ \badcode
outputdir = $SAMPLE_PROJECT/doc/html
outputformats = HTML
\endcode
@@ -144,8 +144,8 @@
the \l{Input and Output Directories}{output} directory. It is also possible
to specify extra files that QDoc should export.
- \code
- extraimages.HTML = extraImage.png \
+ \badcode
+ HTML.extraimages = extraImage.png \
extraImage2.png
\endcode
@@ -169,7 +169,7 @@
generated documentation into the directory specified by the \c outputdir
variable.
- \code
+ \badcode
outputformats = HTML
outputdir = <path to output directory>
\endcode
@@ -178,12 +178,12 @@
are located. Typically, the templates directory contains a \c scripts,
\c images, and a \c style directory, containing scripts and CSS files.
- \code
+ \badcode
HTML.templatedir = <path to templates>
\endcode
The main configuration variables are:
- \code
+ \badcode
HTML.postheader
HTML.postpostheader
HTML.postheader
@@ -210,7 +210,7 @@
documentation, QDoc does not need HTML style templates for generating
documentation in DITA XML format.
- \code
+ \badcode
outputformats = DITAXML
outputdir
\endcode
@@ -222,7 +222,7 @@
the articles. Other projects can use the links in the index file so that
they can link to other articles and API documentation within Qt.
- \code
+ \badcode
indexes = $QT_INSTALL_DOCS/html/qt.index $OTHER_PROJECT/html/qt.index
\endcode
It is possible to specify multiple index files from several projects.
@@ -232,7 +232,7 @@
Macros for substituting HTML characters exist and are helpful for generating
specific HTML-valid characters.
- \code
+ \badcode
macro.pi.HTML = "&Pi;"
\endcode
The snippet code will replace any instances of \c{\\pi} with \c &Pi; in the
@@ -245,18 +245,17 @@
with the QML extension, \c{.qml}, if the extension type is included in the
\l{Input and Output Directories}{fileextensions} variable.
- Also, the generated HTML files can have a prefix, specified in the QDoc
- configuration file.
- \code
+ Also, the generated HTML files can have a prefix and a suffix following the
+ QML module name, specified in the QDoc configuration file.
+ \badcode
outputprefixes = QML
outputprefixes.QML = uicomponents-
+ outputsuffixes = QML
+ outputsuffixes.QML = -tp
\endcode
- The outputprefixes will, for example, prefix QML type HTML filenames.
- \code
- files:
- uicomponents-button.html
- uicomponents-scrollbar.html
- \endcode
+
+ \b {See also}: \l {outputprefixes-variable}{outputprefixes},
+ \l {outputsuffixes-variable}{outputsuffixes}.
*/
diff --git a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
index 87416fcd14..d3f188c265 100644
--- a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
@@ -89,6 +89,7 @@
\li \l {namespace-command} {\\namespace}
\li \l {nextpage-command} {\\nextpage}
\li \l {newcode-command} {\\newcode}
+ \li \l {noautolist-command} {\\noautolist}
\li \l {nonreentrant-command} {\\nonreentrant}
\li \l {note-command} {\\note}
\li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
@@ -106,6 +107,7 @@
\li \l {printto-command} {\\printto}
\li \l {printuntil-command} {\\printuntil}
\li \l {property-command} {\\property}
+ \li \l {qmlabstract-command} {\\qmlabstract}
\li \l {qmlattachedproperty-command} {\\qmlattachedproperty}
\li \l {qmlattachedsignal-command} {\\qmlattachedsignal}
\li \l {qmlbasictype-command} {\\qmlbasictype}
diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
index 77987d6d95..a2e851293c 100644
--- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -46,6 +46,7 @@
below the \l {Topic Commands} {topic} command.
\list
+ \li \l {abstract-command} {\\abstract}
\li \l {compat-command}{\\compat},
\li \l {contentspage-command}{\\contentspage},
\li \l {indexpage-command}{\\indexpage},
@@ -59,6 +60,7 @@
\li \l {overload-command}{\\overload},
\li \l {preliminary-command}{\\preliminary},
\li \l {previouspage-command}{\\previouspage},
+ \li \l {qmlabstract-command} {\\qmlabstract}
\li \l {reentrant-command}{\\reentrant},
\li \l {reimp-command}{\\reimp},
\li \l {relates-command}{\\relates},
@@ -75,7 +77,7 @@
\page 15-qdoc-commands-navigation.html
\previouspage Context Commands
\contentspage QDoc Manual
- \nextpage Reporting Status
+ \nextpage Status
\title Document Navigation
@@ -199,21 +201,41 @@
index page of the collection.
*/
-
/*!
\page 16-qdoc-commands-status.html
\previouspage Document Navigation
\contentspage QDoc Manual
\nextpage Thread Support
- \title Reporting Status
-
- These commands are for indicating that a documented element is
- still under development, is becoming obsolete, is provided for
- compatibility reasons, or is simply not to be included in the
- public interface. The \l {since-command}{\\since} command is for
- including information about the version when a function or class
- first appeared.
+ \title Status
+
+ These commands are for indicating that a documented element has
+ some special status. The element could be marked as about to be
+ made obsolete, or that it is provided for compatibility with an
+ earlier version, or is simply not to be included in the public
+ interface. The \l {since-command}{\\since} command is for
+ specifying the version number in which a function or class first
+ appeared. The \l {qmlabstract-command} {\\qmlabstract} command is
+ for marking a QML type as an abstract base class.
+
+ \target abstract-command
+ \target qmlabstract-command
+ \section1 \\abstract and \\qmlabstract
+
+ \\abstract is a synonym for the \\qmlabstract command. Add this
+ command to the \l {qmltype-command} {\\qmltype} comment for a QML
+ type when that type is meant to be used \e {only} as an abstract
+ base type. When a QML type is abstract, it means that the QML type
+ that can't be instantiated. Instead, the properties in its public
+ API are included in the public properties list on the reference
+ page for each QML type that inherits the abstract QML type. The
+ properties are documented as if they are properties of the
+ inheriting QML type.
+
+ Normally, when a QML type is marked with \e{\\qmlabstract}, it is
+ also marked with \e{\\internal} so that its reference page is not
+ generated. It the abstract QML type is not marked internal, it
+ will have a reference page in the documentation.
\target compat-command
\section1 \\compat
@@ -412,13 +434,14 @@
/ *!
\preliminary
- Returns information about the joining properties of the
- character (needed for certain languages such as
- Arabic).
+ Returns information about the joining type attributes of the
+ character (needed for certain languages such as Arabic or
+ Syriac).
+
* /
- QChar::Joining QChar::joining() const
+ QChar::JoiningType QChar::joiningType() const
{
- return ::joining(*this);
+ return QChar::joiningType(ucs);
}
\endcode
@@ -427,28 +450,25 @@
\quotation
\raw HTML
<h3>
- <a href="http://doc.qt.io/qt-5/qchar.html#JoiningType-enum">Joining</a>
- QChar::joining () const</h3>
+ <a href="http://doc.qt.io/qt-5/qchar.html#JoiningType-enum">JoiningType</a>
+ QChar::joiningType() const</h3>
\endraw
\b {This function is under development and
subject to change.}
- Returns information about the joining properties of the
- character (needed for certain languages such as
- Arabic).
+ Returns information about the joining type attributes of the
+ character (needed for certain languages such as Arabic or
+ Syriac).
\endquotation
- And the function's entry in QChar's list of functions will be
+ And the function's entry in QChar's list of public functions will be
rendered as:
\quotation
\list
\li ...
- \li Joining
- \l {Joining-enum}
- {joining}()
- const \c (preliminary)
+ \li JoiningType \l {QChar::joiningType()} {joiningType}() const \c (preliminary)
\li ...
\endlist
\endquotation
@@ -502,7 +522,7 @@
/*!
\page 17-qdoc-commands-thread.html
- \previouspage Reporting Status
+ \previouspage Status
\contentspage QDoc Manual
\nextpage Relating Things
@@ -680,8 +700,6 @@
\l{threadsafe-command} {\\threadsafe}.
*/
- / *!
-
/*!
\page 18-qdoc-commands-relating.html
\previouspage Thread Support
@@ -791,7 +809,7 @@
</h3>
\endraw
- This function overloads \l {addAction} {addAction()}
+ This function overloads \l {QMenu::addAction()} {addAction()}
This convenience function creates a new action with an
\e icon and some \e text. The function adds the newly
@@ -799,8 +817,7 @@
returns it.
See also
- \l {addAction}
- {QWidget::addAction}().
+ \l {QWidget::addAction()} {QWidget::addAction}().
\endquotation
If you don't include the function name with the \b{\\overload}
diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
index d764cde89d..0f9ca463bb 100644
--- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
@@ -38,7 +38,6 @@
\list
\li \l {a-command} {\\a}
- \li \l {abstract-command} {\\abstract}
\li \l {annotatedlist-command} {\\annotatedlist}
\li \l {b-command} {\\b} \span {class="newStuff"}
\li \l {b-command} {\\bold} {(deprecated, use \\b)}
@@ -68,6 +67,7 @@
\li \l {li-command} {\\li} \span {class="newStuff"}
\li \l {list-command} {\\list}
\li \l {meta-command} {\\meta}
+ \li \l {noautolist-command} {\\noautolist}
\li \l {newcode-command} {\\newcode}
\li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {note-command} {\\note}
@@ -2092,8 +2092,11 @@
{sa-command} {\\sa (see also)} commands.
The \\keyword command is like the \l {target-command} {\\target}
- command, but stronger. A keyword can be linked from anywhere using
- a simple syntax.
+ command, except when linking to keyword the link goes to the top of
+ the QDoc comment where the \\keyword appears in. If you want to
+ create a link target to a \c section unit within a \\page, use
+ \\target instead. A keyword can be linked from anywhere using a
+ simple syntax.
Keywords must be unique over all the documents processed during
the QDoc run. The command uses the rest of the line as its
@@ -2886,19 +2889,6 @@
parts with a special rendering, conceptual meaning or
function.
- \target abstract-command
- \section1 \\abstract
-
- The \\abstract and \\endabstract commands delimit a
- document's abstract section.
-
- The abstract section is rendered as an indented italicized
- paragraph.
-
- \warning The \b{\\abstract} and \b{\\endabstract} commands
- have not been implemented. The abstract section is rendered as a
- regular HTML paragraph.
-
\target quotation-command
\section1 \\quotation
@@ -3465,6 +3455,20 @@
with the \l {inmodule-command} {\\inmodule} command in its \\class
comment.
+ \section2 \c qmltypesbymodule
+
+ Similar to \c classesbymodule argument, but used for listing the
+ QML types from the QML module specified with the second argument.
+
+ \note Support for this argument was introduced in QDoc 5.6.
+
+ \section2 \c jstypesbymodule
+
+ Similar to \c classesbymodule argument, but used for listing the
+ JavaScript types from the module specified with the second argument.
+
+ \note Support for this argument was introduced in QDoc 5.6.
+
\section2 \c compatclasses
The \c compatclasses argument generates a list in alphabetical
@@ -3895,6 +3899,28 @@
values obtained from the QDoc configuration file. See \l
{Generating DITA XML Output} for details.
+ \target noautolist-command
+ \section1 \\noautolist
+
+ The \\noautolist command indicates that the annotated list of C++
+ classes or QML types, which is automatically generated at the
+ bottom of the C++ or QML module page should be omitted, because
+ the classes or types have been listed manually. This command can
+ also be used with the \l {group-command}{\\group} command to omit
+ the list of group members, when they are listed manually.
+
+ The command must stand on its own line. See \l {Qt Sensors QML Types} for
+ an example. The page is generated from \c {qtsensors5.qdoc}. There you will
+ find a qdoc comment containing the \c{\qmlmodule} command for the QtSensors
+ module. The same qdoc comment contains two \c {\annotated-list} commands to
+ list the QML types in two separate groups. The QML types have been divided
+ into these two groups because it makes more sense to list them this way than
+ it does to list them in a single alphabetical list. At the bottom of the
+ comment, \c {\noautolist} has been used to tell qdoc not to generate the
+ automatic annotated list.
+
+ This command was introduced in QDoc 5.6.
+
\target omit-command
\section1 \\omit
diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
index 226c107e3a..2472b0f4fb 100644
--- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
@@ -69,14 +69,14 @@
you to use special characters like '=' and ' \" ' within the value
string, for example:
- \code
+ \badcode
HTML.postheader = "<a href=\"index.html\">Home</a>"
\endcode
If an entry spans many lines, use a backslash at the end of every
line but the last:
- \code
+ \badcode
sourcedirs = kernel \
tools \
widgets
@@ -113,6 +113,8 @@
\li \l {manifestmeta-variable} {manifestmeta}
\li \l {outputdir-variable} {outputdir}
\li \l {outputformats-variable} {outputformats}
+ \li \l {outputprefixes-variable} {outputprefixes}
+ \li \l {outputsuffixes-variable} {outputsuffixes}
\li \l {sourcedirs-variable} {sourcedirs}
\li \l {sources-variable} {sources}
\li \l {sources.fileextensions-variable} {sources.fileextensions}
@@ -161,7 +163,7 @@
The general syntax is \tt {alias.\e{original-command-name} = \e
temporary-command-name}.
- \code
+ \badcode
alias.e = i
\endcode
@@ -198,7 +200,7 @@
for details). By default, no symbol is defined, meaning that code
protected with #ifdef...#endif will be ignored.
- \code
+ \badcode
defines = Q_QDOC \
QT_.*_SUPPORT \
QT_.*_LIB \
@@ -226,7 +228,7 @@
You can also define preprocessor symbols manually on the command
line using the -D option. For example:
- \code
+ \badcode
currentdirectory$ qdoc -Dconsoleedition qtgui.qdocconf
\endcode
@@ -249,7 +251,7 @@
The \c edition variable is always used with a particular edition
name to define the modules for that edition:
- \code
+ \badcode
edition.Console = QtCore QtNetwork QtSql QtXml
edition.Desktop = QtCore QtGui QtNetwork QtOpenGL QtSql QtXml \
QtDesigner QtAssistant Qt3Support QAxContainer \
@@ -263,7 +265,7 @@
{generatelist} command is used to generate a list of classes for
this edition:
- \code
+ \badcode
\generatelist{classesbyedition Console}
\endcode
@@ -286,7 +288,7 @@
and accept the first matching file it finds. It will only search
in the specified directories, \e not in subdirectories.
- \code
+ \badcode
exampledirs = $QTDIR/doc/src \
$QTDIR/examples \
$QTDIR \
@@ -297,7 +299,7 @@
When processing
- \code
+ \badcode
\quotefromfile widgets/calculator/calculator.cpp
\endcode
@@ -306,13 +308,13 @@
there isn't, it will search in the \c exampledirs variable, and
first see if there exists a file called
- \code
+ \badcode
$QTDIR/doc/src/widgets/calculator/calculator.cpp
\endcode
If it doesn't, QDoc will continue looking for a file called
- \code
+ \badcode
$QTDIR/examples/widgets/calculator/calculator.cpp
\endcode
@@ -343,7 +345,7 @@
exampledirs} command. But note that if you know the file is listed
in the \c examples variable, you don't need to specify its path:
- \code
+ \badcode
\quotefromfile calculator.cpp
\endcode
@@ -362,7 +364,7 @@
The extensions are given as standard wildcard expressions. You
can add a file extension to the filter using '+='. For example:
- \code
+ \badcode
examples.fileextensions += *.qrc
\endcode
@@ -378,7 +380,7 @@
For example:
- \code
+ \badcode
sourcedirs = src/corelib
excludedirs = src/corelib/tmp
\endcode
@@ -395,7 +397,7 @@
The \c excludefiles variable allows you to specify individual files
that should \e{not} be processed by qdoc.
- \code
+ \badcode
excludefiles += $QT_CORE_SOURCES/../../src/widgets/kernel/qwidget.h \
$QT_CORE_SOURCES/../../src/widgets/kernel/qwidget.cpp
\endcode
@@ -427,7 +429,7 @@
reason, these images are specified using the \c extraimages
variable:
- \code
+ \badcode
extraimages.HTML = qt-logo
\endcode
@@ -468,7 +470,7 @@
preprocessor symbol is specified within the \c falsehoods variable
entry:
- \code
+ \badcode
falsehoods = NOTYET
\endcode
@@ -494,7 +496,7 @@
the header files associated with the \c .cpp source files used in
the documentation.
- \code
+ \badcode
headerdirs = $QTDIR/src \
$QTDIR/extensions/activeqt \
$QTDIR/extensions/motif \
@@ -536,7 +538,7 @@
files in addition to those located in the directories specified by
the \l {headerdirs} {\c headerdirs} variable.
- \code
+ \badcode
headers = $QTDIR/src/gui/widgets/qlineedit.h \
$QTDIR/src/gui/widgets/qpushbutton.h
\endcode
@@ -566,7 +568,7 @@
The extensions are given as standard wildcard expressions. You
can add a file extension to the filter using '+='. For example:
- \code
+ \badcode
header.fileextensions += *.H
\endcode
@@ -590,7 +592,7 @@
and accept the first matching file it finds. It will only search
in the specified directories, \e not in subdirectories.
- \code
+ \badcode
imagedirs = $QTDIR/doc/src/images \
$QTDIR/examples
@@ -599,7 +601,7 @@
When processing
- \code
+ \badcode
\image calculator-example.png
\endcode
@@ -608,13 +610,13 @@
variable. If there isn't, it will search in the \c imagedirs
variable for:
- \code
+ \badcode
$QTDIR/doc/src/images/calculator-example.png
\endcode
If the file doesn't exist, QDoc will look for a file called
- \code
+ \badcode
$QTDIR/examples/calculator-example.png
\endcode
@@ -636,7 +638,7 @@
files in addition to those located in the directories specified by
the \l {imagedirs} {\c imagedirs} variable.
- \code
+ \badcode
images = $QTDIR/doc/src/images/calculator-example.png
\endcode
@@ -660,7 +662,7 @@
The idea is to enable different image format for different output
format.
- \code
+ \badcode
images.fileextensions.HTML = *.png
images.fileextensions.LOUT = *.eps
\endcode
@@ -679,7 +681,7 @@
You can add a file extension to the filter using '+='. For
example:
- \code
+ \badcode
images.fileextensions.HTML += *.eps
\endcode
@@ -696,7 +698,7 @@
specified. However, a possible example of a language variable
statement:
- \code
+ \badcode
language = Cpp
\endcode
@@ -715,7 +717,7 @@
appending \c {.DITAXML} to the macro name, the macro is only used
when generating DITA XML.
- \code
+ \badcode
macro.gui = "\\b"
macro.raisedaster.HTML = "<sup>*</sup>"
\endcode
@@ -741,7 +743,7 @@
The \c naturallanguage variable specifies the natural language
used for the documentation generated by qdoc.
- \code
+ \badcode
naturallanguage = zh-Hans
\endcode
@@ -764,7 +766,7 @@
The \c outputdir variable specifies the directory where QDoc will
put the generated documentation.
- \code
+ \badcode
outputdir = $QTDIR/doc/html
\endcode
@@ -772,7 +774,7 @@
$QTDIR/doc/html. For example, the documentation of the QWidget
class is located in
- \code
+ \badcode
$QTDIR/doc/html/qwidget.html
\endcode
@@ -787,7 +789,7 @@
The \c outputencoding variable specifies the encoding used for the
documentation generated by qdoc.
- \code
+ \badcode
outputencoding = UTF-8
\endcode
@@ -814,21 +816,48 @@
Currently, QDoc only supports the HTML format. It is also
the default format, and doesn't need to be specified.
- \target outputprefixes
+ \target outputprefixes-variable
\section1 outputprefixes
The \c outputprefixes variable specifies a mapping between types of files
and the prefixes to prepend to the HTML file names in the generated
documentation.
- \code
- outputprefixes = QML
+ \badcode
+ outputprefixes = QML JS
outputprefixes.QML = uicomponents-
+ outputprefixes.JS = uicomponents-
\endcode
By default, files containing the API documentation for QML types
- are prefixed with "qml-". In the above example, the
- prefix \c "uicomponents" is used instead.
+ are prefixed with "qml-", and javaScript types with "js-". In the
+ above example, the prefix \c "uicomponents" is used instead for
+ both.
+
+ The output prefix is applied to file names for documentation on
+ QML and JS types.
+
+ \target outputsuffixes-variable
+ \section1 outputsuffixes
+
+ The \c outputsuffixes variable specifies a mapping between types of
+ files and module name suffixes to append to the HTML file names.
+
+ \badcode
+ outputsuffixes = QML
+ outputsuffixes.QML = -tp
+ \endcode
+
+ Given a QML module name \e FooBar and the default
+ \l {outputprefixes-variable}{output prefix} ("qml-"), the file name of
+ the generated HTML page for a QML type \e FooWidget would be
+ \c qml-foobar-tp-foowidget.html.
+
+ By default, no suffix is used. The output suffix, if defined, is applied
+ to file names for documentation on QML and JS types, and their respective
+ module pages.
+
+ The \c outputsuffixes variable was introduced in QDoc 5.6.
\target qhp-variable
\section1 qhp
@@ -845,7 +874,7 @@
The \c sourcedirs variable specifies the directories containing
the \c .cpp or \c .qdoc files used in the documentation.
- \code
+ \badcode
sourcedirs += .. \
../../../examples/gui/doc/src
\endcode
@@ -881,7 +910,7 @@
The \c sourceencoding variable specifies the encoding used for the
source code and documentation.
- \code
+ \badcode
sourceencoding = UTF-8
\endcode
@@ -906,7 +935,7 @@
files in addition to those located in the directories specified by
the \l {sourcedirs-variable} {sourcedirs} variable.
- \code
+ \badcode
sources = $QTDIR/src/gui/widgets/qlineedit.cpp \
$QTDIR/src/gui/widgets/qpushbutton.cpp
\endcode
@@ -935,7 +964,7 @@
The extensions are given as standard wildcard expressions. You
can add a file extension to the filter using '+='. For example:
- \code
+ \badcode
sources.fileextensions += *.CC
\endcode
@@ -952,7 +981,7 @@
output. The warnings are specified using standard wildcard
expressions.
- \code
+ \badcode
spurious = "Cannot find .*" \
"Missing .*"
\endcode
@@ -961,8 +990,8 @@
will not be part of the output when running QDoc. For example
would the following warning be omitted from the output:
- \code
- qt-4.0/src/opengl/qgl_mac.cpp:156: Missing parameter name
+ \badcode
+ src/opengl/qgl_mac.cpp:156: Missing parameter name
\endcode
\target syntaxhighlighting
@@ -972,7 +1001,7 @@
perform syntax highlighting on source code quoted in the
documentation it generates.
- \code
+ \badcode
syntaxhighlighting = true
\endcode
@@ -984,7 +1013,7 @@
The \c tabsize variable defines the size of a tab character.
- \code
+ \badcode
tabsize = 4
\endcode
@@ -1003,8 +1032,8 @@
The \c version variable specifies the version number of the
documented software.
- \code
- version = 4.0.1
+ \badcode
+ version = 5.6.0
\endcode
When a version number is specified (using the \tt{\l version} or
@@ -1023,13 +1052,13 @@
The \c versionsym variable specifies a C++ preprocessor symbol
that defines the version number of the documented software.
- \code
+ \badcode
versionsym = QT_VERSION_STR
\endcode
QT_VERSION_STR is defined in qglobal.h as follows
- \code
+ \badcode
#define QT_VERSION_STR "4.0.1"
\endcode
@@ -1054,42 +1083,106 @@
\section1 Overview
- Starting with Qt 4.4, Qt Assistant uses a different system for managing
- Qt documentation that requires QDoc to generate inventories of files in a
- format that is similar to the old style DCF format, but with additional
- features.
+ Qt Assistant uses a system for managing Qt documentation that requires
+ QDoc to generate inventories of files in a format that is similar to the
+ old style DCF format, but with additional features.
- Instead of hard-coding information about the documentation sets for Qt,
QDoc allows configuration variables to be used to specify which pages are
to be used in each documentation set it generates. These are specified as
- subvariables of the \c qch variable with each set declared using a unique
+ subvariables of the \c qhp variable with each set declared using a unique
identifier as a subvariable.
- For example, the configuration file for the Qt documentation defines a
- \c Qt documentation set by specifying information about the set as
- subvariables with the \c{qhp.Qt} prefix:
-
- \code
- qhp.Qt.file = qt.qhp
- qhp.Qt.namespace = org.qt-project.qtcore.$QT_VERSION_TAG
- qhp.Qt.virtualFolder = qdoc
- qhp.Qt.indexTitle = Qt Reference Documentation
- qhp.Qt.indexRoot =
- qhp.Qt.extraFiles = classic.css images/qt-logo.png
- qhp.Qt.filterAttributes = qt 4.4.0 qtrefdoc
- qhp.Qt.customFilters.Qt.name = Qt 4.4.0
- qhp.Qt.customFilters.Qt.filterAttributes = qt 4.4.0
- qhp.Qt.subprojects = classes overviews examples
- qhp.Qt.subprojects.classes.title = Classes
- qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
- qhp.Qt.subprojects.classes.selectors = class
- qhp.Qt.subprojects.overviews.title = Overviews
- qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
- qhp.Qt.subprojects.overviews.selectors = fake:page,group,module
- qhp.Qt.subprojects.examples.title = Tutorials and Examples
- qhp.Qt.subprojects.examples.indexTitle = Qt Examples
- qhp.Qt.subprojects.examples.selectors = fake:example
- \endcode
+ For example, the configuration file for the Qt Quick documentation set
+ specifies information about the set as subvariables with the
+ \c{qhp.QtQuick} prefix:
+
+ \badcode
+ qhp.projects = QtQuick
+
+ qhp.QtQuick.file = qtquick.qhp
+ qhp.QtQuick.namespace = org.qt-project.qtquick.$QT_VERSION_TAG
+ qhp.QtQuick.virtualFolder = qtquick
+ qhp.QtQuick.indexTitle = Qt Quick
+ qhp.QtQuick.indexRoot =
+
+ qhp.QtQuick.filterAttributes = qtquick $QT_VERSION qtrefdoc
+ qhp.QtQuick.customFilters.Qt.name = QtQuick $QT_VERSION
+ qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick $QT_VERSION
+
+ qhp.QtQuick.subprojects = qmltypes classes examples
+
+ qhp.QtQuick.subprojects.qmltypes.title = QML Types
+ qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types
+ qhp.QtQuick.subprojects.qmltypes.selectors = qmlclass
+ qhp.QtQuick.subprojects.qmltypes.sortPages = true
+
+ qhp.QtQuick.subprojects.classes.title = Classes
+ qhp.QtQuick.subprojects.classes.title = C++ Classes
+ qhp.QtQuick.subprojects.classes.indexTitle = Qt Quick C++ Classes
+ qhp.QtQuick.subprojects.classes.selectors = class fake:headerfile
+ qhp.QtQuick.subprojects.classes.sortPages = true
+
+ qhp.QtQuick.subprojects.examples.title = Examples
+ qhp.QtQuick.subprojects.examples.indexTitle = Qt Quick Examples and Tutorials
+ qhp.QtQuick.subprojects.examples.selectors = fake:example
+ \endcode
+
+ The documentation set may include one or more subprojects, which are added
+ to the table of contents under the name specified by \c title. The page
+ in the documentation referred to by the \c indexTitle acts as the index page
+ for the subproject. The page types to list under the subproject are specified
+ by \c selectors. The entries are alphabetically sorted if \c sortPages is set
+ to \c true.
+
+ \section2 Using Selectors
+
+ The \c selectors property specifies which page types are listed under the
+ table of contents entry for a subproject. Multiple selectors can be listed,
+ separated by whitespace.
+
+ \table
+ \header \li Selector \li Description
+ \row \li \c namespace \li Namespaces
+ \row \li \c class \li Classes
+ \row \li \c qmltype \li QML Types
+ \row \li \c qmlclass \li Alias for \c qmltype.
+ \row \li \c module \li C++ Modules
+ \row \li \c qmlmodule \li QML Modules
+ \row \li \c doc[:subtype] \li Documentation pages with a specified
+ \c subtype. Multiple subtypes can be
+ listed as a comma-separated list.
+ \row \li \c fake \li Alias for \c doc.
+ \row \li \c group[:groupname] \li Documentation pages for members of a
+ specified group, as added using the
+ \l {ingroup-command}
+ {\\ingroup} groupname command.
+ Multiple group names can be listed as
+ a comma-separated list.
+ (Introduced in QDoc 5.6).
+ \endtable
+
+ Available subtypes for the \c doc selector:
+
+ \table
+ \header \li Subtype \li Description
+ \row \li \c example \li Examples
+ \row \li \c headerfile \li Header files
+ \row \li \c page \li Documentation pages defined with the
+ \l {page-command} {\\page} command.
+ \endtable
+
+ For example, the following configuration would select example pages and
+ pages that include the \c {\ingroup tutorials} command:
+
+ \badcode
+ qhp.QtQuickControls.subprojects = examples
+ qhp.QtQuickControls.subprojects.examples.title = Examples and Tutorials
+ qhp.QtQuickControls.subprojects.examples.indexTitle = Qt Quick Controls Examples
+ qhp.QtQuickControls.subprojects.examples.selectors = doc:example group:tutorials
+ qhp.QtQuickControls.subprojects.examples.sortPages = true
+ \endcode
+
+ \section2 Adding Table of Contents
To create a table of contents for a manual, create a subproject with
a \c{type} property and set it to \c{manual}. The page in the documentation
@@ -1101,7 +1194,7 @@
subproject for its documentation, including all the documentation in a
single manual:
- \code
+ \badcode
qhp.QtCreator.subprojects = manual
qhp.QtCreator.subprojects.manual.title = Qt Creator Manual
qhp.QtCreator.subprojects.manual.indexTitle = Qt Creator Manual
@@ -1133,7 +1226,7 @@
Cpp.ignoredirectives} variables, non-standard constructs
(typically macros) can result in erroneous documentation.
- \code
+ \badcode
Cpp.ignoredirectives = Q_DECLARE_INTERFACE \
Q_DECLARE_OPERATORS_FOR_FLAGS \
Q_DECLARE_PRIVATE \
@@ -1187,7 +1280,7 @@
In \l qtgui.qdocconf:
- \code
+ \badcode
Cpp.ignoretokens = QAXFACTORY_EXPORT \
QM_EXPORT_CANVAS \
...
@@ -1250,15 +1343,12 @@
quotation marks. Note that if the value spans several lines, each
line needs to be enclosed by quotation marks.
- \code
+ \badcode
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
...
"</tr></table></div></address>"
\endcode
- The complete variable entry provides the standard footer of the
- \l {http://doc.qt.digia.com/4.0/index.html} {Qt Reference Documentation}.
-
\target HTML.postheader-variable
\section1 HTML.postheader
@@ -1272,7 +1362,7 @@
marks. Note that if the value spans several lines, each line needs
to be enclosed by quotation marks.
- \code
+ \badcode
HTML.postheader = "<table border=\"0\"..." \
...
"<img src=\"images/qt-logo.png\" \
@@ -1296,7 +1386,7 @@
marks. Note that if the value spans several lines, each line needs
to be enclosed by quotation marks.
- \code
+ \badcode
HTML.style = "h3.fn,span.fn" \
"{ margin-left: 1cm; text-indent: -1cm; }\n" \
"a:link { color: #004faf; text-decoration: none }\n" \
@@ -1307,10 +1397,6 @@
"body { background: #ffffff; color: black; }"
\endcode
- provides the HTML style for the \l
- {http://doc.qt.digia.com/4.0/index.html} {Qt Reference
- Documentation}.
-
\target HTML.stylesheets-variable
\section1 HTML.stylesheets
@@ -1322,7 +1408,7 @@
has been generated. Typically, it is only necessary to define a
single stylesheet for any set of documentation; for example:
- \code
+ \badcode
HTML.stylesheets = classic.css
\endcode
@@ -1371,7 +1457,7 @@
Reference documentation, you need to specify the associated index
file:
- \code
+ \badcode
indexes = $QTDIR/doc/html/qt.index
\endcode
@@ -1386,7 +1472,7 @@
The project's name is used to form a file name for the associated
project's \e index file.
- \code
+ \badcode
project = QtCreator
\endcode
@@ -1406,7 +1492,7 @@
the base URL when constructing links to classes, functions, and
other things listed in the index.
- \code
+ \badcode
project = Qt
description = Qt Reference Documentation
url = http://doc.qt.io/qt-4.8/
@@ -1429,7 +1515,7 @@
For example, \l qtgui.qdocconf (the configuration file for Qt)
contains the following variable definitions:
- \code
+ \badcode
project = Qt
description = Qt Reference Documentation
url = http://doc.qt.io/qt-4.8/
@@ -1461,7 +1547,7 @@
A manifest file has the following structure:
- \code
+ \badcode
<?xml version="1.0" encoding="UTF-8"?>
<instructionals module="QtGui">
<examples>
@@ -1503,7 +1589,7 @@
Example:
- \code
+ \badcode
manifestmeta.filters = highlighted sql webkit global
manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example" \
@@ -1539,7 +1625,7 @@
In your configuration file, set your \c {outputformats} variable
to \c {DITAXML}, and send the output to an appropriate directory:
- \code
+ \badcode
outputdir = $QTDIR/doc/ditaxml
outputformats = DITAXML
\endcode
@@ -1547,7 +1633,7 @@
And include these macros in your configuration file to prevent
QDoc from doing some escaping that doesn't validate in XML:
- \code
+ \badcode
macro.aacute.DITAXML = "&aacute;"
macro.Aring.DITAXML = "&Aring;"
macro.aring.DITAXML = "&aring;"
@@ -1571,7 +1657,7 @@
You can also set default values for some of the tags in the DITA
\c {<prolog>} and \c {<metadata>} elements:
- \code
+ \badcode
dita.metadata.default.author = Qt Development Frameworks
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
diff --git a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
index f5351b851c..306fc40cb8 100644
--- a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
@@ -851,6 +851,9 @@
\endquotation
+ The \l {noautolist-command} {\\noautolist} command can be used here
+ to omit the automatically generated list of classes at the end.
+
See also \l {inmodule-command} {\\inmodule}
\target namespace-command
@@ -1372,6 +1375,9 @@
The \l{componentset}{UIComponents} example demonstrates proper usage of
QDoc commands to document QML types and QML modules.
+ The \l {noautolist-command} {\\noautolist} command can be used here
+ to omit the automatically generated list of types at the end.
+
\target instantiates-command
\section1 \\instantiates
diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc
index c0a1afaa52..a0e35c2e9c 100644
--- a/src/tools/qdoc/doc/qdoc-manual.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual.qdoc
@@ -39,7 +39,7 @@
\li \l {Context Commands}
\list
\li \l {Document Navigation}
- \li \l {Reporting Status}
+ \li \l {Status}
\li \l {Thread Support}
\li \l {Relating Things}
\li \l {Grouping Things}
diff --git a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
index 77d252b24c..66ceed4a3d 100644
--- a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
@@ -27,7 +27,7 @@
/*!
\page qdoc-minimum-qdocconf.html
\target minimal-qdocconf
-\title A minimal qdocconf file
+\title A Minimal qdocconf File
\brief Describes a minimal .qdocconf file
@@ -37,8 +37,8 @@ will discuss every statement in the qdocconf file.
Each line from the qdocconf file is first quoted. Below each statement you will
find the meaning.
-\code
- #include(compat.qdocconf)
+\badcode
+ include(compat.qdocconf)
outputdir = html
headerdirs = .
sourcedirs = .
@@ -46,10 +46,10 @@ find the meaning.
imagedirs = ./images
\endcode
-\title Notes
+\b Notes:
-\code
- #include(compat.qdocconf)
+\badcode
+ include(compat.qdocconf)
\endcode
For compatibility with older versions of Qt, it is recommended
@@ -61,32 +61,29 @@ to include compat.qdocconf.
QDoc will put the documentation generated in the html directory.
-\code
+\badcode
headerdirs = .
\endcode
The header file associated with the \e .cpp source files can be found in the
current directory.
-\code
+\badcode
sourcedirs = .
\endcode
The current directory is the directory containing the source files: the \e .cpp
and \e .qdoc files used in the documentation.
-\code
+\badcode
exampledirs = .
\endcode
The source code of the example files can be found in the current directory.
-\code
+\badcode
imagedirs = ./images
\endcode
-The image files can be found in the underlying directory "images".
-
-\note Please take care with this minimal qdocconf file. Using it in the wrong directory
-could cause qdoc to include a large number of files.
+The image files can be found in the underlying directory \c images.
*/
diff --git a/src/tools/qdoc/doc/qtgui-qdocconf.qdoc b/src/tools/qdoc/doc/qtgui-qdocconf.qdoc
index 3dcd2482d6..d90584ff42 100644
--- a/src/tools/qdoc/doc/qtgui-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qtgui-qdocconf.qdoc
@@ -30,20 +30,20 @@
\page qtgui-qdocconf.html
\title qtgui.qdocconf with Comments
-\brief A walkthrough of a typical qdocconf file
+\brief A walkthrough of a typical qdocconf file.
This document goes through a typical Qt 5 qdocconf file. The contents is taken from
Qt GUI's \e qtgui.qdocconf file.
-Below you will find the full contents of qtgui.qdocconf. The subsequent section will discuss
+Below you will find the full contents of \c qtgui.qdocconf. The subsequent section will discuss
every statement in the qdocconf file.
-\code
+\badcode
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
- url = http://doc.qt.io/qt-$QT_VER/qtgui-index.html
+ url = http://doc.qt.io/qt-5
version = $QT_VERSION
examplesinstallpath = gui
@@ -95,20 +95,20 @@ every statement in the qdocconf file.
\title Qtgui.qdocconf with notes
-\code
+\badcode
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
\endcode
QDoc inherits the default templates, macros, and settings from the directory
specified from the \c $QT_INSTALL_DOCS variable. \c qmake prints the value of
the variable.
-\code
+\badcode
qmake -query
\endcode
-\sa include
+\b {See also}: \l {include}.
-\code
+\badcode
project = QtGui
\endcode
@@ -116,22 +116,22 @@ The \c project variable sets the name of the QDoc build. This name is also
used to form the index file, which, in this case, will be \e qtgui.index. The
name of the index file doesn't adopt the uppercase letters of the project name.
-\sa project
+\b {See also}: \l {project}.
-\code
+\badcode
description = Qt GUI Reference Documentation
\endcode
A short description of the project concerned.
-\code
- url = http://doc.qt.io/qt-$QT_VER/qtgui-index.html
+\badcode
+ url = http://doc.qt.io/qt-5
\endcode
The \c url variable holds the base url of the project.
The URL is stored in the generated index file for the project.
-QDoc will use this as the base URL when constructing links
+QDoc will use this as the base URL when constructing external links
to content listed in the index.
\note QDoc omits this value when the -installdir argument
@@ -139,27 +139,29 @@ is specified when running QDoc.
\keyword examplesinstallpath
-\code
+\badcode
examplesinstallpath = gui
\endcode
-This \e examplesinstallpath variable indicates that the examples will be installed
-in the \e gui directory under the parent examples directory (for Qt, this is
-$QT_INSTALL_EXAMPLES).
+This \c examplesinstallpath variable indicates that the examples will be
+installed in the \e gui directory under the parent examples directory
+(for Qt, this is $QT_INSTALL_EXAMPLES).
-\note The examplepath variable has to match the example directory specified in exampledirs.
-\sa exampledirs
+\note The examplepath variable has to match the example directory specified in
+ \c exampledirs.
-\code
+\b {See also}: \l {exampledirs}.
+
+\badcode
qhp.projects = QtGui
qhp.QtGui.file = qtgui.qhp
\endcode
-The following parameters are for creating a QHP file (\e .qhp). The qhelpgenerator
-program can convert the QHP file into a QCH file (\e .qch), which can be opened in
-Qt Assistant or Qt Creator.
+The following parameters are for creating a QHP file (\e .qhp). The
+\e qhelpgenerator program can convert the QHP file into a QCH file (\e .qch),
+which can be opened in Qt Assistant or Qt Creator.
-\code
+\badcode
qhp.QtGui.namespace = org.qt-project.qtgui.$QT_VERSION_TAG
\endcode
@@ -167,32 +169,32 @@ A unique identifier which enables QHelpEngine to retrieve the helpfile
from a given link. This namespace is also used as a base url for links
to the helpfile.
-\code
+\badcode
qhp.QtGui.virtualFolder = qtgui
\endcode
Virtual folders group documentation together into a single location. A
-virtual folder will become the root directory of all files referenced in a
-compressed help file.
+virtual folder will become the root directory of all files referenced in
+a compressed help file.
-When two manuals are located in the same virtual folder, it is possible to refer
- to sections of the other manual using relative paths.
-The virtual folder tag is mandatory and the folder must not contain any '/'.
+When two manuals are located in the same virtual folder, it is possible to
+refer to sections of the other manual using relative paths. The virtual
+folder tag is mandatory and the folder must not contain any '/'.
-\code
- qhp.QtGui.indexTitle = Qt GUI the title of the page that has the contents
+\badcode
+ qhp.QtGui.indexTitle = Qt GUI
\endcode
This is the title of the page that has the contents.
-\code
- qhp.QtGui.indexRoot = to be checked
+\badcode
+ qhp.QtGui.indexRoot =
\endcode
Specifies the title of the root (namespace) page to generate the documentation for.
Typically defined as an empty string.
-\code
+\badcode
qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc
qhp.QtGui.customFilters.Qt.name = QtGui $QT_VERSION
qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION
@@ -206,7 +208,7 @@ filter in its \gui{Filtered by} drop-down list. Only the documentation sets
that have their filter attributes match the attributes of the selected
custom filter will be shown.
-\code
+\badcode
qhp.QtGui.subprojects = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
@@ -216,34 +218,22 @@ for this project. In this example, the subproject, which is displayed in
the Assistant's sidebar, is named "C++ Classes" and its index is the page
titled "QT GUI C++ Classes".
-\code
+\badcode
qhp.QtGui.subprojects.classes.selectors = class fake:headerfile
\endcode
-Lists all headerfiles.
-
-A ‘fake’ type specifies a generic documentation node, and is followed by
-a c\ : and a \e subtype specifier.
-
-Possible values:
-\code
- example
- headerfile
- file
- group
- module
- page
- externalpage
- qmlclass
- qmlpropertygroup
- qmlbasictype
+Lists all C++ classes and header files.
+
+See \l {Creating Help Project Files} for more information.
+
+\badcode
+ tagfile = ../../../doc/qtgui/qtgui.tags
\endcode
-tagfile = ../../../doc/qtgui/qtgui.tags
This specifies the Doxygen tag file that needs to be written when the html is generated
by QDoc.
-\code
+\badcode
depends += \
qtcore \
qtnetwork \
@@ -259,14 +249,14 @@ Specifies the modules QDoc needs to load for generating output for Qt GUI.
QDoc loads the index files for all modules listed in the depends statement in
order to enable linking to pages in these modules.
-\code
+\badcode
headerdirs += ..
\endcode
Add the parent directory to the list of directories containing the header files
associated with the \e .cpp source files.
-\code
+\badcode
sourcedirs += .. \
../../../examples/gui/doc/src
\endcode
@@ -274,7 +264,7 @@ associated with the \e .cpp source files.
Add the specified directories to the list of directories containing the \e .cpp and
\e .qdoc files used in the documentation.
-\code
+\badcode
excludedirs = ../../../examples/gui/doc/src/tmp
\endcode
@@ -283,14 +273,13 @@ by qdoc, even if the same directories are included by the \c sourcedirs or \c he
variables.
When executed, QDoc will ignore the directories listed.
-\sa excludefiles
+\b {See also}: \l {excludefiles}.
-\code
+\badcode
exampledirs += ../../../examples/gui \
snippets
\endcode
-\sa {examples-variable}{examples}
-\sa examplesinstallpath
+\b {See also}: \l {examples-variable}{examples}, \l {examplesinstallpath}.
Add the two directories specified to the list of directories containing the source
code of the example files.
@@ -299,7 +288,7 @@ If QDoc encounters both \c exampledirs and \c examples, it will look first in th
\c examples directory. QDoc will accept the first matching file it finds. QDoc will
search in the directories specified, not in their subdirectories.
-\code
+\badcode
imagedirs += images \
../../../examples/gui/doc/images \
../../../doc/src/images \
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index 7f0d4b48b9..5153b0de5c 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -63,6 +63,7 @@ QString Generator::outSubdir_;
QStringList Generator::outFileNames_;
QSet<QString> Generator::outputFormats;
QHash<QString, QString> Generator::outputPrefixes;
+QHash<QString, QString> Generator::outputSuffixes;
QString Generator::project_;
QStringList Generator::scriptDirs;
QStringList Generator::scriptFiles;
@@ -259,7 +260,7 @@ void Generator::writeOutFileNames()
Attaches a QTextStream to the created file, which is written
to all over the place using out().
*/
-void Generator::beginSubPage(const InnerNode* node, const QString& fileName)
+void Generator::beginSubPage(const Aggregate* node, const QString& fileName)
{
QString path = outputDir() + QLatin1Char('/');
if (Generator::useOutputSubdirs() && !node->outputSubdirectory().isEmpty() &&
@@ -281,7 +282,7 @@ void Generator::beginSubPage(const InnerNode* node, const QString& fileName)
out->setCodec(outputCodec);
#endif
outStreamStack.push(out);
- const_cast<InnerNode*>(node)->setOutputFileName(fileName);
+ const_cast<Aggregate*>(node)->setOutputFileName(fileName);
}
/*!
@@ -300,7 +301,7 @@ QString Generator::fileBase(const Node *node) const
{
if (node->relates())
node = node->relates();
- else if (!node->isInnerNode())
+ else if (!node->isAggregate())
node = node->parent();
if (node->type() == Node::QmlPropertyGroup) {
node = node->parent();
@@ -329,21 +330,21 @@ QString Generator::fileBase(const Node *node) const
else if (node->isQmlType() || node->isQmlBasicType() ||
node->isJsType() || node->isJsBasicType()) {
base = node->name();
- if (!node->logicalModuleName().isEmpty()) {
- base.prepend(node->logicalModuleName() + QLatin1Char('-'));
- }
/*
To avoid file name conflicts in the html directory,
- we prepend a prefix (by default, "qml-") to the file name of QML
- element doc files.
+ we prepend a prefix (by default, "qml-") and an optional suffix
+ to the file name. The suffix, if one exists, is appended to the
+ module name.
*/
- if (node->isQmlType() || node->isQmlBasicType())
- base.prepend(outputPrefix(QLatin1String("QML")));
- else
- base.prepend(outputPrefix(QLatin1String("JS")));
+ if (!node->logicalModuleName().isEmpty()) {
+ base.prepend(node->logicalModuleName()
+ + outputSuffix(node)
+ + QLatin1Char('-'));
+ }
+ base.prepend(outputPrefix(node));
}
else if (node->isCollectionNode()) {
- base = node->name();
+ base = node->name() + outputSuffix(node);
if (base.endsWith(".html"))
base.truncate(base.length() - 5);
@@ -356,7 +357,7 @@ QString Generator::fileBase(const Node *node) const
else if (node->isModule()) {
base.append("-module");
}
- // Why not add "-group" for gropup pages?
+ // Why not add "-group" for group pages?
}
else {
const Node *p = node;
@@ -519,9 +520,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
else if (node->isQmlType() || node->isQmlBasicType() ||
node->isJsType() || node->isJsBasicType()) {
QString fb = fileBase(node);
- if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML"))))
- return fb + QLatin1Char('.') + currentGenerator()->fileExtension();
- else if (fb.startsWith(Generator::outputPrefix(QLatin1String("JS"))))
+ if (fb.startsWith(outputPrefix(node)))
return fb + QLatin1Char('.') + currentGenerator()->fileExtension();
else {
QString mq;
@@ -529,10 +528,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
mq = node->logicalModuleName().replace(QChar('.'),QChar('-'));
mq = mq.toLower() + QLatin1Char('-');
}
- QLatin1String prefix = QLatin1String("QML");
- if (node->isJsType() || node->isJsBasicType())
- prefix = QLatin1String("JS");
- return fdl+ Generator::outputPrefix(prefix) + mq + fileBase(node) +
+ return fdl + outputPrefix(node) + mq + fileBase(node) +
QLatin1Char('.') + currentGenerator()->fileExtension();
}
}
@@ -564,20 +560,19 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
break;
case Node::Function:
{
- const FunctionNode *functionNode =
- static_cast<const FunctionNode *>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
- if (functionNode->metaness() == FunctionNode::Dtor)
- anchorRef = "#dtor." + functionNode->name().mid(1);
+ if (fn->metaness() == FunctionNode::Dtor)
+ anchorRef = "#dtor." + fn->name().mid(1);
- else if (functionNode->associatedProperty())
- return fullDocumentLocation(functionNode->associatedProperty());
+ else if (fn->hasOneAssociatedProperty() && fn->doc().isEmpty())
+ return fullDocumentLocation(fn->firstAssociatedProperty());
- else if (functionNode->overloadNumber() > 1)
- anchorRef = QLatin1Char('#') + cleanRef(functionNode->name())
- + QLatin1Char('-') + QString::number(functionNode->overloadNumber());
+ else if (fn->overloadNumber() > 0)
+ anchorRef = QLatin1Char('#') + cleanRef(fn->name())
+ + QLatin1Char('-') + QString::number(fn->overloadNumber());
else
- anchorRef = QLatin1Char('#') + cleanRef(functionNode->name());
+ anchorRef = QLatin1Char('#') + cleanRef(fn->name());
break;
}
/*
@@ -750,12 +745,12 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (node->type() == Node::Document) {
const DocumentNode *dn = static_cast<const DocumentNode *>(node);
- if ((dn->subType() == Node::File) || (dn->subType() == Node::Image)) {
+ if ((dn->docSubtype() == Node::File) || (dn->docSubtype() == Node::Image)) {
quiet = true;
}
}
if (node->doc().isEmpty()) {
- if (!node->isWrapper() && !quiet && !node->isReimp()) { // ### might be unnecessary
+ if (!node->isWrapper() && !quiet && !node->isReimplemented()) { // ### might be unnecessary
node->location().warning(tr("No documentation for '%1'").arg(node->plainFullName()));
}
}
@@ -767,7 +762,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
if (!generateText(node->doc().body(), node, marker)) {
- if (node->isReimp())
+ if (node->isReimplemented())
return;
}
@@ -840,9 +835,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
else if (!(*a).isEmpty() && !documentedParams.contains(*a)) {
bool needWarning = (func->status() > Node::Obsolete);
- if (func->overloadNumber() > 1) {
- FunctionNode *primaryFunc =
- func->parent()->findFunctionNode(func->name());
+ if (func->overloadNumber() > 0) {
+ FunctionNode *primaryFunc = func->parent()->findFunctionNode(func->name());
if (primaryFunc) {
foreach (const Parameter &param,
primaryFunc->parameters()) {
@@ -853,7 +847,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
}
}
- if (needWarning && !func->isReimp())
+ if (needWarning && !func->isReimplemented())
node->doc().location().warning(
tr("Undocumented parameter '%1' in %2")
.arg(*a).arg(node->plainFullName()));
@@ -879,7 +873,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (dn->isExample()) {
generateExampleFiles(dn, marker);
}
- else if (dn->subType() == Node::File) {
+ else if (dn->docSubtype() == Node::File) {
Text text;
Quoter quoter;
Doc::quoteFromFile(dn->doc().location(), quoter, dn->name());
@@ -891,7 +885,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
}
-void Generator::generateClassLikeNode(InnerNode* /* classe */, CodeMarker* /* marker */)
+void Generator::generateClassLikeNode(Aggregate* /* classe */, CodeMarker* /* marker */)
{
}
@@ -920,7 +914,7 @@ void Generator::generateCollectionNode(CollectionNode* , CodeMarker* )
*/
void Generator::generateFileList(const DocumentNode* dn,
CodeMarker* marker,
- Node::SubType subtype,
+ Node::DocSubtype subtype,
const QString& tag)
{
int count = 0;
@@ -931,7 +925,7 @@ void Generator::generateFileList(const DocumentNode* dn,
<< Atom(Atom::ListLeft, openedList.styleString());
foreach (const Node* child, dn->childNodes()) {
- if (child->subType() == subtype) {
+ if (child->docSubtype() == subtype) {
++count;
QString file = child->name();
if (subtype == Node::Image) {
@@ -947,16 +941,10 @@ void Generator::generateFileList(const DocumentNode* dn,
userFriendlyFilePath);
outFileNames_ << prefix.mid(1) + userFriendlyFilePath;
userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
-
QString imgOutDir = outDir_ + prefix + userFriendlyFilePath;
if (!dirInfo.mkpath(imgOutDir))
- dn->location().fatal(tr("Cannot create output directory '%1'")
- .arg(imgOutDir));
-
- QString imgOutName = Config::copyFile(dn->location(),
- srcPath,
- file,
- imgOutDir);
+ dn->location().fatal(tr("Cannot create output directory '%1'").arg(imgOutDir));
+ Config::copyFile(dn->location(), srcPath, file, imgOutDir);
}
}
@@ -1032,7 +1020,7 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker)
/*!
Recursive writing of HTML files from the root \a node.
*/
-void Generator::generateInnerNode(InnerNode* node)
+void Generator::generateAggregate(Aggregate* node)
{
if (!node->url().isNull())
return;
@@ -1043,11 +1031,11 @@ void Generator::generateInnerNode(InnerNode* node)
if (node->isDocumentNode()) {
DocumentNode* docNode = static_cast<DocumentNode*>(node);
- if (docNode->subType() == Node::ExternalPage)
+ if (docNode->docSubtype() == Node::ExternalPage)
return;
- if (docNode->subType() == Node::Image)
+ if (docNode->docSubtype() == Node::Image)
return;
- if (docNode->subType() == Node::Page) {
+ if (docNode->docSubtype() == Node::Page) {
if (node->count() > 0)
qDebug("PAGE %s HAS CHILDREN", qPrintable(docNode->title()));
}
@@ -1117,8 +1105,8 @@ void Generator::generateInnerNode(InnerNode* node)
int i = 0;
while (i < node->childNodes().count()) {
Node *c = node->childNodes().at(i);
- if (c->isInnerNode() && c->access() != Node::Private) {
- generateInnerNode((InnerNode*)c);
+ if (c->isAggregate() && c->access() != Node::Private) {
+ generateAggregate((Aggregate*)c);
}
++i;
}
@@ -1127,7 +1115,7 @@ void Generator::generateInnerNode(InnerNode* node)
/*!
Generate a list of maintainers in the output
*/
-void Generator::generateMaintainerList(const InnerNode* node, CodeMarker* marker)
+void Generator::generateMaintainerList(const Aggregate* node, CodeMarker* marker)
{
QStringList sl = getMetadataElements(node,"maintainer");
@@ -1252,7 +1240,8 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
Text text;
switch (node->status()) {
- case Node::Commendable:
+ case Node::Active:
+ // Do nothing.
break;
case Node::Preliminary:
text << Atom::ParaLeft
@@ -1265,19 +1254,19 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
break;
case Node::Deprecated:
text << Atom::ParaLeft;
- if (node->isInnerNode())
+ if (node->isAggregate())
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD);
text << "This " << typeString(node) << " is deprecated.";
- if (node->isInnerNode())
+ if (node->isAggregate())
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
text << Atom::ParaRight;
break;
case Node::Obsolete:
text << Atom::ParaLeft;
- if (node->isInnerNode())
+ if (node->isAggregate())
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD);
text << "This " << typeString(node) << " is obsolete.";
- if (node->isInnerNode())
+ if (node->isAggregate())
text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD);
text << " It is provided to keep old source code working. "
<< "We strongly advise against "
@@ -1285,7 +1274,7 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
break;
case Node::Compat:
// reimplemented in HtmlGenerator subclass
- if (node->isInnerNode()) {
+ if (node->isAggregate()) {
text << Atom::ParaLeft
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
<< "This "
@@ -1384,8 +1373,8 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
<< Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
<< " ";
- if (node->isInnerNode()) {
- const InnerNode* innerNode = static_cast<const InnerNode*>(node);
+ if (node->isAggregate()) {
+ const Aggregate* innerNode = static_cast<const Aggregate*>(node);
text << "All functions in this "
<< typeString(node)
<< " are ";
@@ -1485,11 +1474,80 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
}
/*!
- Traverses the current tree to generate all the documentation.
+ If the node is an overloaded signal, and a node with an example on how to connect to it
+ */
+void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker)
+{
+ if (node->type() != Node::Function)
+ return;
+ const FunctionNode *func = static_cast<const FunctionNode *>(node);
+ if (func->metaness() != FunctionNode::Signal)
+ return;
+ if (node->parent()->overloads(node->name()).count() <= 1)
+ return;
+
+
+ // Compute a friendly name for the object of that instance.
+ // e.g: "QAbstractSocket" -> "abstractSocket"
+ QString objectName = node->parent()->name();
+ if (objectName.size() >= 2) {
+ if (objectName[0] == 'Q')
+ objectName = objectName.mid(1);
+ objectName[0] = objectName[0].toLower();
+ }
+
+
+ // We have an overloaded signal, show an example
+ QString code = "connect(" + objectName + ", static_cast<" + func->returnType()
+ + "(" + func->parent()->name() + "::*)(";
+ for (int i = 0; i < func->parameters().size(); ++i) {
+ if (i != 0)
+ code += ", ";
+ const Parameter &p = func->parameters().at(i);
+ code += p.leftType() + p.rightType();
+ }
+
+ code += ")";
+ if (func->isConst())
+ code += " const";
+ code += ">(&" + func->parent()->name() + "::" + func->name() + "),\n [=](";
+
+ for (int i = 0; i < func->parameters().size(); ++i) {
+ if (i != 0)
+ code += ", ";
+ const Parameter &p = func->parameters().at(i);
+ code += p.leftType();
+ if (code[code.size()-1].isLetterOrNumber())
+ code += " ";
+ code += p.name() + p.rightType();
+ }
+
+ code += "){ /* ... */ });";
+
+ Text text;
+ text << Atom::ParaLeft
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD)
+ << "Note:"
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD)
+ << "Signal "
+ << Atom(Atom::FormattingLeft,ATOM_FORMATTING_ITALIC)
+ << node->name()
+ << Atom(Atom::FormattingRight,ATOM_FORMATTING_ITALIC)
+ << " is overloaded in this class. "
+ "To connect to this one using the function pointer syntax, you must "
+ "specify the signal type in a static cast, as shown in this example:"
+ << Atom(Atom::Code, marker->markedUpCode(code, node, func->location()));
+
+ generateText(text, node, marker);
+}
+
+
+/*!
+ Traverses the database recursivly to generate all the documentation.
*/
void Generator::generateDocs()
{
- generateInnerNode(qdb_->primaryTreeRoot());
+ generateAggregate(qdb_->primaryTreeRoot());
}
Generator *Generator::generatorForFormat(const QString& format)
@@ -1512,7 +1570,7 @@ Generator *Generator::generatorForFormat(const QString& format)
i.e. Once you call this function for a particular \a t,
you consume \a t.
*/
-QString Generator::getMetadataElement(const InnerNode* inner, const QString& t)
+QString Generator::getMetadataElement(const Aggregate* inner, const QString& t)
{
QString s;
QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap());
@@ -1533,7 +1591,7 @@ QString Generator::getMetadataElement(const InnerNode* inner, const QString& t)
having the key \a t are erased. i.e. Once you call this
function for a particular \a t, you consume \a t.
*/
-QStringList Generator::getMetadataElements(const InnerNode* inner, const QString& t)
+QStringList Generator::getMetadataElements(const Aggregate* inner, const QString& t)
{
QStringList s;
QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap());
@@ -1628,12 +1686,6 @@ void Generator::initialize(const Config &config)
if (!dirInfo.exists(outDir_ + "/images") && !dirInfo.mkdir(outDir_ + "/images"))
config.lastLocation().fatal(tr("Cannot create images directory '%1'").arg(outDir_ + "/images"));
- if (!dirInfo.exists(outDir_ + "/images/used-in-examples") && !dirInfo.mkdir(outDir_ + "/images/used-in-examples"))
- config.lastLocation().fatal(tr("Cannot create images used in examples directory '%1'").arg(outDir_ + "/images/used-in-examples"));
- if (!dirInfo.exists(outDir_ + "/scripts") && !dirInfo.mkdir(outDir_ + "/scripts"))
- config.lastLocation().fatal(tr("Cannot create scripts directory '%1'").arg(outDir_ + "/scripts"));
- if (!dirInfo.exists(outDir_ + "/style") && !dirInfo.mkdir(outDir_ + "/style"))
- config.lastLocation().fatal(tr("Cannot create style directory '%1'").arg(outDir_ + "/style"));
}
imageFiles = config.getCanonicalPathList(CONFIG_IMAGES);
@@ -1672,23 +1724,41 @@ void Generator::initialize(const Config &config)
// Documentation template handling
QStringList scripts = config.getCanonicalPathList((*g)->format()+Config::dot+CONFIG_SCRIPTS, true);
- e = scripts.constBegin();
- while (e != scripts.constEnd()) {
- QString filePath = *e;
- if (!filePath.isEmpty())
- Config::copyFile(config.lastLocation(), filePath, filePath,
- (*g)->outputDir() + "/scripts");
- ++e;
+ if (!scripts.isEmpty()) {
+ QDir dirInfo;
+ if (!dirInfo.exists(outDir_ + "/scripts") && !dirInfo.mkdir(outDir_ + "/scripts")) {
+ config.lastLocation().fatal(tr("Cannot create scripts directory '%1'")
+ .arg(outDir_ + "/scripts"));
+ }
+ else {
+ e = scripts.constBegin();
+ while (e != scripts.constEnd()) {
+ QString filePath = *e;
+ if (!filePath.isEmpty())
+ Config::copyFile(config.lastLocation(), filePath, filePath,
+ (*g)->outputDir() + "/scripts");
+ ++e;
+ }
+ }
}
QStringList styles = config.getCanonicalPathList((*g)->format()+Config::dot+CONFIG_STYLESHEETS, true);
- e = styles.constBegin();
- while (e != styles.constEnd()) {
- QString filePath = *e;
- if (!filePath.isEmpty())
- Config::copyFile(config.lastLocation(), filePath, filePath,
- (*g)->outputDir() + "/style");
- ++e;
+ if (!styles.isEmpty()) {
+ QDir dirInfo;
+ if (!dirInfo.exists(outDir_ + "/style") && !dirInfo.mkdir(outDir_ + "/style")) {
+ config.lastLocation().fatal(tr("Cannot create style directory '%1'")
+ .arg(outDir_ + "/style"));
+ }
+ else {
+ e = styles.constBegin();
+ while (e != styles.constEnd()) {
+ QString filePath = *e;
+ if (!filePath.isEmpty())
+ Config::copyFile(config.lastLocation(), filePath, filePath,
+ (*g)->outputDir() + "/style");
+ ++e;
+ }
+ }
}
}
++g;
@@ -1732,15 +1802,24 @@ void Generator::initialize(const Config &config)
project_ = config.getString(CONFIG_PROJECT);
- QStringList prefixes = config.getStringList(CONFIG_OUTPUTPREFIXES);
- if (!prefixes.isEmpty()) {
- foreach (const QString &prefix, prefixes)
+ outputPrefixes.clear();
+ QStringList items = config.getStringList(CONFIG_OUTPUTPREFIXES);
+ if (!items.isEmpty()) {
+ foreach (const QString &prefix, items)
outputPrefixes[prefix] = config.getString(CONFIG_OUTPUTPREFIXES + Config::dot + prefix);
}
else {
outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
outputPrefixes[QLatin1String("JS")] = QLatin1String("js-");
}
+
+ outputSuffixes.clear();
+ items = config.getStringList(CONFIG_OUTPUTSUFFIXES);
+ if (!items.isEmpty()) {
+ foreach (const QString &suffix, items)
+ outputSuffixes[suffix] = config.getString(CONFIG_OUTPUTSUFFIXES + Config::dot + suffix);
+ }
+
noLinkErrors_ = config.getBool(CONFIG_NOLINKERRORS);
autolinkErrors_ = config.getBool(CONFIG_AUTOLINKERRORS);
}
@@ -1770,7 +1849,7 @@ void Generator::initializeGenerator(const Config& config)
singleExec_ = config.getBool(CONFIG_SINGLEEXEC);
}
-bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType)
+bool Generator::matchAhead(const Atom *atom, Atom::AtomType expectedAtomType)
{
return atom->next() != 0 && atom->next()->type() == expectedAtomType;
}
@@ -1790,9 +1869,25 @@ QString Generator::outFileName()
return QFileInfo(static_cast<QFile*>(out().device())->fileName()).fileName();
}
-QString Generator::outputPrefix(const QString &nodeType)
+QString Generator::outputPrefix(const Node *node)
+{
+ // Prefix is applied to QML and JS types
+ if (node->isQmlType() || node->isQmlBasicType())
+ return outputPrefixes[QLatin1String("QML")];
+ if (node->isJsType() || node->isJsBasicType())
+ return outputPrefixes[QLatin1String("JS")];
+ return QString();
+}
+
+QString Generator::outputSuffix(const Node *node)
{
- return outputPrefixes[nodeType];
+ // Suffix is applied to QML and JS types, as
+ // well as module pages.
+ if (node->isQmlModule() || node->isQmlType() || node->isQmlBasicType())
+ return outputSuffixes[QLatin1String("QML")];
+ if (node->isJsModule() || node->isJsType() || node->isJsBasicType())
+ return outputSuffixes[QLatin1String("JS")];
+ return QString();
}
bool Generator::parseArg(const QString& src,
@@ -1917,7 +2012,7 @@ void Generator::singularPlural(Text& text, const NodeList& nodes)
text << " are";
}
-int Generator::skipAtoms(const Atom *atom, Atom::Type type) const
+int Generator::skipAtoms(const Atom *atom, Atom::AtomType type) const
{
int skipAhead = 0;
atom = atom->next();
@@ -1947,7 +2042,7 @@ void Generator::supplementAlsoList(const Node *node, QList<Text> &alsoList)
{
if (node->type() == Node::Function) {
const FunctionNode *func = static_cast<const FunctionNode *>(node);
- if (func->overloadNumber() == 1) {
+ if (func->overloadNumber() == 0) {
QString alternateName;
const FunctionNode *alternateFunc = 0;
diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h
index 9a1672dac4..6c44cd189c 100644
--- a/src/tools/qdoc/generator.h
+++ b/src/tools/qdoc/generator.h
@@ -106,7 +106,7 @@ public:
static QString cleanRef(const QString& ref);
protected:
- virtual void beginSubPage(const InnerNode* node, const QString& fileName);
+ virtual void beginSubPage(const Aggregate* node, const QString& fileName);
virtual void endSubPage();
virtual QString fileBase(const Node* node) const;
virtual QString fileExtension() const = 0;
@@ -114,15 +114,15 @@ protected:
virtual void generateAlsoList(const Node *node, CodeMarker *marker);
virtual int generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker);
virtual void generateBody(const Node *node, CodeMarker *marker);
- virtual void generateClassLikeNode(InnerNode* inner, CodeMarker* marker);
+ virtual void generateClassLikeNode(Aggregate* inner, CodeMarker* marker);
virtual void generateQmlTypePage(QmlTypeNode* , CodeMarker* ) { }
virtual void generateQmlBasicTypePage(QmlBasicTypeNode* , CodeMarker* ) { }
virtual void generateDocumentNode(DocumentNode* dn, CodeMarker* marker);
virtual void generateCollectionNode(CollectionNode* cn, CodeMarker* marker);
virtual void generateInheritedBy(const ClassNode *classe, CodeMarker *marker);
virtual void generateInherits(const ClassNode *classe, CodeMarker *marker);
- virtual void generateInnerNode(InnerNode* node);
- virtual void generateMaintainerList(const InnerNode* node, CodeMarker* marker);
+ virtual void generateAggregate(Aggregate* node);
+ virtual void generateMaintainerList(const Aggregate* node, CodeMarker* marker);
virtual void generateQmlInheritedBy(const QmlTypeNode* qcn, CodeMarker* marker);
virtual void generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker);
virtual bool generateQmlText(const Text& text,
@@ -131,11 +131,12 @@ protected:
const QString& qmlName);
virtual bool generateText(const Text& text, const Node *relative, CodeMarker *marker);
virtual QString imageFileName(const Node *relative, const QString& fileBase);
- virtual int skipAtoms(const Atom *atom, Atom::Type type) const;
+ virtual int skipAtoms(const Atom *atom, Atom::AtomType type) const;
virtual QString typeString(const Node *node);
- static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType);
- static QString outputPrefix(const QString &nodeType);
+ static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType);
+ static QString outputPrefix(const Node* node);
+ static QString outputSuffix(const Node* node);
static void singularPlural(Text& text, const NodeList& nodes);
static void supplementAlsoList(const Node *node, QList<Text> &alsoList);
static QString trimmedTrailing(const QString &string);
@@ -153,14 +154,15 @@ protected:
void generateExampleFiles(const DocumentNode *dn, CodeMarker *marker);
void generateFileList(const DocumentNode* dn,
CodeMarker* marker,
- Node::SubType subtype,
+ Node::DocSubtype subtype,
const QString& tag);
void generateSince(const Node *node, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
void generatePrivateSignalNote(const Node* node, CodeMarker* marker);
void generateThreadSafeness(const Node *node, CodeMarker *marker);
- QString getMetadataElement(const InnerNode* inner, const QString& t);
- QStringList getMetadataElements(const InnerNode* inner, const QString& t);
+ QString getMetadataElement(const Aggregate* inner, const QString& t);
+ QStringList getMetadataElements(const Aggregate* inner, const QString& t);
+ void generateOverloadedSignal(const Node *node, CodeMarker *marker);
QString indent(int level, const QString& markedCode);
QTextStream& out();
QString outFileName();
@@ -213,6 +215,7 @@ private:
static QStringList outFileNames_;
static QSet<QString> outputFormats;
static QHash<QString, QString> outputPrefixes;
+ static QHash<QString, QString> outputSuffixes;
static QStringList scriptDirs;
static QStringList scriptFiles;
static QStringList styleDirs;
diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp
index d00f75e32d..8161913f1f 100644
--- a/src/tools/qdoc/helpprojectwriter.cpp
+++ b/src/tools/qdoc/helpprojectwriter.cpp
@@ -107,13 +107,13 @@ void HelpProjectWriter::reset(const Config &config,
subproject.sortPages = config.getBool(subprefix + "sortPages");
subproject.type = config.getString(subprefix + "type");
readSelectors(subproject, config.getStringList(subprefix + "selectors"));
- project.subprojects[name] = subproject;
+ project.subprojects.append(subproject);
}
if (project.subprojects.isEmpty()) {
SubProject subproject;
readSelectors(subproject, config.getStringList(prefix + "selectors"));
- project.subprojects.insert(QString(), subproject);
+ project.subprojects.insert(0, subproject);
}
projects.append(project);
@@ -122,10 +122,11 @@ void HelpProjectWriter::reset(const Config &config,
void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList &selectors)
{
- QHash<QString, Node::Type> typeHash;
+ QHash<QString, Node::NodeType> typeHash;
typeHash["namespace"] = Node::Namespace;
typeHash["class"] = Node::Class;
- typeHash["fake"] = Node::Document;
+ typeHash["doc"] = Node::Document;
+ typeHash["fake"] = Node::Document; // Legacy alias for 'doc'
typeHash["enum"] = Node::Enum;
typeHash["typedef"] = Node::Typedef;
typeHash["function"] = Node::Function;
@@ -139,17 +140,18 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
typeHash["qmlsignalhandler"] = Node::QmlSignalHandler;
typeHash["qmlmethod"] = Node::QmlMethod;
typeHash["qmlpropertygroup"] = Node::QmlPropertyGroup;
- typeHash["qmlclass"] = Node::QmlType;
+ typeHash["qmlclass"] = Node::QmlType; // Legacy alias for 'qmltype'
+ typeHash["qmltype"] = Node::QmlType;
typeHash["qmlbasictype"] = Node::QmlBasicType;
- QHash<QString, Node::SubType> subTypeHash;
- subTypeHash["example"] = Node::Example;
- subTypeHash["headerfile"] = Node::HeaderFile;
- subTypeHash["file"] = Node::File;
- subTypeHash["page"] = Node::Page;
- subTypeHash["externalpage"] = Node::ExternalPage;
+ QHash<QString, Node::DocSubtype> docSubtypeHash;
+ docSubtypeHash["example"] = Node::Example;
+ docSubtypeHash["headerfile"] = Node::HeaderFile;
+ docSubtypeHash["file"] = Node::File;
+ docSubtypeHash["page"] = Node::Page;
+ docSubtypeHash["externalpage"] = Node::ExternalPage;
- QSet<Node::SubType> allSubTypes = QSet<Node::SubType>::fromList(subTypeHash.values());
+ QSet<Node::DocSubtype> allSubTypes = QSet<Node::DocSubtype>::fromList(docSubtypeHash.values());
foreach (const QString &selector, selectors) {
QStringList pieces = selector.split(QLatin1Char(':'));
@@ -158,16 +160,20 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
if (typeHash.contains(lower))
subproject.selectors[typeHash[lower]] = allSubTypes;
} else if (pieces.size() >= 2) {
- QString lower = pieces[0].toLower();
+ QString docType = pieces[0].toLower();
pieces = pieces[1].split(QLatin1Char(','));
- if (typeHash.contains(lower)) {
- QSet<Node::SubType> subTypes;
+ if (typeHash.contains(docType)) {
+ QSet<Node::DocSubtype> docSubtypes;
for (int i = 0; i < pieces.size(); ++i) {
- QString lower = pieces[i].toLower();
- if (subTypeHash.contains(lower))
- subTypes.insert(subTypeHash[lower]);
+ QString piece = pieces[i].toLower();
+ if (typeHash[docType] == Node::Group) {
+ subproject.groups << piece;
+ continue;
+ }
+ if (docSubtypeHash.contains(piece))
+ docSubtypes.insert(docSubtypeHash[piece]);
}
- subproject.selectors[typeHash[lower]] = subTypes;
+ subproject.selectors[typeHash[docType]] = docSubtypes;
}
}
}
@@ -243,36 +249,40 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
if (!docPath.isEmpty() && project.excluded.contains(docPath))
return false;
- QString objName;
- if (node->isDocumentNode()) {
- const DocumentNode *fake = static_cast<const DocumentNode *>(node);
- objName = fake->fullTitle();
- }
- else
- objName = node->fullDocumentName();
-
+ QString objName = node->isDocumentNode() ? node->fullTitle() : node->fullDocumentName();
// Only add nodes to the set for each subproject if they match a selector.
// Those that match will be listed in the table of contents.
- foreach (const QString &name, project.subprojects.keys()) {
- SubProject subproject = project.subprojects[name];
+ for (int i = 0; i < project.subprojects.length(); i++) {
+ SubProject subproject = project.subprojects[i];
// No selectors: accept all nodes.
if (subproject.selectors.isEmpty()) {
- project.subprojects[name].nodes[objName] = node;
+ project.subprojects[i].nodes[objName] = node;
}
else if (subproject.selectors.contains(node->type())) {
+ // Add all group members for 'group:name' selector
+ if (node->isGroup()) {
+ if (project.subprojects[i].groups.contains(node->name())) {
+ const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ foreach (const Node* m, cn->members()) {
+ QString memberName = m->isDocumentNode()
+ ? m->fullTitle() : m->fullDocumentName();
+ project.subprojects[i].nodes[memberName] = m;
+ }
+ }
+ }
// Accept only the node types in the selectors hash.
- if (node->type() != Node::Document)
- project.subprojects[name].nodes[objName] = node;
+ else if (node->type() != Node::Document)
+ project.subprojects[i].nodes[objName] = node;
else {
- // Accept only fake nodes with subtypes contained in the selector's
+ // Accept only doc nodes with subtypes contained in the selector's
// mask.
const DocumentNode *docNode = static_cast<const DocumentNode *>(node);
- if (subproject.selectors[node->type()].contains(docNode->subType()) &&
- docNode->subType() != Node::ExternalPage &&
+ if (subproject.selectors[node->type()].contains(docNode->docSubtype()) &&
+ docNode->docSubtype() != Node::ExternalPage &&
!docNode->fullTitle().isEmpty()) {
- project.subprojects[name].nodes[objName] = node;
+ project.subprojects[i].nodes[objName] = node;
}
}
}
@@ -291,8 +301,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
QStringList details;
details << keyword->string()
<< keyword->string()
- << gen_->fullDocumentLocation(node, false) +
- QLatin1Char('#') + Doc::canonicalTitle(keyword->string());
+ << gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
}
else
@@ -341,8 +350,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
QStringList details;
details << keyword->string()
<< keyword->string()
- << gen_->fullDocumentLocation(node, false) +
- QLatin1Char('#') + Doc::canonicalTitle(keyword->string());
+ << gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
}
else
@@ -411,19 +419,18 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
// attributes.
case Node::Document: {
const DocumentNode *docNode = static_cast<const DocumentNode*>(node);
- if (docNode->subType() != Node::ExternalPage &&
- docNode->subType() != Node::Image &&
+ if (docNode->docSubtype() != Node::ExternalPage &&
+ docNode->docSubtype() != Node::Image &&
!docNode->fullTitle().isEmpty()) {
- if (docNode->subType() != Node::File) {
+ if (docNode->docSubtype() != Node::File) {
if (docNode->doc().hasKeywords()) {
foreach (const Atom *keyword, docNode->doc().keywords()) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
<< keyword->string()
- << gen_->fullDocumentLocation(node, false) +
- QLatin1Char('#') + Doc::canonicalTitle(keyword->string());
+ << gen_->fullDocumentLocation(node, false);
project.keywords.append(details);
} else
docNode->doc().location().warning(
@@ -461,13 +468,13 @@ void HelpProjectWriter::generateSections(HelpProject &project,
/*
Don't include index nodes in the help file. Or DITA map nodes.
*/
- if (node->isIndexNode() || node->subType() == Node::DitaMap)
+ if (node->isIndexNode() || node->docSubtype() == Node::DitaMap)
return;
if (!generateSection(project, writer, node))
return;
- if (node->isInnerNode()) {
- const InnerNode *inner = static_cast<const InnerNode *>(node);
+ if (node->isAggregate()) {
+ const Aggregate *inner = static_cast<const Aggregate *>(node);
// Ensure that we don't visit nodes more than once.
QMap<QString, const Node*> childMap;
@@ -491,7 +498,7 @@ void HelpProjectWriter::generateSections(HelpProject &project,
because The Qml/Js Property Group is
an actual documented thing.
*/
- const InnerNode* inner = static_cast<const InnerNode*>(childNode);
+ const Aggregate* inner = static_cast<const Aggregate*>(childNode);
foreach (const Node* n, inner->childNodes()) {
if (n->access() == Node::Private)
continue;
@@ -620,7 +627,7 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
writer.writeAttribute("ref", href);
writer.writeAttribute("title", docNode->fullTitle());
- if (docNode->subType() == Node::HeaderFile)
+ if (docNode->docSubtype() == Node::HeaderFile)
addMembers(project, writer, node);
writer.writeEndElement(); // section
@@ -707,8 +714,8 @@ void HelpProjectWriter::generateProject(HelpProject &project)
generateSections(project, writer, rootNode);
- foreach (const QString &name, project.subprojects.keys()) {
- SubProject subproject = project.subprojects[name];
+ for (int i = 0; i < project.subprojects.length(); i++) {
+ SubProject subproject = project.subprojects[i];
if (subproject.type == QLatin1String("manual")) {
@@ -763,13 +770,12 @@ void HelpProjectWriter::generateProject(HelpProject &project)
} else {
- if (!name.isEmpty()) {
- writer.writeStartElement("section");
- QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, 0),
+ writer.writeStartElement("section");
+ QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, 0),
false);
- writer.writeAttribute("ref", indexPath);
- writer.writeAttribute("title", subproject.title);
- }
+ writer.writeAttribute("ref", indexPath);
+ writer.writeAttribute("title", subproject.title);
+
if (subproject.sortPages) {
QStringList titles = subproject.nodes.keys();
titles.sort();
@@ -809,8 +815,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
}
- if (!name.isEmpty())
- writer.writeEndElement(); // section
+ writer.writeEndElement(); // section
}
}
diff --git a/src/tools/qdoc/helpprojectwriter.h b/src/tools/qdoc/helpprojectwriter.h
index efc2596296..e4cd1404c7 100644
--- a/src/tools/qdoc/helpprojectwriter.h
+++ b/src/tools/qdoc/helpprojectwriter.h
@@ -50,10 +50,11 @@ struct SubProject
{
QString title;
QString indexTitle;
- QHash<Node::Type, QSet<DocumentNode::SubType> > selectors;
+ QHash<Node::NodeType, QSet<DocumentNode::DocSubtype> > selectors;
bool sortPages;
QString type;
QHash<QString, const Node *> nodes;
+ QStringList groups;
};
struct HelpProject
@@ -70,7 +71,7 @@ struct HelpProject
QSet<QString> filterAttributes;
QHash<QString, QSet<QString> > customFilters;
QSet<QString> excluded;
- QMap<QString, SubProject> subprojects;
+ QList<SubProject> subprojects;
QHash<const Node *, QSet<Node::Status> > memberStatus;
bool includeIndexNodes;
};
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 4aed6085cd..4c14123aa7 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -49,6 +49,7 @@
#include <qiterator.h>
#include <qtextcodec.h>
#include <quuid.h>
+#include <qmap.h>
QT_BEGIN_NAMESPACE
@@ -71,11 +72,11 @@ static void addLink(const QString &linkTarget,
QString *res)
{
if (!linkTarget.isEmpty()) {
- *res += "<a href=\"";
+ *res += QLatin1String("<a href=\"");
*res += linkTarget;
- *res += "\">";
+ *res += QLatin1String("\">");
*res += nestedStuff;
- *res += "</a>";
+ *res += QLatin1String("</a>");
}
else {
*res += nestedStuff;
@@ -139,8 +140,8 @@ void HtmlGenerator::initializeGenerator(const Config &config)
*/
int i = 0;
while (defaults[i].key) {
- formattingLeftMap().insert(defaults[i].key, defaults[i].left);
- formattingRightMap().insert(defaults[i].key, defaults[i].right);
+ formattingLeftMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].left));
+ formattingRightMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].right));
i++;
}
@@ -180,7 +181,7 @@ void HtmlGenerator::initializeGenerator(const Config &config)
projectDescription = config.getString(CONFIG_DESCRIPTION);
if (projectDescription.isEmpty() && !project.isEmpty())
- projectDescription = project + " Reference Documentation";
+ projectDescription = project + QLatin1String(" Reference Documentation");
projectUrl = config.getString(CONFIG_URL);
tagFile_ = config.getString(CONFIG_TAGFILE);
@@ -236,8 +237,8 @@ void HtmlGenerator::initializeGenerator(const Config &config)
headerStyles = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSTYLES);
QString prefix = CONFIG_QHP + Config::dot + project + Config::dot;
- manifestDir = "qthelp://" + config.getString(prefix + "namespace");
- manifestDir += QLatin1Char('/') + config.getString(prefix + "virtualFolder") + QLatin1Char('/');
+ manifestDir = QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace"));
+ manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder")) + QLatin1Char('/');
readManifestMetaContent(config);
examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH);
if (!examplesPath.isEmpty())
@@ -282,12 +283,17 @@ QString HtmlGenerator::format()
*/
void HtmlGenerator::generateKeywordAnchors(const Node* node)
{
+ Q_UNUSED(node);
+ // Disabled: keywords always link to the top of the QDoc
+ // comment they appear in, and do not use a dedicated anchor.
+#if 0
if (!node->doc().isEmpty()) {
const QList<Atom*>& keywords = node->doc().keywords();
foreach (Atom* a, keywords) {
- out() << "<a name=\"" << Doc::canonicalTitle(a->string()) << "\"></a>";
+ out() << QLatin1String("<a name=\"") << Doc::canonicalTitle(a->string()) << QLatin1String("\"></a>");
}
}
+#endif
}
/*!
@@ -470,18 +476,10 @@ QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker* marker, int& c
*/
int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker)
{
- int skipAhead = 0;
+ int idx, skipAhead = 0;
static bool in_para = false;
switch (atom->type()) {
- case Atom::AbstractLeft:
- if (relative)
- relative->doc().location().warning(tr("\abstract is not implemented."));
- else
- Location::information(tr("\abstract is not implemented."));
- break;
- case Atom::AbstractRight:
- break;
case Atom::AutoLink:
case Atom::NavAutoLink:
if (!inLink_ && !inContents_ && !inSectionHeading_) {
@@ -547,9 +545,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
else
out() << "variable";
QStringList words = str.split(QLatin1Char(' '));
- if (!(words.first() == "contains" || words.first() == "specifies"
- || words.first() == "describes" || words.first() == "defines"
- || words.first() == "holds" || words.first() == "determines"))
+ if (!(words.first() == QLatin1String("contains") || words.first() == QLatin1String("specifies")
+ || words.first() == QLatin1String("describes") || words.first() == QLatin1String("defines")
+ || words.first() == QLatin1String("holds") || words.first() == QLatin1String("determines")))
out() << " holds ";
else
out() << ' ';
@@ -668,74 +666,83 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
break;
case Atom::AnnotatedList:
{
- CollectionNode* cn = qdb_->getCollection(atom->string(), Node::DOC);
+ const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::DOC);
if (cn)
generateList(cn, marker, atom->string());
}
break;
case Atom::GeneratedList:
- if (atom->string() == "annotatedclasses") {
+ if (atom->string() == QLatin1String("annotatedclasses")) {
generateAnnotatedList(relative, marker, qdb_->getCppClasses());
}
- else if (atom->string() == "classes") {
+ else if (atom->string() == QLatin1String("classes")) {
generateCompactList(Generic, relative, qdb_->getCppClasses(), true, QStringLiteral(""));
}
else if (atom->string().contains("classes ")) {
QString rootName = atom->string().mid(atom->string().indexOf("classes") + 7).trimmed();
generateCompactList(Generic, relative, qdb_->getCppClasses(), true, rootName);
}
- else if (atom->string() == "qmlbasictypes") {
+ else if (atom->string() == QLatin1String("qmlbasictypes")) {
generateCompactList(Generic, relative, qdb_->getQmlBasicTypes(), true, QStringLiteral(""));
}
- else if (atom->string() == "qmltypes") {
+ else if (atom->string() == QLatin1String("qmltypes")) {
generateCompactList(Generic, relative, qdb_->getQmlTypes(), true, QStringLiteral(""));
}
- else if (atom->string().contains("classesbymodule")) {
- QString physicalModuleName = atom->string().mid(atom->string().indexOf("classesbymodule") + 15).trimmed();
+ else if ((idx = atom->string().indexOf(QStringLiteral("bymodule"))) != -1) {
+ QString moduleName = atom->string().mid(idx + 8).trimmed();
+ Node::Genus genus = Node::CPP;
+ if (atom->string().startsWith(QStringLiteral("qml")))
+ genus = Node::QML;
+ else if (atom->string().startsWith(QStringLiteral("js")))
+ genus = Node::JS;
QDocDatabase* qdb = QDocDatabase::qdocDB();
- CollectionNode* cn = qdb->findModule(physicalModuleName);
+ const CollectionNode* cn = qdb->getCollectionNode(moduleName, genus);
if (cn) {
- NodeMap m;
- cn->getMemberClasses(m);
- if (!m.isEmpty()) {
- generateAnnotatedList(relative, marker, m);
+ if (genus == Node::CPP) {
+ NodeMap m;
+ cn->getMemberClasses(m);
+ if (!m.isEmpty()) {
+ generateAnnotatedList(relative, marker, m);
+ }
}
+ else
+ generateAnnotatedList(relative, marker, cn->members());
}
}
- else if (atom->string() == "classhierarchy") {
+ else if (atom->string() == QLatin1String("classhierarchy")) {
generateClassHierarchy(relative, qdb_->getCppClasses());
}
- else if (atom->string() == "obsoleteclasses") {
+ else if (atom->string() == QLatin1String("obsoleteclasses")) {
generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false, QStringLiteral("Q"));
}
- else if (atom->string() == "obsoleteqmltypes") {
+ else if (atom->string() == QLatin1String("obsoleteqmltypes")) {
generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false, QStringLiteral(""));
}
- else if (atom->string() == "obsoletecppmembers") {
+ else if (atom->string() == QLatin1String("obsoletecppmembers")) {
generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false, QStringLiteral("Q"));
}
- else if (atom->string() == "obsoleteqmlmembers") {
+ else if (atom->string() == QLatin1String("obsoleteqmlmembers")) {
generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false, QStringLiteral(""));
}
- else if (atom->string() == "functionindex") {
+ else if (atom->string() == QLatin1String("functionindex")) {
generateFunctionIndex(relative);
}
- else if (atom->string() == "legalese") {
+ else if (atom->string() == QLatin1String("legalese")) {
generateLegaleseList(relative, marker);
}
- else if (atom->string() == "overviews") {
+ else if (atom->string() == QLatin1String("overviews")) {
generateList(relative, marker, "overviews");
}
- else if (atom->string() == "cpp-modules") {
+ else if (atom->string() == QLatin1String("cpp-modules")) {
generateList(relative, marker, "cpp-modules");
}
- else if (atom->string() == "qml-modules") {
+ else if (atom->string() == QLatin1String("qml-modules")) {
generateList(relative, marker, "qml-modules");
}
- else if (atom->string() == "namespaces") {
+ else if (atom->string() == QLatin1String("namespaces")) {
generateAnnotatedList(relative, marker, qdb_->getNamespaces());
}
- else if (atom->string() == "related") {
+ else if (atom->string() == QLatin1String("related")) {
generateList(relative, marker, "related");
}
#if 0
@@ -743,7 +750,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
This is not used in Qt5, as of 10/02/2014
Remove permanently if it is not missed.
*/
- else if (atom->string() == "relatedinline") {
+ else if (atom->string() == QLatin1String("relatedinline")) {
const DocumentNode *dn = static_cast<const DocumentNode *>(relative);
if (dn && !dn->members().isEmpty()) {
// Reverse the list into the original scan order.
@@ -1218,13 +1225,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
p2 = atom->string(1);
}
if (!p1.isEmpty()) {
- if (p1 == "borderless")
+ if (p1 == QLatin1String("borderless"))
attr = p1;
else if (p1.contains("%"))
width = p1;
}
if (!p2.isEmpty()) {
- if (p2 == "borderless")
+ if (p2 == QLatin1String("borderless"))
attr = p2;
else if (p2.contains("%"))
width = p2;
@@ -1336,7 +1343,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
/*!
Generate a reference page for a C++ class or a C++ namespace.
*/
-void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
+void HtmlGenerator::generateClassLikeNode(Aggregate* inner, CodeMarker* marker)
{
QList<Section> sections;
QList<Section>::ConstIterator s;
@@ -1485,7 +1492,7 @@ void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
const FunctionNode *func = reinterpret_cast<const FunctionNode *>(*m);
if (func->metaness() == FunctionNode::Ctor ||
func->metaness() == FunctionNode::Dtor ||
- func->overloadNumber() != 1)
+ func->overloadNumber() != 0)
names.clear();
}
else if ((*m)->type() == Node::Property) {
@@ -1644,7 +1651,7 @@ void HtmlGenerator::generateDocumentNode(DocumentNode* dn, CodeMarker* marker)
is DITA map page, write the node's contents as a dita
map and return without doing anything else.
*/
- if (dn->subType() == Node::Page && dn->pageType() == Node::DitaMapPage) {
+ if (dn->docSubtype() == Node::Page && dn->pageType() == Node::DitaMapPage) {
const DitaMapNode* dmn = static_cast<const DitaMapNode*>(dn);
writeDitaMap(dmn);
return;
@@ -1670,7 +1677,7 @@ void HtmlGenerator::generateDocumentNode(DocumentNode* dn, CodeMarker* marker)
dn,
marker);
- if (dn->subType() == Node::HeaderFile) {
+ if (dn->docSubtype() == Node::HeaderFile) {
// Generate brief text and status for modules.
generateBrief(dn, marker);
generateStatus(dn, marker);
@@ -1804,10 +1811,12 @@ void HtmlGenerator::generateCollectionNode(CollectionNode* cn, CodeMarker* marke
generateAlsoList(cn, marker);
generateExtractionMark(cn, EndMark);
- if (cn->isGroup())
- generateAnnotatedList(cn, marker, cn->members());
- else if (cn->isQmlModule() || cn->isJsModule())
- generateAnnotatedList(cn, marker, cn->members());
+ if (!cn->noAutoList()) {
+ if (cn->isGroup())
+ generateAnnotatedList(cn, marker, cn->members());
+ else if (cn->isQmlModule() || cn->isJsModule())
+ generateAnnotatedList(cn, marker, cn->members());
+ }
sections = marker->sections(cn, CodeMarker::Detailed, CodeMarker::Okay);
s = sections.constBegin();
@@ -2087,7 +2096,7 @@ void HtmlGenerator::generateFooter(const Node *node)
Lists the required imports and includes in a table.
The number of rows is known, so this path is simpler than the generateSection() path.
*/
-void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
+void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker)
{
QMap<QString, Text> requisites;
Text text;
@@ -2136,7 +2145,7 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
if (inner->type() == Node::Class || inner->type() == Node::Namespace) {
//add the QT variable to the map
if (!inner->physicalModuleName().isEmpty()) {
- CollectionNode* cn = qdb_->findModule(inner->physicalModuleName());
+ const CollectionNode* cn = qdb_->getCollectionNode(inner->physicalModuleName(), Node::CPP);
if (cn && !cn->qtVariable().isEmpty()) {
text.clear();
text << "QT += " + cn->qtVariable();
@@ -2246,11 +2255,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
//add the module name and version to the map
QString logicalModuleVersion;
- CollectionNode* collection = 0;
- if (qcn->isJsNode())
- collection = qdb_->findJsModule(qcn->logicalModuleName());
- else
- collection = qdb_->findQmlModule(qcn->logicalModuleName());
+ const CollectionNode* collection = qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->genus());
if (collection)
logicalModuleVersion = collection->logicalModuleVersion();
else
@@ -2359,7 +2364,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
}
}
-void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker)
+void HtmlGenerator::generateIncludes(const Aggregate *inner, CodeMarker *marker)
{
if (!inner->includes().isEmpty()) {
out() << "<pre class=\"cpp\">"
@@ -2518,7 +2523,7 @@ void HtmlGenerator::generateSidebar() {
out() << "</div>\n";
}
-QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner,
+QString HtmlGenerator::generateListOfAllMemberFile(const Aggregate *inner,
CodeMarker *marker)
{
QList<Section> sections;
@@ -2613,7 +2618,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(QmlTypeNode* qml_cn, CodeMarker
return fileName;
}
-QString HtmlGenerator::generateLowStatusMemberFile(InnerNode *inner,
+QString HtmlGenerator::generateLowStatusMemberFile(Aggregate *inner,
CodeMarker *marker,
CodeMarker::Status status)
{
@@ -3164,13 +3169,13 @@ void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const
{
CNMap cnm;
Node::Genus genus = Node::DontCare;
- if (selector == "overviews")
+ if (selector == QLatin1String("overviews"))
genus = Node::DOC;
- else if (selector == "cpp-modules")
+ else if (selector == QLatin1String("cpp-modules"))
genus = Node::CPP;
- else if (selector == "qml-modules")
+ else if (selector == QLatin1String("qml-modules"))
genus = Node::QML;
- else if (selector == "js-modules")
+ else if (selector == QLatin1String("js-modules"))
genus = Node::JS;
if (genus != Node::DontCare) {
NodeList nl;
@@ -3345,7 +3350,7 @@ void HtmlGenerator::generateSectionList(const Section& section,
void HtmlGenerator::generateSectionInheritedList(const Section& section, const Node *relative)
{
- QList<QPair<InnerNode *, int> >::ConstIterator p = section.inherited.constBegin();
+ QList<QPair<Aggregate *, int> >::ConstIterator p = section.inherited.constBegin();
while (p != section.inherited.constEnd()) {
out() << "<li class=\"fn\">";
out() << (*p).second << ' ';
@@ -3415,6 +3420,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
{
QString src = markedCode;
QString html;
+ html.reserve(src.size());
QStringRef arg;
QStringRef par1;
@@ -3427,62 +3433,30 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
static const QString linkTag("link");
// replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
+ // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)"
+ // replace all "(<@(type|headerfile)(?: +[^>]*)?>)(.*)(</@\\2>)" tags
bool done = false;
for (int i = 0, srcSize = src.size(); i < srcSize;) {
if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
if (alignNames && !done) {
- html += "</td><td class=\"memItemRight bottomAlign\">";
+ html += QLatin1String("</td><td class=\"memItemRight bottomAlign\">");
done = true;
}
i += 2;
if (parseArg(src, linkTag, &i, srcSize, &arg, &par1)) {
- html += "<b>";
+ html += QLatin1String("<b>");
const Node* n = CodeMarker::nodeForString(par1.toString());
QString link = linkForNode(n, relative);
addLink(link, arg, &html);
- html += "</b>";
- }
- else {
- html += charLangle;
- html += charAt;
+ html += QLatin1String("</b>");
}
- }
- else {
- html += src.at(i++);
- }
- }
-
- // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)"
- src = html;
- html = QString();
- for (int i = 0, srcSize = src.size(); i < srcSize;) {
- if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
- i += 2;
- if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+ else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
const Node* n = qdb_->findFunctionNode(par1.toString(), relative, Node::DontCare);
QString link = linkForNode(n, relative);
addLink(link, arg, &html);
par1 = QStringRef();
}
- else {
- html += charLangle;
- html += charAt;
- }
- }
- else {
- html += src.at(i++);
- }
- }
-
- // replace all "(<@(type|headerfile)(?: +[^>]*)?>)(.*)(</@\\2>)" tags
- src = html;
- html = QString();
-
- for (int i=0, srcSize=src.size(); i<srcSize;) {
- if (src.at(i) == charLangle && src.at(i+1) == charAt) {
- i += 2;
- bool handled = false;
- if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
+ else if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
const Node* n = qdb_->findTypeNode(arg.toString(), relative);
html += QLatin1String("<span class=\"type\">");
@@ -3495,7 +3469,6 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
else
addLink(linkForNode(n,relative), arg, &html);
html += QLatin1String("</span>");
- handled = true;
}
else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
@@ -3508,9 +3481,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
else
html += arg;
}
- handled = true;
}
- if (!handled) {
+ else {
html += charLangle;
html += charAt;
}
@@ -3533,59 +3505,68 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
// "</@(?:comment|preprocessor|string|char|number|op|type|name|keyword)>" -> "</span>"
src = html;
html = QString();
- static const QString spanTags[] = {
- "<@comment>", "<span class=\"comment\">",
- "<@preprocessor>", "<span class=\"preprocessor\">",
- "<@string>", "<span class=\"string\">",
- "<@char>", "<span class=\"char\">",
- "<@number>", "<span class=\"number\">",
- "<@op>", "<span class=\"operator\">",
- "<@type>", "<span class=\"type\">",
- "<@name>", "<span class=\"name\">",
- "<@keyword>", "<span class=\"keyword\">",
- "</@comment>", "</span>",
- "</@preprocessor>", "</span>",
- "</@string>", "</span>",
- "</@char>", "</span>",
- "</@number>", "</span>",
- "</@op>", "</span>",
- "</@type>", "</span>",
- "</@name>", "</span>",
- "</@keyword>", "</span>",
+ html.reserve(src.size());
+ static const QLatin1String spanTags[] = {
+ QLatin1String("comment>"), QLatin1String("<span class=\"comment\">"),
+ QLatin1String("preprocessor>"), QLatin1String("<span class=\"preprocessor\">"),
+ QLatin1String("string>"), QLatin1String("<span class=\"string\">"),
+ QLatin1String("char>"), QLatin1String("<span class=\"char\">"),
+ QLatin1String("number>"), QLatin1String("<span class=\"number\">"),
+ QLatin1String("op>"), QLatin1String("<span class=\"operator\">"),
+ QLatin1String("type>"), QLatin1String("<span class=\"type\">"),
+ QLatin1String("name>"), QLatin1String("<span class=\"name\">"),
+ QLatin1String("keyword>"), QLatin1String("<span class=\"keyword\">")
};
+ int nTags = 9;
// Update the upper bound of k in the following code to match the length
// of the above array.
for (int i = 0, n = src.size(); i < n;) {
- if (src.at(i) == charLangle) {
- bool handled = false;
- for (int k = 0; k != 18; ++k) {
- const QString & tag = spanTags[2 * k];
- if (tag == QStringRef(&src, i, tag.length())) {
- html += spanTags[2 * k + 1];
- i += tag.length();
- handled = true;
- break;
+ if (src.at(i) == QLatin1Char('<')) {
+ if (src.at(i + 1) == QLatin1Char('@')) {
+ i += 2;
+ bool handled = false;
+ for (int k = 0; k != nTags; ++k) {
+ const QLatin1String& tag = spanTags[2 * k];
+ if (i + tag.size() <= src.length() &&
+ tag == QStringRef(&src, i, tag.size())) {
+ html += spanTags[2 * k + 1];
+ i += tag.size();
+ handled = true;
+ break;
+ }
}
- }
- if (!handled) {
- ++i;
- if (src.at(i) == charAt ||
- (src.at(i) == QLatin1Char('/') && src.at(i + 1) == charAt)) {
+ if (!handled) {
// drop 'our' unknown tags (the ones still containing '@')
while (i < n && src.at(i) != QLatin1Char('>'))
++i;
++i;
}
- else {
- // retain all others
- html += charLangle;
+ continue;
+ }
+ else if (src.at(i + 1) == QLatin1Char('/') && src.at(i + 2) == QLatin1Char('@')) {
+ i += 3;
+ bool handled = false;
+ for (int k = 0; k != nTags; ++k) {
+ const QLatin1String& tag = spanTags[2 * k];
+ if (i + tag.size() <= src.length() &&
+ tag == QStringRef(&src, i, tag.size())) {
+ html += QLatin1String("</span>");
+ i += tag.size();
+ handled = true;
+ break;
+ }
+ }
+ if (!handled) {
+ // drop 'our' unknown tags (the ones still containing '@')
+ while (i < n && src.at(i) != QLatin1Char('>'))
+ ++i;
+ ++i;
}
+ continue;
}
}
- else {
- html += src.at(i);
- ++i;
- }
+ html += src.at(i);
+ ++i;
}
return html;
}
@@ -3660,7 +3641,7 @@ QString HtmlGenerator::protect(const QString &string, const QString &outputEncod
APPEND("&gt;");
} else if (ch == QLatin1Char('"')) {
APPEND("&quot;");
- } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F)
+ } else if ((outputEncoding == QLatin1String("ISO-8859-1") && ch.unicode() > 0x007F)
|| (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/'))
|| (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) {
// we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator
@@ -3686,13 +3667,13 @@ QString HtmlGenerator::fileBase(const Node *node) const
result = Generator::fileBase(node);
- if (!node->isInnerNode()) {
+ if (!node->isAggregate()) {
switch (node->status()) {
case Node::Compat:
- result += "-compat";
+ result += QLatin1String("-compat");
break;
case Node::Obsolete:
- result += "-obsolete";
+ result += QLatin1String("-obsolete");
break;
default:
;
@@ -3704,9 +3685,9 @@ QString HtmlGenerator::fileBase(const Node *node) const
QString HtmlGenerator::fileName(const Node *node)
{
if (node->type() == Node::Document) {
- if (static_cast<const DocumentNode *>(node)->subType() == Node::ExternalPage)
+ if (static_cast<const DocumentNode *>(node)->docSubtype() == Node::ExternalPage)
return node->name();
- if (static_cast<const DocumentNode *>(node)->subType() == Node::Image)
+ if (static_cast<const DocumentNode *>(node)->docSubtype() == Node::Image)
return node->name();
}
return Generator::fileName(node);
@@ -3737,12 +3718,12 @@ QString HtmlGenerator::refForNode(const Node *node)
break;
case Node::Function:
func = static_cast<const FunctionNode *>(node);
- if (func->associatedProperty()) {
- return refForNode(func->associatedProperty());
+ if (func->hasOneAssociatedProperty() && func->doc().isEmpty()) {
+ return refForNode(func->firstAssociatedProperty());
}
else {
ref = func->name();
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
}
break;
@@ -3767,7 +3748,7 @@ QString HtmlGenerator::refForNode(const Node *node)
case Node::QmlMethod:
func = static_cast<const FunctionNode *>(node);
ref = func->name() + "-method";
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
@@ -3831,12 +3812,10 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const
QString link = (*node)->url();
if (link.isEmpty()) {
link = linkForNode(*node, relative);
- if ((*node)->subType() == Node::Image)
+ if ((*node)->docSubtype() == Node::Image)
link = "images/used-in-examples/" + link;
- if (!ref.isEmpty())
- link += QLatin1Char('#') + ref;
}
- else if (!ref.isEmpty()) {
+ if (!ref.isEmpty()) {
int hashtag = link.lastIndexOf(QChar('#'));
if (hashtag != -1)
link.truncate(hashtag);
@@ -3872,7 +3851,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
}
QString link = fn;
- if (!node->isInnerNode() || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) {
+ if (!node->isAggregate() || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) {
QString ref = refForNode(node);
if (relative && fn == fileName(relative) && ref == refForNode(relative))
return QString();
@@ -3923,27 +3902,25 @@ void HtmlGenerator::generateFullName(const Node *apparentNode, const Node *relat
}
void HtmlGenerator::generateDetailedMember(const Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker)
{
- const EnumNode *enume;
-
+ const EnumNode *etn;
#ifdef GENERATE_MAC_REFS
generateMacRef(node, marker);
#endif
generateExtractionMark(node, MemberMark);
generateKeywordAnchors(node);
QString nodeRef = refForNode(node);
- if (node->type() == Node::Enum
- && (enume = static_cast<const EnumNode *>(node))->flagsType()) {
+ if (node->isEnumType() && (etn = static_cast<const EnumNode *>(node))->flagsType()) {
#ifdef GENERATE_MAC_REFS
- generateMacRef(enume->flagsType(), marker);
+ generateMacRef(etn->flagsType(), marker);
#endif
out() << "<h3 class=\"flags\" id=\"" << nodeRef << "\">";
out() << "<a name=\"" + nodeRef + "\"></a>";
- generateSynopsis(enume, relative, marker, CodeMarker::Detailed);
+ generateSynopsis(etn, relative, marker, CodeMarker::Detailed);
out() << "<br/>";
- generateSynopsis(enume->flagsType(),
+ generateSynopsis(etn->flagsType(),
relative,
marker,
CodeMarker::Detailed);
@@ -3958,10 +3935,11 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
generateStatus(node, marker);
generateBody(node, marker);
+ generateOverloadedSignal(node, marker);
generateThreadSafeness(node, marker);
generateSince(node, marker);
- if (node->type() == Node::Property) {
+ if (node->isProperty()) {
const PropertyNode *property = static_cast<const PropertyNode *>(node);
Section section;
@@ -3987,16 +3965,17 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
const FunctionNode* fn = static_cast<const FunctionNode*>(node);
if (fn->isPrivateSignal())
generatePrivateSignalNote(node, marker);
+ generateAssociatedPropertyNotes(fn);
}
- else if (node->type() == Node::Enum) {
- const EnumNode *enume = static_cast<const EnumNode *>(node);
- if (enume->flagsType()) {
- out() << "<p>The " << protectEnc(enume->flagsType()->name())
+ else if (node->isEnumType()) {
+ const EnumNode *etn = static_cast<const EnumNode *>(node);
+ if (etn->flagsType()) {
+ out() << "<p>The " << protectEnc(etn->flagsType()->name())
<< " type is a typedef for "
<< "<a href=\"" << qflagsHref_ << "\">QFlags</a>&lt;"
- << protectEnc(enume->name())
+ << protectEnc(etn->name())
<< "&gt;. It stores an OR combination of "
- << protectEnc(enume->name())
+ << protectEnc(etn->name())
<< " values.</p>\n";
}
}
@@ -4053,7 +4032,7 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker)
switch (node->status()) {
case Node::Obsolete:
- if (node->isInnerNode())
+ if (node->isAggregate())
Generator::generateStatus(node, marker);
break;
case Node::Compat:
@@ -4166,7 +4145,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section,
on a QML element reference page.
*/
void HtmlGenerator::generateDetailedQmlMember(Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker)
{
QmlPropertyNode* qpn = 0;
@@ -4371,8 +4350,8 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
if (markType == MemberMark) {
if (node->type() == Node::Function) {
const FunctionNode *func = static_cast<const FunctionNode *>(node);
- if (!func->associatedProperty()) {
- if (func->overloadNumber() == 1)
+ if (!func->hasAssociatedProperties()) {
+ if (func->overloadNumber() == 0)
out() << "[overload1]";
out() << "$$$" + func->name() + func->rawParameters().remove(' ');
}
@@ -4428,7 +4407,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString fileName = manifest +"-manifest.xml";
QFile file(outputDir() + QLatin1Char('/') + fileName);
bool demos = false;
- if (manifest == "demos")
+ if (manifest == QLatin1String("demos"))
demos = true;
bool proceed = false;
@@ -4481,7 +4460,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
writer.writeAttribute("docUrl", docUrl);
QStringList proFiles;
foreach (const Node* child, en->childNodes()) {
- if (child->subType() == Node::File) {
+ if (child->docSubtype() == Node::File) {
QString file = child->name();
if (file.endsWith(".pro") || file.endsWith(".qmlproject")) {
proFiles << file;
@@ -4596,7 +4575,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
if (!tags.isEmpty()) {
writer.writeStartElement("tags");
bool wrote_one = false;
- foreach (QString tag, tags) {
+ foreach (const QString &tag, tags) {
if (wrote_one)
writer.writeCharacters(",");
writer.writeCharacters(tag);
@@ -4608,7 +4587,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString ename = en->name().mid(en->name().lastIndexOf('/')+1);
QMap<int, const Node*> filesToOpen;
foreach (const Node* child, en->childNodes()) {
- if (child->subType() == Node::File) {
+ if (child->docSubtype() == Node::File) {
QFileInfo fileInfo(child->name());
QString fileName = fileInfo.fileName().toLower();
// open .qml, .cpp and .h files with a
@@ -4693,7 +4672,7 @@ void HtmlGenerator::readManifestMetaContent(const Config &config)
subtype: QML class
subtype: QML module
*/
-void HtmlGenerator::reportOrphans(const InnerNode* parent)
+void HtmlGenerator::reportOrphans(const Aggregate* parent)
{
const NodeList& children = parent->childNodes();
if (children.size() == 0)
@@ -4729,7 +4708,7 @@ void HtmlGenerator::reportOrphans(const InnerNode* parent)
case Node::QmlModule:
break;
case Node::Document:
- switch (child->subType()) {
+ switch (child->docSubtype()) {
case Node::Example:
break;
case Node::HeaderFile:
@@ -4819,7 +4798,7 @@ QXmlStreamWriter& HtmlGenerator::xmlWriter()
It also ensures that a GUID map is created for the output file.
*/
-void HtmlGenerator::beginDitamapPage(const InnerNode* node, const QString& fileName)
+void HtmlGenerator::beginDitamapPage(const Aggregate* node, const QString& fileName)
{
Generator::beginSubPage(node,fileName);
QXmlStreamWriter* writer = new QXmlStreamWriter(out().device());
@@ -4891,4 +4870,37 @@ void HtmlGenerator::writeDitaRefs(const DitaRefList& ditarefs)
}
}
+/*!
+ Generates bold Note lines that explain how function \a fn
+ is associated with each of its associated properties.
+ */
+void HtmlGenerator::generateAssociatedPropertyNotes(const FunctionNode* fn)
+{
+ if (fn->hasAssociatedProperties()) {
+ out() << "<p><b>Note:</b> ";
+ foreach (const PropertyNode* pn, fn->associatedProperties()) {
+ QString msg;
+ switch (pn->role(fn)) {
+ case PropertyNode::Getter:
+ msg = QStringLiteral("Getter function ");
+ break;
+ case PropertyNode::Setter:
+ msg = QStringLiteral("Setter function ");
+ break;
+ case PropertyNode::Resetter:
+ msg = QStringLiteral("Resetter function ");
+ break;
+ case PropertyNode::Notifier:
+ msg = QStringLiteral("Notifier signal ");
+ break;
+ default:
+ break;
+ }
+ QString link = linkForNode(pn, 0);
+ out() << msg << "for property <a href=\"" << link << "\">" << pn->name() << "</a>. ";
+ }
+ out() << "</p>";
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h
index 4a2e158252..d46fc9ebee 100644
--- a/src/tools/qdoc/htmlgenerator.h
+++ b/src/tools/qdoc/htmlgenerator.h
@@ -38,7 +38,7 @@
#ifndef HTMLGENERATOR_H
#define HTMLGENERATOR_H
-#include <qmap.h>
+#include <qhash.h>
#include <qregexp.h>
#include <qxmlstream.h>
#include "codemarker.h"
@@ -94,7 +94,7 @@ protected:
virtual int generateAtom(const Atom *atom,
const Node *relative,
CodeMarker *marker) Q_DECL_OVERRIDE;
- virtual void generateClassLikeNode(InnerNode* inner, CodeMarker* marker) Q_DECL_OVERRIDE;
+ virtual void generateClassLikeNode(Aggregate* inner, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker* marker) Q_DECL_OVERRIDE;
virtual void generateDocumentNode(DocumentNode* dn, CodeMarker* marker) Q_DECL_OVERRIDE;
@@ -106,6 +106,7 @@ protected:
void generateManifestFile(const QString &manifest, const QString &element);
void readManifestMetaContent(const Config &config);
void generateKeywordAnchors(const Node* node);
+ void generateAssociatedPropertyNotes(const FunctionNode* fn);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
@@ -136,22 +137,22 @@ private:
const Node *relative,
CodeMarker *marker);
void generateFooter(const Node *node = 0);
- void generateRequisites(InnerNode *inner,
+ void generateRequisites(Aggregate *inner,
CodeMarker *marker);
void generateQmlRequisites(QmlTypeNode *qcn,
CodeMarker *marker);
void generateBrief(const Node *node,
CodeMarker *marker,
const Node *relative = 0);
- void generateIncludes(const InnerNode *inner, CodeMarker *marker);
+ void generateIncludes(const Aggregate *inner, CodeMarker *marker);
void generateTableOfContents(const Node *node,
CodeMarker *marker,
QList<Section>* sections = 0);
void generateSidebar();
- QString generateListOfAllMemberFile(const InnerNode *inner,
+ QString generateListOfAllMemberFile(const Aggregate *inner,
CodeMarker *marker);
QString generateAllQmlMembersFile(QmlTypeNode* qml_cn, CodeMarker* marker);
- QString generateLowStatusMemberFile(InnerNode *inner,
+ QString generateLowStatusMemberFile(Aggregate *inner,
CodeMarker *marker,
CodeMarker::Status status);
QString generateQmlMemberFile(QmlTypeNode* qcn,
@@ -180,13 +181,12 @@ private:
CodeMarker *marker,
bool summary);
void generateDetailedQmlMember(Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker);
void generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker) Q_DECL_OVERRIDE;
void generateQmlInstantiates(QmlTypeNode* qcn, CodeMarker* marker);
void generateInstantiatedBy(ClassNode* cn, CodeMarker* marker);
- void generateRequisitesTable(const QStringList& requisitesOrder, QMap<QString, Text>& requisites);
void generateSection(const NodeList& nl,
const Node *relative,
CodeMarker *marker,
@@ -204,7 +204,7 @@ private:
void generateFullName(const Node *apparentNode, const Node *relative, const Node *actualNode = 0);
void generateDetailedMember(const Node *node,
- const InnerNode *relative,
+ const Aggregate *relative,
CodeMarker *marker);
void generateLink(const Atom *atom, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
@@ -223,15 +223,15 @@ private:
void beginLink(const QString &link, const Node *node, const Node *relative);
void endLink();
void generateExtractionMark(const Node *node, ExtractionMarkType markType);
- void reportOrphans(const InnerNode* parent);
+ void reportOrphans(const Aggregate* parent);
- void beginDitamapPage(const InnerNode* node, const QString& fileName);
+ void beginDitamapPage(const Aggregate* node, const QString& fileName);
void endDitamapPage();
void writeDitaMap(const DitaMapNode* node);
void writeDitaRefs(const DitaRefList& ditarefs);
QXmlStreamWriter& xmlWriter();
- QMap<QString, QString> refMap;
+ QHash<QString, QString> refMap;
int codeIndent;
HelpProjectWriter *helpProjectWriter;
bool inObsoleteLink;
diff --git a/src/tools/qdoc/jscodemarker.cpp b/src/tools/qdoc/jscodemarker.cpp
index 2538b46433..f6a2c99179 100644
--- a/src/tools/qdoc/jscodemarker.cpp
+++ b/src/tools/qdoc/jscodemarker.cpp
@@ -68,7 +68,7 @@ bool JsCodeMarker::recognizeCode(const QString &code)
QQmlJS::Parser parser(&engine);
QString newCode = code;
- QList<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
+ QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
return parser.parseProgram();
@@ -95,7 +95,7 @@ bool JsCodeMarker::recognizeLanguage(const QString &language)
/*!
Returns the type of atom used to represent JavaScript code in the documentation.
*/
-Atom::Type JsCodeMarker::atomType() const
+Atom::AtomType JsCodeMarker::atomType() const
{
return Atom::JavaScript;
}
@@ -115,7 +115,7 @@ QString JsCodeMarker::addMarkUp(const QString &code,
QQmlJS::Lexer lexer(&engine);
QString newCode = code;
- QList<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
+ QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
QQmlJS::Parser parser(&engine);
diff --git a/src/tools/qdoc/jscodemarker.h b/src/tools/qdoc/jscodemarker.h
index d9f6eb5a10..ccba2ca4c7 100644
--- a/src/tools/qdoc/jscodemarker.h
+++ b/src/tools/qdoc/jscodemarker.h
@@ -53,7 +53,7 @@ public:
virtual bool recognizeCode(const QString &code) Q_DECL_OVERRIDE;
virtual bool recognizeExtension(const QString &ext) Q_DECL_OVERRIDE;
virtual bool recognizeLanguage(const QString &language) Q_DECL_OVERRIDE;
- virtual Atom::Type atomType() const Q_DECL_OVERRIDE;
+ virtual Atom::AtomType atomType() const Q_DECL_OVERRIDE;
virtual QString markedUpCode(const QString &code,
const Node *relative,
diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp
index 5eba2a69ef..98b63fd035 100644
--- a/src/tools/qdoc/location.cpp
+++ b/src/tools/qdoc/location.cpp
@@ -202,25 +202,34 @@ void Location::pop()
*/
/*! \fn const QString& Location::filePath() const
- Returns the current path and file name.
- Must not be called on an empty Location object.
+ Returns the current path and file name. If the Location is
+ empty, the returned string is null.
\sa lineNo(), columnNo()
*/
/*!
- Returns the file name part of the file path, ie the
- current file. Must not be called on an empty Location
- object.
+ Returns the file name part of the file path, ie the current
+ file. Returns an empty string if the file path is empty.
*/
QString Location::fileName() const
{
QString fp = filePath();
- return fp.mid(fp.lastIndexOf('/') + 1);
+ return (fp.isEmpty() ? fp : fp.mid(fp.lastIndexOf('/') + 1));
}
/*!
+ Returns the suffix of the file name. Returns an empty string
+ if the file path is empty.
+ */
+QString Location::fileSuffix() const
+{
+ QString fp = filePath();
+ return (fp.isEmpty() ? fp : fp.mid(fp.lastIndexOf('.') + 1));
+}
+
+/*!
\brief Returns \a path which is canonicalized and relative to the config file.
QDir::relativeFilePath does not canonicalize the paths, so
diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h
index 5250e27a47..1cb8e3aec1 100644
--- a/src/tools/qdoc/location.h
+++ b/src/tools/qdoc/location.h
@@ -72,6 +72,7 @@ public:
int depth() const { return stkDepth; }
const QString& filePath() const { return stkTop->filePath; }
QString fileName() const;
+ QString fileSuffix() const;
int lineNo() const { return stkTop->lineNo; }
int columnNo() const { return stkTop->columnNo; }
bool etc() const { return etcetera; }
@@ -104,6 +105,7 @@ private:
int lineNo;
int columnNo;
};
+ friend class QTypeInfo<StackEntry>;
void emitMessage(MessageType type,
const QString& message,
@@ -123,6 +125,8 @@ private:
static QRegExp *spuriousRegExp;
static bool logProgress_;
};
+Q_DECLARE_TYPEINFO(Location::StackEntry, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Location, Q_COMPLEX_TYPE); // stkTop = &stkBottom
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index 0b156c6bb9..3833cbb5dd 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -227,6 +227,8 @@ static void processQdocconfFile(const QString &fileName)
config.setStringList(CONFIG_AUTOLINKERRORS, QStringList(autolinkErrors ? "true" : "false"));
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
+ prevCurrentDir = QDir::currentPath();
+
/*
With the default configuration values in place, load
the qdoc configuration file. Note that the configuration
@@ -236,7 +238,6 @@ static void processQdocconfFile(const QString &fileName)
in the file being processed, mainly for error reporting
purposes.
*/
- currentDir = QFileInfo(fileName).path();
Location::initialize(config);
config.load(fileName);
QString project = config.getString(CONFIG_PROJECT);
@@ -248,7 +249,6 @@ static void processQdocconfFile(const QString &fileName)
config.setStringList(CONFIG_DEFINES,defs);
Location::terminate();
- prevCurrentDir = QDir::currentPath();
currentDir = QFileInfo(fileName).path();
if (!currentDir.isEmpty())
QDir::setCurrent(currentDir);
@@ -342,9 +342,11 @@ static void processQdocconfFile(const QString &fileName)
qdb->clearSearchOrder();
if (!Generator::singleExec()) {
- Generator::debug(" loading index files");
- loadIndexFiles(config);
- Generator::debug(" done loading index files");
+ if (!Generator::preparing()) {
+ Generator::debug(" loading index files");
+ loadIndexFiles(config);
+ Generator::debug(" done loading index files");
+ }
qdb->newPrimaryTree(project);
}
else if (Generator::preparing())
@@ -480,6 +482,9 @@ static void processQdocconfFile(const QString &fileName)
}
Generator::debug(QString("Parsing done."));
+ /*
+ Currently these doneParsingSourceFiles() calls do nothing.
+ */
foreach (CodeParser *codeParser, usedParsers)
codeParser->doneParsingSourceFiles();
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index 37bc0c5fef..8646e699a9 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -44,16 +44,16 @@ QT_BEGIN_NAMESPACE
int Node::propertyGroupCount_ = 0;
QStringMap Node::operators_;
-QMap<QString,Node::Type> Node::goals_;
+QMap<QString,Node::NodeType> Node::goals_;
/*!
Initialize the map of search goals. This is called once
by QDocDatabase::initializeDB(). The map key is a string
- representing a value in the enum Node::Type. The map value
+ representing a value in the enum Node::NodeType. The map value
is the enum value.
There should be an entry in the map for each value in the
- Type enum.
+ NodeType enum.
*/
void Node::initialize()
{
@@ -160,8 +160,8 @@ QString Node::fullName(const Node* relative) const
match is found, return false.
\a types is a list of type/subtype pairs, where the first
- value in the pair is a Node::Type, and the second value is
- a Node::SubType. The second value is used in the match if
+ value in the pair is a Node::NodeType, and the second value is
+ a Node::DocSubtype. The second value is used in the match if
this node's type is Node::Document.
*/
bool Node::match(const NodeTypeList& types) const
@@ -169,7 +169,7 @@ bool Node::match(const NodeTypeList& types) const
for (int i=0; i<types.size(); ++i) {
if (type() == types.at(i).first) {
if (type() == Node::Document) {
- if (subType() == types.at(i).second)
+ if (docSubtype() == types.at(i).second)
return true;
}
else
@@ -200,12 +200,12 @@ void Node::setDoc(const Doc& doc, bool replace)
given \a parent and \a name. The new node is added to the
parent's child list.
*/
-Node::Node(Type type, InnerNode *parent, const QString& name)
+Node::Node(NodeType type, Aggregate *parent, const QString& name)
: nodeType_((unsigned char) type),
access_((unsigned char) Public),
safeness_((unsigned char) UnspecifiedSafeness),
pageType_((unsigned char) NoPageType),
- status_((unsigned char) Commendable),
+ status_((unsigned char) Active),
indexNodeFlag_(false),
parent_(parent),
relatesTo_(0),
@@ -320,7 +320,7 @@ QString Node::nodeTypeString() const
*/
QString Node::nodeTypeString(unsigned char t)
{
- switch ((Type)t) {
+ switch ((NodeType)t) {
case Namespace:
return "namespace";
case Class:
@@ -370,7 +370,7 @@ QString Node::nodeTypeString(unsigned char t)
*/
QString Node::nodeSubtypeString() const
{
- return nodeSubtypeString(subType());
+ return nodeSubtypeString(docSubtype());
}
/*!
@@ -380,7 +380,7 @@ QString Node::nodeSubtypeString() const
*/
QString Node::nodeSubtypeString(unsigned char t)
{
- switch ((SubType)t) {
+ switch ((DocSubtype)t) {
case Example:
return "example";
case HeaderFile:
@@ -395,7 +395,7 @@ QString Node::nodeSubtypeString(unsigned char t)
return "external page";
case DitaMap:
return "ditamap";
- case NoSubType:
+ case NoSubtype:
default:
break;
}
@@ -460,7 +460,7 @@ bool Node::fromFlagValue(FlagValue fv, bool defaultValue)
/*!
Sets the pointer to the node that this node relates to.
*/
-void Node::setRelates(InnerNode *pseudoParent)
+void Node::setRelates(Aggregate *pseudoParent)
{
if (relatesTo_) {
relatesTo_->removeRelated(this);
@@ -558,7 +558,7 @@ QString RelatedClass::accessString() const
*/
Node::Status Node::inheritedStatus() const
{
- Status parentStatus = Commendable;
+ Status parentStatus = Active;
if (parent_)
parentStatus = parent_->inheritedStatus();
return (Status)qMin((int)status_, (int)parentStatus);
@@ -606,7 +606,6 @@ QString Node::fileBase() const
base.replace(QLatin1Char(' '), QLatin1Char('-'));
return base.toLower();
}
-#endif
/*!
Returns this node's Universally Unique IDentifier as a
QString. Creates the UUID first, if it has not been created.
@@ -617,6 +616,7 @@ QString Node::guid() const
uuid_ = idForNode();
return uuid_;
}
+#endif
/*!
If this node is a QML or JS type node, return a pointer to
@@ -683,14 +683,32 @@ const Node* Node::root() const
}
/*!
- \class InnerNode
+ Sets the node's declaration location, its definition
+ location, or both, depending on the suffix of the file
+ name from the file path in location \a t.
+ */
+void Node::setLocation(const Location& t)
+{
+ QString suffix = t.fileSuffix();
+ if (suffix == "h")
+ declLocation_ = t;
+ else if (suffix == "cpp")
+ defLocation_ = t;
+ else {
+ declLocation_ = t;
+ defLocation_ = t;
+ }
+}
+
+/*!
+ \class Aggregate
*/
/*!
The inner node destructor deletes the children and removes
this node from its related nodes.
*/
-InnerNode::~InnerNode()
+Aggregate::~Aggregate()
{
deleteChildren();
removeFromRelated();
@@ -706,17 +724,17 @@ InnerNode::~InnerNode()
find all this node's children that have the given \a name,
and return the one that satisfies the \a genus requirement.
*/
-Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
+Node *Aggregate::findChildNode(const QString& name, Node::Genus genus) const
{
if (genus == Node::DontCare) {
- Node *node = childMap.value(name);
+ Node *node = childMap_.value(name);
if (node && !node->isQmlPropertyGroup()) // mws asks: Why not property group?
return node;
if (isQmlType() || isJsType()) {
for (int i=0; i<children_.size(); ++i) {
Node* n = children_.at(i);
if (n->isQmlPropertyGroup() || isJsPropertyGroup()) {
- node = static_cast<InnerNode*>(n)->findChildNode(name, genus);
+ node = static_cast<Aggregate*>(n)->findChildNode(name, genus);
if (node)
return node;
}
@@ -724,7 +742,7 @@ Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
}
}
else {
- NodeList nodes = childMap.values(name);
+ NodeList nodes = childMap_.values(name);
if (!nodes.isEmpty()) {
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
@@ -733,20 +751,20 @@ Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
}
}
}
- return primaryFunctionMap.value(name);
+ return primaryFunctionMap_.value(name);
}
/*!
Find all the child nodes of this node that are named
\a name and return them in \a nodes.
*/
-void InnerNode::findChildren(const QString& name, NodeList& nodes) const
+void Aggregate::findChildren(const QString& name, NodeList& nodes) const
{
- nodes = childMap.values(name);
- Node* n = primaryFunctionMap.value(name);
+ nodes = childMap_.values(name);
+ Node* n = primaryFunctionMap_.value(name);
if (n) {
nodes.append(n);
- NodeList t = secondaryFunctionMap.value(name);
+ NodeList t = secondaryFunctionMap_.value(name);
if (!t.isEmpty())
nodes.append(t);
}
@@ -756,7 +774,7 @@ void InnerNode::findChildren(const QString& name, NodeList& nodes) const
if (i < 0)
return;
QString qmlPropGroup = name.left(i);
- NodeList t = childMap.values(qmlPropGroup);
+ NodeList t = childMap_.values(qmlPropGroup);
if (t.isEmpty())
return;
foreach (Node* n, t) {
@@ -773,12 +791,12 @@ void InnerNode::findChildren(const QString& name, NodeList& nodes) const
with the specified \a name is found but it is not of the
specified \a type, 0 is returned.
*/
-Node* InnerNode::findChildNode(const QString& name, Type type)
+Node* Aggregate::findChildNode(const QString& name, NodeType type)
{
if (type == Function)
- return primaryFunctionMap.value(name);
+ return primaryFunctionMap_.value(name);
else {
- NodeList nodes = childMap.values(name);
+ NodeList nodes = childMap_.values(name);
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
if (node->type() == type)
@@ -792,9 +810,9 @@ Node* InnerNode::findChildNode(const QString& name, Type type)
Find a function node that is a child of this nose, such
that the function node has the specified \a name.
*/
-FunctionNode *InnerNode::findFunctionNode(const QString& name) const
+FunctionNode *Aggregate::findFunctionNode(const QString& name) const
{
- return static_cast<FunctionNode *>(primaryFunctionMap.value(name));
+ return static_cast<FunctionNode *>(primaryFunctionMap_.value(name));
}
/*!
@@ -802,15 +820,15 @@ FunctionNode *InnerNode::findFunctionNode(const QString& name) const
that the function has the same name and signature as the
\a clone node.
*/
-FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const
+FunctionNode *Aggregate::findFunctionNode(const FunctionNode *clone) const
{
- QMap<QString,Node*>::ConstIterator c = primaryFunctionMap.constFind(clone->name());
- if (c != primaryFunctionMap.constEnd()) {
+ QMap<QString,Node*>::ConstIterator c = primaryFunctionMap_.constFind(clone->name());
+ if (c != primaryFunctionMap_.constEnd()) {
if (isSameSignature(clone, (FunctionNode *) *c)) {
return (FunctionNode *) *c;
}
- else if (secondaryFunctionMap.contains(clone->name())) {
- const NodeList& secs = secondaryFunctionMap[clone->name()];
+ else if (secondaryFunctionMap_.contains(clone->name())) {
+ const NodeList& secs = secondaryFunctionMap_[clone->name()];
NodeList::ConstIterator s = secs.constBegin();
while (s != secs.constEnd()) {
if (isSameSignature(clone, (FunctionNode *) *s))
@@ -825,11 +843,11 @@ FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const
/*!
Returns the list of keys from the primary function map.
*/
-QStringList InnerNode::primaryKeys()
+QStringList Aggregate::primaryKeys()
{
QStringList t;
- QMap<QString, Node*>::iterator i = primaryFunctionMap.begin();
- while (i != primaryFunctionMap.end()) {
+ QMap<QString, Node*>::iterator i = primaryFunctionMap_.begin();
+ while (i != primaryFunctionMap_.end()) {
t.append(i.key());
++i;
}
@@ -839,11 +857,11 @@ QStringList InnerNode::primaryKeys()
/*!
Returns the list of keys from the secondary function map.
*/
-QStringList InnerNode::secondaryKeys()
+QStringList Aggregate::secondaryKeys()
{
QStringList t;
- QMap<QString, NodeList>::iterator i = secondaryFunctionMap.begin();
- while (i != secondaryFunctionMap.end()) {
+ QMap<QString, NodeList>::iterator i = secondaryFunctionMap_.begin();
+ while (i != secondaryFunctionMap_.end()) {
t.append(i.key());
++i;
}
@@ -851,43 +869,13 @@ QStringList InnerNode::secondaryKeys()
}
/*!
- */
-void InnerNode::setOverload(FunctionNode *func, bool overlode)
-{
- Node *node = (Node *) func;
- Node *&primary = primaryFunctionMap[func->name()];
-
- if (secondaryFunctionMap.contains(func->name())) {
- NodeList& secs = secondaryFunctionMap[func->name()];
- if (overlode) {
- if (primary == node) {
- primary = secs.first();
- secs.erase(secs.begin());
- secs.append(node);
- }
- else {
- secs.removeAll(node);
- secs.append(node);
- }
- }
- else {
- if (primary != node) {
- secs.removeAll(node);
- secs.prepend(primary);
- primary = node;
- }
- }
- }
-}
-
-/*!
Mark all child nodes that have no documentation as having
private access and internal status. qdoc will then ignore
them for documentation purposes. Some nodes have an
Intermediate status, meaning that they should be ignored,
but not their children.
*/
-void InnerNode::makeUndocumentedChildrenInternal()
+void Aggregate::makeUndocumentedChildrenInternal()
{
foreach (Node *child, childNodes()) {
if (child->doc().isEmpty() && child->status() != Node::Intermediate) {
@@ -898,68 +886,109 @@ void InnerNode::makeUndocumentedChildrenInternal()
}
/*!
+ This is where we should set the overload numbers, including
+ the related non-members.
*/
-void InnerNode::normalizeOverloads()
+void Aggregate::normalizeOverloads()
{
- QMap<QString, Node *>::Iterator p1 = primaryFunctionMap.begin();
- while (p1 != primaryFunctionMap.end()) {
+ QMap<QString, Node *>::Iterator p1 = primaryFunctionMap_.begin();
+ while (p1 != primaryFunctionMap_.end()) {
FunctionNode *primaryFunc = (FunctionNode *) *p1;
- if (secondaryFunctionMap.contains(primaryFunc->name()) &&
- (primaryFunc->status() != Commendable ||
- primaryFunc->access() == Private)) {
-
- NodeList& secs = secondaryFunctionMap[primaryFunc->name()];
- NodeList::ConstIterator s = secs.constBegin();
- while (s != secs.constEnd()) {
- FunctionNode *secondaryFunc = (FunctionNode *) *s;
-
- // Any non-obsolete, non-compatibility, non-private functions
- // (i.e, visible functions) are preferable to the primary
- // function.
-
- if (secondaryFunc->status() == Commendable &&
- secondaryFunc->access() != Private) {
-
- *p1 = secondaryFunc;
- int index = secondaryFunctionMap[primaryFunc->name()].indexOf(secondaryFunc);
- secondaryFunctionMap[primaryFunc->name()].replace(index, primaryFunc);
- break;
+ if (primaryFunc->status() != Active || primaryFunc->access() == Private) {
+ if (secondaryFunctionMap_.contains(primaryFunc->name())) {
+ /*
+ Either the primary function is not active or it is private.
+ It therefore can't be the primary function. Search the list
+ of overloads to find one that can be the primary function.
+ */
+ NodeList& overloads = secondaryFunctionMap_[primaryFunc->name()];
+ NodeList::ConstIterator s = overloads.constBegin();
+ while (s != overloads.constEnd()) {
+ FunctionNode *overloadFunc = (FunctionNode *) *s;
+ /*
+ Any non-obsolete, non-private function (i.e., visible function)
+ is preferable to the current primary function. Swap the primary
+ and overload functions.
+ */
+ if (overloadFunc->status() == Active && overloadFunc->access() != Private) {
+ primaryFunc->setOverloadNumber(overloadFunc->overloadNumber());
+ overloads.replace(overloads.indexOf(overloadFunc), primaryFunc);
+ *p1 = overloadFunc;
+ overloadFunc->setOverloadFlag(false);
+ overloadFunc->setOverloadNumber(0);
+ break;
+ }
+ ++s;
}
- ++s;
}
}
++p1;
}
-
- QMap<QString, Node *>::ConstIterator p = primaryFunctionMap.constBegin();
- while (p != primaryFunctionMap.constEnd()) {
+ /*
+ Ensure that none of the primary functions is marked with \overload.
+ */
+ QMap<QString, Node *>::Iterator p = primaryFunctionMap_.begin();
+ while (p != primaryFunctionMap_.end()) {
FunctionNode *primaryFunc = (FunctionNode *) *p;
- if (primaryFunc->isOverload())
- primaryFunc->ove = false;
- if (secondaryFunctionMap.contains(primaryFunc->name())) {
- NodeList& secs = secondaryFunctionMap[primaryFunc->name()];
- NodeList::ConstIterator s = secs.constBegin();
- while (s != secs.constEnd()) {
- FunctionNode *secondaryFunc = (FunctionNode *) *s;
- if (!secondaryFunc->isOverload())
- secondaryFunc->ove = true;
- ++s;
+ if (primaryFunc->isOverload()) {
+ if (secondaryFunctionMap_.contains(primaryFunc->name())) {
+ /*
+ The primary function is marked with \overload. Find an
+ overload in the secondary function map that is not marked
+ with \overload but that is active and not private. Then
+ swap it with the primary function.
+ */
+ NodeList& overloads = secondaryFunctionMap_[primaryFunc->name()];
+ NodeList::ConstIterator s = overloads.constBegin();
+ while (s != overloads.constEnd()) {
+ FunctionNode *overloadFunc = (FunctionNode *) *s;
+ if (!overloadFunc->isOverload()) {
+ if (overloadFunc->status() == Active && overloadFunc->access() != Private) {
+ primaryFunc->setOverloadNumber(overloadFunc->overloadNumber());
+ overloads.replace(overloads.indexOf(overloadFunc), primaryFunc);
+ *p = overloadFunc;
+ overloadFunc->setOverloadFlag(false);
+ overloadFunc->setOverloadNumber(0);
+ break;
+ }
+ }
+ ++s;
+ }
}
}
++p;
}
-
+ /*
+ Add the related non-members here.
+ */
+ if (!related_.isEmpty()) {
+ foreach (Node* n, related_) {
+ if (n->isFunction()) {
+ FunctionNode* fn = static_cast<FunctionNode*>(n);
+ QMap<QString, Node *>::Iterator p = primaryFunctionMap_.find(fn->name());
+ if (p != primaryFunctionMap_.end()) {
+ secondaryFunctionMap_[fn->name()].append(fn);
+ fn->setOverloadNumber(secondaryFunctionMap_[fn->name()].size());
+ }
+ else
+ fn->setOverloadNumber(0);
+ }
+ }
+ }
+ /*
+ Recursive part.
+ */
NodeList::ConstIterator c = childNodes().constBegin();
while (c != childNodes().constEnd()) {
- if ((*c)->isInnerNode())
- ((InnerNode *) *c)->normalizeOverloads();
+ if ((*c)->isAggregate())
+ ((Aggregate *) *c)->normalizeOverloads();
++c;
}
}
/*!
*/
-void InnerNode::removeFromRelated()
+void Aggregate::removeFromRelated()
{
while (!related_.isEmpty()) {
Node *p = static_cast<Node *>(related_.takeFirst());
@@ -971,13 +1000,13 @@ void InnerNode::removeFromRelated()
/*!
Deletes all this node's children.
*/
-void InnerNode::deleteChildren()
+void Aggregate::deleteChildren()
{
NodeList childrenCopy = children_; // `children_` will be changed in ~Node()
qDeleteAll(childrenCopy);
}
-/*! \fn bool InnerNode::isInnerNode() const
+/*! \fn bool Aggregate::isAggregate() const
Returns \c true because this is an inner node.
*/
@@ -997,7 +1026,7 @@ bool Node::isWrapper() const
no enum type node is found that has \a enumValue as one
of its values.
*/
-const EnumNode *InnerNode::findEnumNodeForValue(const QString &enumValue) const
+const EnumNode *Aggregate::findEnumNodeForValue(const QString &enumValue) const
{
foreach (const Node *node, enumChildren_) {
const EnumNode *en = static_cast<const EnumNode *>(node);
@@ -1008,32 +1037,16 @@ const EnumNode *InnerNode::findEnumNodeForValue(const QString &enumValue) const
}
/*!
- Returnds the sequence number of the function node \a func
- in the list of overloaded functions for a class, such that
- all the functions have the same name as the \a func.
- */
-int InnerNode::overloadNumber(const FunctionNode *func) const
-{
- Node *node = const_cast<FunctionNode *>(func);
- if (primaryFunctionMap[func->name()] == node) {
- return 1;
- }
- else {
- return secondaryFunctionMap[func->name()].indexOf(node) + 2;
- }
-}
-
-/*!
Returns a node list containing all the member functions of
some class such that the functions overload the name \a funcName.
*/
-NodeList InnerNode::overloads(const QString &funcName) const
+NodeList Aggregate::overloads(const QString &funcName) const
{
NodeList result;
- Node *primary = primaryFunctionMap.value(funcName);
+ Node *primary = primaryFunctionMap_.value(funcName);
if (primary) {
result << primary;
- result += secondaryFunctionMap[funcName];
+ result += secondaryFunctionMap_[funcName];
}
return result;
}
@@ -1042,7 +1055,7 @@ NodeList InnerNode::overloads(const QString &funcName) const
Construct an inner node (i.e., not a leaf node) of the
given \a type and having the given \a parent and \a name.
*/
-InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
+Aggregate::Aggregate(NodeType type, Aggregate *parent, const QString& name)
: Node(type, parent, name)
{
switch (type) {
@@ -1059,7 +1072,7 @@ InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
/*!
Appends an \a include file to the list of include files.
*/
-void InnerNode::addInclude(const QString& include)
+void Aggregate::addInclude(const QString& include)
{
includes_.append(include);
}
@@ -1067,7 +1080,7 @@ void InnerNode::addInclude(const QString& include)
/*!
Sets the list of include files to \a includes.
*/
-void InnerNode::setIncludes(const QStringList& includes)
+void Aggregate::setIncludes(const QStringList& includes)
{
includes_ = includes;
}
@@ -1075,7 +1088,7 @@ void InnerNode::setIncludes(const QStringList& includes)
/*!
f1 is always the clone
*/
-bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
+bool Aggregate::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
{
if (f1->parameters().count() != f2->parameters().count())
return false;
@@ -1113,23 +1126,26 @@ bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
be necessary to update this node's internal collections and
the child's parent pointer and output subdirectory.
*/
-void InnerNode::addChild(Node *child)
+void Aggregate::addChild(Node *child)
{
children_.append(child);
if ((child->type() == Function) || (child->type() == QmlMethod)) {
- FunctionNode *func = (FunctionNode *) child;
- if (!primaryFunctionMap.contains(func->name())) {
- primaryFunctionMap.insert(func->name(), func);
+ FunctionNode *func = static_cast<FunctionNode*>(child);
+ QString name = func->name();
+ if (!primaryFunctionMap_.contains(name)) {
+ primaryFunctionMap_.insert(name, func);
+ func->setOverloadNumber(0);
}
else {
- NodeList &secs = secondaryFunctionMap[func->name()];
- secs.append(func);
+ NodeList &overloads = secondaryFunctionMap_[name];
+ overloads.append(func);
+ func->setOverloadNumber(overloads.size());
}
}
else {
if (child->type() == Enum)
enumChildren_.append(child);
- childMap.insertMulti(child->name(), child);
+ childMap_.insertMulti(child->name(), child);
}
if (child->parent() == 0) {
child->setParent(this);
@@ -1143,9 +1159,9 @@ void InnerNode::addChild(Node *child)
again, because it is presumed to already be there. We just
want to be able to find the child by its \a title.
*/
-void InnerNode::addChild(Node* child, const QString& title)
+void Aggregate::addChild(Node* child, const QString& title)
{
- childMap.insertMulti(title, child);
+ childMap_.insertMulti(title, child);
}
/*!
@@ -1154,40 +1170,38 @@ void InnerNode::addChild(Node* child, const QString& title)
pointer is set to 0, but its output subdirectory is not
changed.
*/
-void InnerNode::removeChild(Node *child)
+void Aggregate::removeChild(Node *child)
{
children_.removeAll(child);
enumChildren_.removeAll(child);
if (child->type() == Function) {
- QMap<QString, Node *>::Iterator prim =
- primaryFunctionMap.find(child->name());
- NodeList& secs = secondaryFunctionMap[child->name()];
- if (prim != primaryFunctionMap.end() && *prim == child) {
- if (secs.isEmpty()) {
- primaryFunctionMap.remove(child->name());
- }
- else {
- primaryFunctionMap.insert(child->name(), secs.takeFirst());
+ QMap<QString, Node *>::Iterator primary = primaryFunctionMap_.find(child->name());
+ NodeList& overloads = secondaryFunctionMap_[child->name()];
+ if (primary != primaryFunctionMap_.end() && *primary == child) {
+ primaryFunctionMap_.erase(primary);
+ if (!overloads.isEmpty()) {
+ FunctionNode* fn = static_cast<FunctionNode*>(overloads.takeFirst());
+ fn->setOverloadNumber(0);
+ primaryFunctionMap_.insert(child->name(), fn);
}
}
- else {
- secs.removeAll(child);
- }
+ else
+ overloads.removeAll(child);
}
- QMap<QString, Node *>::Iterator ent = childMap.find(child->name());
- while (ent != childMap.end() && ent.key() == child->name()) {
+ QMap<QString, Node *>::Iterator ent = childMap_.find(child->name());
+ while (ent != childMap_.end() && ent.key() == child->name()) {
if (*ent == child) {
- childMap.erase(ent);
+ childMap_.erase(ent);
break;
}
++ent;
}
if (child->title().isEmpty())
return;
- ent = childMap.find(child->title());
- while (ent != childMap.end() && ent.key() == child->title()) {
+ ent = childMap_.find(child->title());
+ while (ent != childMap_.end() && ent.key() == child->title()) {
if (*ent == child) {
- childMap.erase(ent);
+ childMap_.erase(ent);
break;
}
++ent;
@@ -1198,7 +1212,7 @@ void InnerNode::removeChild(Node *child)
/*!
Recursively sets the output subdirectory for children
*/
-void InnerNode::setOutputSubdirectory(const QString &t)
+void Aggregate::setOutputSubdirectory(const QString &t)
{
Node::setOutputSubdirectory(t);
for (int i = 0; i < childNodes().size(); ++i)
@@ -1261,7 +1275,7 @@ QString Node::physicalModuleName() const
/*!
*/
-void InnerNode::removeRelated(Node *pseudoChild)
+void Aggregate::removeRelated(Node *pseudoChild)
{
related_.removeAll(pseudoChild);
}
@@ -1270,7 +1284,7 @@ void InnerNode::removeRelated(Node *pseudoChild)
If this node has a child that is a QML property named \a n,
return the pointer to that child.
*/
-QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n) const
+QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const
{
foreach (Node* child, childNodes()) {
if (child->type() == Node::QmlProperty) {
@@ -1291,7 +1305,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n) const
whose type (attached or normal property) matches \a attached,
return the pointer to that child.
*/
-QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) const
+QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n, bool attached) const
{
foreach (Node* child, childNodes()) {
if (child->type() == Node::QmlProperty) {
@@ -1311,7 +1325,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) cons
\class LeafNode
*/
-/*! \fn bool LeafNode::isInnerNode() const
+/*! \fn bool LeafNode::isAggregate() const
Returns \c false because this is a LeafNode.
*/
@@ -1319,7 +1333,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) cons
Constructs a leaf node named \a name of the specified
\a type. The new leaf node becomes a child of \a parent.
*/
-LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
+LeafNode::LeafNode(NodeType type, Aggregate *parent, const QString& name)
: Node(type, parent, name)
{
switch (type) {
@@ -1346,7 +1360,7 @@ LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
documentation case where a \e{qmlproperty} command is used
to override the QML definition of a QML property.
*/
-LeafNode::LeafNode(InnerNode* parent, Type type, const QString& name)
+LeafNode::LeafNode(Aggregate* parent, NodeType type, const QString& name)
: Node(type, 0, name)
{
setParent(parent);
@@ -1374,8 +1388,8 @@ LeafNode::LeafNode(InnerNode* parent, Type type, const QString& name)
/*!
Constructs a namespace node.
*/
-NamespaceNode::NamespaceNode(InnerNode *parent, const QString& name)
- : InnerNode(Namespace, parent, name), seen_(false), tree_(0)
+NamespaceNode::NamespaceNode(Aggregate *parent, const QString& name)
+ : Aggregate(Namespace, parent, name), seen_(false), tree_(0)
{
setGenus(Node::CPP);
setPageType(ApiPage);
@@ -1389,8 +1403,8 @@ NamespaceNode::NamespaceNode(InnerNode *parent, const QString& name)
/*!
Constructs a class node. A class node will generate an API page.
*/
-ClassNode::ClassNode(InnerNode *parent, const QString& name)
- : InnerNode(Class, parent, name)
+ClassNode::ClassNode(Aggregate *parent, const QString& name)
+ : Aggregate(Class, parent, name)
{
abstract_ = false;
wrapper_ = false;
@@ -1584,8 +1598,8 @@ QmlTypeNode* ClassNode::findQmlBaseNode()
which specifies the type of DocumentNode. The page type for
the page index is set here.
*/
-DocumentNode::DocumentNode(InnerNode* parent, const QString& name, SubType subtype, Node::PageType ptype)
- : InnerNode(Document, parent, name), nodeSubtype_(subtype)
+DocumentNode::DocumentNode(Aggregate* parent, const QString& name, DocSubtype subtype, Node::PageType ptype)
+ : Aggregate(Document, parent, name), nodeSubtype_(subtype)
{
setGenus(Node::DOC);
switch (subtype) {
@@ -1618,7 +1632,7 @@ void DocumentNode::setTitle(const QString &title)
/*!
Returns the document node's full title, which is usually
- just title(), but for some SubType values is different
+ just title(), but for some DocSubtype values is different
from title()
*/
QString DocumentNode::fullTitle() const
@@ -1669,8 +1683,8 @@ QString DocumentNode::subTitle() const
The constructor for the node representing an enum type
has a \a parent class and an enum type \a name.
*/
-EnumNode::EnumNode(InnerNode *parent, const QString& name)
- : LeafNode(Enum, parent, name), ft(0)
+EnumNode::EnumNode(Aggregate *parent, const QString& name)
+ : LeafNode(Enum, parent, name), flagsType_(0)
{
setGenus(Node::CPP);
}
@@ -1680,8 +1694,8 @@ EnumNode::EnumNode(InnerNode *parent, const QString& name)
*/
void EnumNode::addItem(const EnumItem& item)
{
- itms.append(item);
- names.insert(item.name());
+ items_.append(item);
+ names_.insert(item.name());
}
/*!
@@ -1701,7 +1715,7 @@ Node::Access EnumNode::itemAccess(const QString &name) const
*/
QString EnumNode::itemValue(const QString &name) const
{
- foreach (const EnumItem &item, itms) {
+ foreach (const EnumItem &item, items_) {
if (item.name() == name)
return item.value();
}
@@ -1714,8 +1728,8 @@ QString EnumNode::itemValue(const QString &name) const
/*!
*/
-TypedefNode::TypedefNode(InnerNode *parent, const QString& name)
- : LeafNode(Typedef, parent, name), ae(0)
+TypedefNode::TypedefNode(Aggregate *parent, const QString& name)
+ : LeafNode(Typedef, parent, name), associatedEnum_(0)
{
setGenus(Node::CPP);
}
@@ -1724,7 +1738,7 @@ TypedefNode::TypedefNode(InnerNode *parent, const QString& name)
*/
void TypedefNode::setAssociatedEnum(const EnumNode *enume)
{
- ae = enume;
+ associatedEnum_ = enume;
}
/*!
@@ -1745,7 +1759,7 @@ Parameter::Parameter(const QString& leftType,
const QString& rightType,
const QString& name,
const QString& defaultValue)
- : lef(leftType), rig(rightType), nam(name), def(defaultValue)
+ : leftType_(leftType), rightType_(rightType), name_(name), defaultValue_(defaultValue)
{
}
@@ -1753,7 +1767,7 @@ Parameter::Parameter(const QString& leftType,
The standard copy constructor copies the strings from \a p.
*/
Parameter::Parameter(const Parameter& p)
- : lef(p.lef), rig(p.rig), nam(p.nam), def(p.def)
+ : leftType_(p.leftType_), rightType_(p.rightType_), name_(p.name_), defaultValue_(p.defaultValue_)
{
}
@@ -1763,10 +1777,10 @@ Parameter::Parameter(const Parameter& p)
*/
Parameter& Parameter::operator=(const Parameter& p)
{
- lef = p.lef;
- rig = p.rig;
- nam = p.nam;
- def = p.def;
+ leftType_ = p.leftType_;
+ rightType_ = p.rightType_;
+ name_ = p.name_;
+ defaultValue_ = p.defaultValue_;
return *this;
}
@@ -1777,12 +1791,12 @@ Parameter& Parameter::operator=(const Parameter& p)
*/
QString Parameter::reconstruct(bool value) const
{
- QString p = lef + rig;
+ QString p = leftType_ + rightType_;
if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' ')))
p += QLatin1Char(' ');
- p += nam;
- if (value && !def.isEmpty())
- p += " = " + def;
+ p += name_;
+ if (value && !defaultValue_.isEmpty())
+ p += " = " + defaultValue_;
return p;
}
@@ -1794,19 +1808,21 @@ QString Parameter::reconstruct(bool value) const
/*!
Construct a function node for a C++ function. It's parent
is \a parent, and it's name is \a name.
+
+ Do not set overloadNumber_ in the initializer list because it
+ is set by addChild() in the Node base class.
*/
-FunctionNode::FunctionNode(InnerNode *parent, const QString& name)
+FunctionNode::FunctionNode(Aggregate *parent, const QString& name)
: LeafNode(Function, parent, name),
- met(Plain),
- vir(NonVirtual),
- con(false),
- sta(false),
- ove(false),
- reimp(false),
+ metaness_(Plain),
+ virtualness_(NonVirtual),
+ const_(false),
+ static_(false),
+ reimplemented_(false),
attached_(false),
privateSignal_(false),
- rf(0),
- ap(0)
+ overload_(false),
+ reimplementedFrom_(0)
{
setGenus(Node::CPP);
}
@@ -1815,19 +1831,21 @@ FunctionNode::FunctionNode(InnerNode *parent, const QString& name)
Construct a function node for a QML method or signal, specified
by \a type. It's parent is \a parent, and it's name is \a name.
If \a attached is true, it is an attached method or signal.
+
+ Do not set overloadNumber_ in the initializer list because it
+ is set by addChild() in the Node base class.
*/
-FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bool attached)
+FunctionNode::FunctionNode(NodeType type, Aggregate *parent, const QString& name, bool attached)
: LeafNode(type, parent, name),
- met(Plain),
- vir(NonVirtual),
- con(false),
- sta(false),
- ove(false),
- reimp(false),
+ metaness_(Plain),
+ virtualness_(NonVirtual),
+ const_(false),
+ static_(false),
+ reimplemented_(false),
attached_(attached),
privateSignal_(false),
- rf(0),
- ap(0)
+ overload_(false),
+ reimplementedFrom_(0)
{
setGenus(Node::QML);
if (type == QmlMethod || type == QmlSignal) {
@@ -1843,32 +1861,33 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo
is PureVirtual, and if the parent() is a ClassNode, set the parent's
\e abstract flag to true.
*/
-void FunctionNode::setVirtualness(Virtualness virtualness)
+void FunctionNode::setVirtualness(Virtualness v)
{
- vir = virtualness;
- if ((virtualness == PureVirtual) && parent() &&
- (parent()->type() == Node::Class))
+ virtualness_ = v;
+ if ((v == PureVirtual) && parent() && (parent()->type() == Node::Class))
parent()->setAbstract(true);
}
-/*!
+/*! \fn void FunctionNode::setOverloadFlag(bool b)
+ Sets this function node's overload flag to \a b.
+ It does not set the overload number.
+ */
+
+/*! \fn void FunctionNode::setOverloadNumber(unsigned char n)
+ Sets this function node's overload number to \a n.
+ It does not set the overload flag.
*/
-void FunctionNode::setOverload(bool overlode)
-{
- parent()->setOverload(this, overlode);
- ove = overlode;
-}
/*!
- Sets the function node's reimplementation flag to \a r.
- When \a r is true, it is supposed to mean that this function
+ Sets the function node's reimplementation flag to \a b.
+ When \a b is true, it is supposed to mean that this function
is a reimplementation of a virtual function in a base class,
- but it really just means the \e reimp command was seen in the
- qdoc comment.
+ but it really just means the \e {\\reimp} command was seen in
+ the qdoc comment.
*/
-void FunctionNode::setReimp(bool r)
+void FunctionNode::setReimplemented(bool b)
{
- reimp = r;
+ reimplemented_ = b;
}
/*!
@@ -1876,16 +1895,16 @@ void FunctionNode::setReimp(bool r)
*/
void FunctionNode::addParameter(const Parameter& parameter)
{
- params.append(parameter);
+ parameters_.append(parameter);
}
/*!
*/
void FunctionNode::borrowParameterNames(const FunctionNode *source)
{
- QList<Parameter>::Iterator t = params.begin();
- QList<Parameter>::ConstIterator s = source->params.constBegin();
- while (s != source->params.constEnd() && t != params.end()) {
+ QList<Parameter>::Iterator t = parameters_.begin();
+ QList<Parameter>::ConstIterator s = source->parameters_.constBegin();
+ while (s != source->parameters_.constEnd() && t != parameters_.end()) {
if (!(*s).name().isEmpty())
(*t).setName((*s).name());
++s;
@@ -1897,30 +1916,42 @@ void FunctionNode::borrowParameterNames(const FunctionNode *source)
If this function is a reimplementation, \a from points
to the FunctionNode of the function being reimplemented.
*/
-void FunctionNode::setReimplementedFrom(FunctionNode *from)
+void FunctionNode::setReimplementedFrom(FunctionNode *f)
{
- rf = from;
- from->rb.append(this);
+ reimplementedFrom_ = f;
+ f->reimplementedBy_.append(this);
}
/*!
- Sets the "associated" property to \a property. The function
- might be the setter or getter for a property, for example.
+ Adds the "associated" property \a p to this function node.
+ The function might be the setter or getter for a property,
+ for example.
*/
-void FunctionNode::setAssociatedProperty(PropertyNode *property)
+void FunctionNode::addAssociatedProperty(PropertyNode *p)
{
- ap = property;
+ associatedProperties_.append(p);
}
/*!
- Returns the overload number for this function obtained
- from the parent.
+ Returns true if this function has at least one property
+ that is active, i.e. at least one property that is not
+ obsolete.
*/
-int FunctionNode::overloadNumber() const
+bool FunctionNode::hasActiveAssociatedProperty() const
{
- return parent()->overloadNumber(this);
+ if (associatedProperties_.isEmpty())
+ return false;
+ foreach (const PropertyNode* p, associatedProperties_) {
+ if (!p->isObsolete())
+ return true;
+ }
+ return false;
}
+/*! \fn unsigned char FunctionNode::overloadNumber() const
+ Returns the overload number for this function.
+ */
+
/*!
Returns the list of parameter names.
*/
@@ -1957,15 +1988,15 @@ QString FunctionNode::rawParameters(bool names, bool values) const
Returns the list of reconstructed parameters. If \a values
is true, the default values are included, if any are present.
*/
-QStringList FunctionNode::reconstructParams(bool values) const
+QStringList FunctionNode::reconstructParameters(bool values) const
{
- QStringList params;
+ QStringList reconstructedParameters;
QList<Parameter>::ConstIterator p = parameters().constBegin();
while (p != parameters().constEnd()) {
- params << (*p).reconstruct(values);
+ reconstructedParameters << (*p).reconstruct(values);
++p;
}
- return params;
+ return reconstructedParameters;
}
/*!
@@ -1979,11 +2010,11 @@ QString FunctionNode::signature(bool values) const
if (!returnType().isEmpty())
s = returnType() + QLatin1Char(' ');
s += name() + QLatin1Char('(');
- QStringList params = reconstructParams(values);
- int p = params.size();
+ QStringList reconstructedParameters = reconstructParameters(values);
+ int p = reconstructedParameters.size();
if (p > 0) {
for (int i=0; i<p; i++) {
- s += params[i];
+ s += reconstructedParameters[i];
if (i < (p-1))
s += ", ";
}
@@ -1993,12 +2024,25 @@ QString FunctionNode::signature(bool values) const
}
/*!
+ Returns true if function \a fn has role \a r for this
+ property.
+ */
+PropertyNode::FunctionRole PropertyNode::role(const FunctionNode* fn) const
+{
+ for (int i=0; i<4; i++) {
+ if (functions_[i].contains((Node*)fn))
+ return (FunctionRole) i;
+ }
+ return Notifier;
+}
+
+/*!
Print some debugging stuff.
*/
void FunctionNode::debug() const
{
- qDebug("QML METHOD %s rt %s pp %s",
- qPrintable(name()), qPrintable(rt), qPrintable(pp.join(' ')));
+ qDebug("QML METHOD %s returnType_ %s parentPath_ %s",
+ qPrintable(name()), qPrintable(returnType_), qPrintable(parentPath_.join(' ')));
}
/*!
@@ -2011,17 +2055,17 @@ void FunctionNode::debug() const
The constructor sets the \a parent and the \a name, but
everything else is set to default values.
*/
-PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
+PropertyNode::PropertyNode(Aggregate *parent, const QString& name)
: LeafNode(Property, parent, name),
stored_(FlagValueDefault),
designable_(FlagValueDefault),
scriptable_(FlagValueDefault),
writable_(FlagValueDefault),
user_(FlagValueDefault),
- cst(false),
- fnl(false),
- rev(-1),
- overrides(0)
+ const_(false),
+ final_(false),
+ revision_(-1),
+ overrides_(0)
{
setGenus(Node::CPP);
}
@@ -2039,8 +2083,8 @@ PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
{
for (int i = 0; i < NumFunctionRoles; ++i) {
- if (funcs[i].isEmpty())
- funcs[i] = baseProperty->funcs[i];
+ if (functions_[i].isEmpty())
+ functions_[i] = baseProperty->functions_[i];
}
if (stored_ == FlagValueDefault)
stored_ = baseProperty->stored_;
@@ -2052,7 +2096,7 @@ void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
writable_ = baseProperty->writable_;
if (user_ == FlagValueDefault)
user_ = baseProperty->user_;
- overrides = baseProperty;
+ overrides_ = baseProperty;
}
/*!
@@ -2084,8 +2128,8 @@ QMultiMap<QString,Node*> QmlTypeNode::inheritedBy;
Constructs a Qml class node. The new node has the given
\a parent and \a name.
*/
-QmlTypeNode::QmlTypeNode(InnerNode *parent, const QString& name)
- : InnerNode(QmlType, parent, name),
+QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString& name)
+ : Aggregate(QmlType, parent, name),
abstract_(false),
cnodeRequired_(false),
wrapper_(false),
@@ -2199,9 +2243,9 @@ QString QmlTypeNode::logicalModuleIdentifier() const
Constructs a Qml basic type node. The new node has the given
\a parent and \a name.
*/
-QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
+QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent,
const QString& name)
- : InnerNode(QmlBasicType, parent, name)
+ : Aggregate(QmlBasicType, parent, name)
{
setTitle(name);
setGenus(Node::QML);
@@ -2212,7 +2256,7 @@ QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
always a QmlTypeNode.
*/
QmlPropertyGroupNode::QmlPropertyGroupNode(QmlTypeNode* parent, const QString& name)
- : InnerNode(QmlPropertyGroup, parent, name)
+ : Aggregate(QmlPropertyGroup, parent, name)
{
idNumber_ = -1;
setGenus(Node::QML);
@@ -2235,7 +2279,7 @@ QString QmlPropertyGroupNode::idNumber()
/*!
Constructor for the QML property node.
*/
-QmlPropertyNode::QmlPropertyNode(InnerNode* parent,
+QmlPropertyNode::QmlPropertyNode(Aggregate* parent,
const QString& name,
const QString& type,
bool attached)
@@ -2281,16 +2325,16 @@ bool QmlPropertyNode::isWritable()
if (pn)
return pn->isWritable();
else
- location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(property not found in the C++ class or its base classes)")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
+ defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(property not found in the C++ class or its base classes)")
+ .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
}
else
- location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(C++ class not specified or not found).")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
+ defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(C++ class not specified or not found).")
+ .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
}
}
return true;
@@ -2477,6 +2521,7 @@ QString Node::cleanId(const QString &str)
return clean;
}
+#if 0
/*!
Creates a string that can be used as a UUID for the node,
depending on the type and subtype of the node. Uniquenss
@@ -2574,14 +2619,14 @@ QString Node::idForNode() const
str = "js-method-" + parent_->name().toLower() + "-" + func->name();
else if (parent_->type() == Document) {
qDebug() << "qdoc internal error: Node subtype not handled:"
- << parent_->subType() << func->name();
+ << parent_->docSubtype() << func->name();
}
else
qDebug() << "qdoc internal error: Node type not handled:"
<< parent_->type() << func->name();
}
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
str += QLatin1Char('-') + QString::number(func->overloadNumber());
}
break;
@@ -2599,7 +2644,7 @@ QString Node::idForNode() const
break;
case Node::Document:
{
- switch (subType()) {
+ switch (docSubtype()) {
case Node::Page:
case Node::HeaderFile:
str = title();
@@ -2620,7 +2665,7 @@ QString Node::idForNode() const
break;
default:
qDebug() << "ERROR: A case was not handled in Node::idForNode():"
- << "subType():" << subType() << "type():" << type();
+ << "docSubtype():" << docSubtype() << "type():" << type();
break;
}
}
@@ -2682,7 +2727,7 @@ QString Node::idForNode() const
else
str = "js-method-";
str += parent_->name().toLower() + "-" + func->name();
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
str += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
@@ -2690,12 +2735,12 @@ QString Node::idForNode() const
break;
default:
qDebug() << "ERROR: A case was not handled in Node::idForNode():"
- << "type():" << type() << "subType():" << subType();
+ << "type():" << type() << "docSubtype():" << docSubtype();
break;
}
if (str.isEmpty()) {
qDebug() << "ERROR: A link text was empty in Node::idForNode():"
- << "type():" << type() << "subType():" << subType()
+ << "type():" << type() << "docSubtype():" << docSubtype()
<< "name():" << name()
<< "title():" << title();
}
@@ -2704,12 +2749,13 @@ QString Node::idForNode() const
}
return str;
}
+#endif
/*!
Prints the inner node's list of children.
For debugging only.
*/
-void InnerNode::printChildren(const QString& title)
+void Aggregate::printChildren(const QString& title)
{
qDebug() << title << name() << children_.size();
if (children_.size() > 0) {
@@ -2792,7 +2838,7 @@ void CollectionNode::getMemberNamespaces(NodeMap& out)
Loads \a out with all this collection node's members that
are class nodes.
*/
-void CollectionNode::getMemberClasses(NodeMap& out)
+void CollectionNode::getMemberClasses(NodeMap& out) const
{
out.clear();
NodeList::const_iterator i = members_.cbegin();
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 2ccd97dbd1..e9816dad19 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -48,7 +48,7 @@ class Node;
class Tree;
class EnumNode;
class ClassNode;
-class InnerNode;
+class Aggregate;
class ExampleNode;
class TypedefNode;
class QmlTypeNode;
@@ -59,6 +59,7 @@ class CollectionNode;
class QmlPropertyNode;
typedef QList<Node*> NodeList;
+typedef QList<PropertyNode*> PropNodeList;
typedef QMap<QString, Node*> NodeMap;
typedef QMultiMap<QString, Node*> NodeMultiMap;
typedef QPair<int, int> NodeTypePair;
@@ -71,7 +72,7 @@ class Node
Q_DECLARE_TR_FUNCTIONS(QDoc::Node)
public:
- enum Type {
+ enum NodeType {
NoType,
Namespace,
Class,
@@ -94,8 +95,8 @@ public:
LastType
};
- enum SubType {
- NoSubType,
+ enum DocSubtype {
+ NoSubtype,
Example,
HeaderFile,
File,
@@ -115,7 +116,7 @@ public:
Obsolete,
Deprecated,
Preliminary,
- Commendable,
+ Active,
Internal,
Intermediate
}; // don't reorder this enum
@@ -132,13 +133,7 @@ public:
NextLink,
PreviousLink,
ContentsLink,
- IndexLink /*,
- GlossaryLink,
- CopyrightLink,
- ChapterLink,
- SectionLink,
- SubsectionLink,
- AppendixLink */
+ IndexLink
};
enum PageType {
@@ -172,24 +167,24 @@ public:
Node::Genus genus() const { return (Genus) genus_; }
void setGenus(Genus t) { genus_ = (unsigned char) t; }
- void setAccess(Access access) { access_ = (unsigned char) access; }
- void setLocation(const Location& location) { loc_ = location; }
+ void setAccess(Access t) { access_ = (unsigned char) t; }
+ void setLocation(const Location& t);
void setDoc(const Doc& doc, bool replace = false);
- void setStatus(Status status) {
- if (status_ == (unsigned char) Obsolete && status == Deprecated)
+ void setStatus(Status t) {
+ if (status_ == (unsigned char) Obsolete && t == Deprecated)
return;
- status_ = (unsigned char) status;
+ status_ = (unsigned char) t;
}
- void setThreadSafeness(ThreadSafeness safeness) { safeness_ = (unsigned char) safeness; }
+ void setThreadSafeness(ThreadSafeness t) { safeness_ = (unsigned char) t; }
void setSince(const QString &since);
- void setRelates(InnerNode* pseudoParent);
+ void setRelates(Aggregate* pseudoParent);
void setPhysicalModuleName(const QString &name) { physicalModuleName_ = name; }
void setUrl(const QString& url) { url_ = url; }
- void setTemplateStuff(const QString &templateStuff) { templateStuff_ = templateStuff; }
+ void setTemplateStuff(const QString &t) { templateStuff_ = t; }
void setReconstitutedBrief(const QString &t) { reconstitutedBrief_ = t; }
void setPageType(PageType t) { pageType_ = (unsigned char) t; }
void setPageType(const QString& t);
- void setParent(InnerNode* n) { parent_ = n; }
+ void setParent(Aggregate* n) { parent_ = n; }
void setIndexNodeFlag() { indexNodeFlag_ = true; }
virtual void setOutputFileName(const QString& ) { }
@@ -197,7 +192,7 @@ public:
bool isJsNode() const { return genus() == JS; }
bool isCppNode() const { return genus() == CPP; }
- virtual bool isInnerNode() const = 0;
+ virtual bool isAggregate() const = 0;
virtual bool isCollectionNode() const { return false; }
virtual bool isDocumentNode() const { return false; }
virtual bool isGroup() const { return false; }
@@ -208,11 +203,12 @@ public:
virtual bool isJsType() const { return false; }
virtual bool isQmlBasicType() const { return false; }
virtual bool isJsBasicType() const { return false; }
+ virtual bool isEnumType() const { return false; }
virtual bool isExample() const { return false; }
virtual bool isExampleFile() const { return false; }
virtual bool isHeaderFile() const { return false; }
virtual bool isLeaf() const { return false; }
- virtual bool isReimp() const { return false; }
+ virtual bool isReimplemented() const { return false; }
virtual bool isFunction() const { return false; }
virtual bool isNamespace() const { return false; }
virtual bool isClass() const { return false; }
@@ -249,23 +245,24 @@ public:
virtual QmlPropertyNode* hasQmlProperty(const QString& ) const { return 0; }
virtual QmlPropertyNode* hasQmlProperty(const QString&, bool ) const { return 0; }
virtual void getMemberNamespaces(NodeMap& ) { }
- virtual void getMemberClasses(NodeMap& ) { }
+ virtual void getMemberClasses(NodeMap& ) const { }
virtual bool isInternal() const;
virtual void setDataType(const QString& ) { }
virtual void setReadOnly(bool ) { }
- virtual Node* disambiguate(Type , SubType ) { return this; }
+ virtual Node* disambiguate(NodeType , DocSubtype ) { return this; }
virtual bool wasSeen() const { return false; }
virtual void appendGroupName(const QString& ) { }
virtual QString element() const { return QString(); }
virtual Tree* tree() const;
virtual void findChildren(const QString& , NodeList& nodes) const { nodes.clear(); }
+ virtual void setNoAutoList(bool ) { }
bool isIndexNode() const { return indexNodeFlag_; }
- Type type() const { return (Type) nodeType_; }
- virtual SubType subType() const { return NoSubType; }
+ NodeType type() const { return (NodeType) nodeType_; }
+ virtual DocSubtype docSubtype() const { return NoSubtype; }
bool match(const NodeTypeList& types) const;
- InnerNode* parent() const { return parent_; }
+ Aggregate* parent() const { return parent_; }
const Node* root() const;
- InnerNode* relates() const { return relatesTo_; }
+ Aggregate* relates() const { return relatesTo_; }
const QString& name() const { return name_; }
QString physicalModuleName() const;
QString url() const { return url_; }
@@ -282,7 +279,9 @@ public:
Access access() const { return (Access) access_; }
bool isPrivate() const { return (Access) access_ == Private; }
QString accessString() const;
- const Location& location() const { return loc_; }
+ const Location& declLocation() const { return declLocation_; }
+ const Location& defLocation() const { return defLocation_; }
+ const Location& location() const { return (defLocation_.isEmpty() ? declLocation_ : defLocation_); }
const Doc& doc() const { return doc_; }
bool hasDoc() const { return !doc_.isEmpty(); }
Status status() const { return (Status) status_; }
@@ -301,7 +300,7 @@ public:
void clearRelated() { relatesTo_ = 0; }
- QString guid() const;
+ //QString guid() const;
QString extractClassName(const QString &string) const;
virtual QString qmlTypeName() const { return name_; }
virtual QString qmlFullBaseName() const { return QString(); }
@@ -322,7 +321,7 @@ public:
virtual void setOutputSubdirectory(const QString& t) { outSubDir_ = t; }
QString fullDocumentName() const;
static QString cleanId(const QString &str);
- QString idForNode() const;
+ //QString idForNode() const;
static FlagValue toFlagValue(bool b);
static bool fromFlagValue(FlagValue fv, bool defaultValue);
@@ -333,10 +332,10 @@ public:
static int incPropertyGroupCount();
static void clearPropertyGroupCount();
static void initialize();
- static Type goal(const QString& t) { return goals_.value(t); }
+ static NodeType goal(const QString& t) { return goals_.value(t); }
protected:
- Node(Type type, InnerNode* parent, const QString& name);
+ Node(NodeType type, Aggregate* parent, const QString& name);
private:
@@ -348,10 +347,11 @@ private:
unsigned char status_;
bool indexNodeFlag_;
- InnerNode* parent_;
- InnerNode* relatesTo_;
+ Aggregate* parent_;
+ Aggregate* relatesTo_;
QString name_;
- Location loc_;
+ Location declLocation_;
+ Location defLocation_;
Doc doc_;
QMap<LinkType, QPair<QString, QString> > linkMap_;
QString fileNameBase_;
@@ -360,39 +360,38 @@ private:
QString since_;
QString templateStuff_;
QString reconstitutedBrief_;
- mutable QString uuid_;
+ //mutable QString uuid_;
QString outSubDir_;
static QStringMap operators_;
static int propertyGroupCount_;
- static QMap<QString,Node::Type> goals_;
+ static QMap<QString,Node::NodeType> goals_;
};
+Q_DECLARE_TYPEINFO(Node::DocSubtype, Q_PRIMITIVE_TYPE);
-class InnerNode : public Node
+class Aggregate : public Node
{
public:
- virtual ~InnerNode();
+ virtual ~Aggregate();
Node* findChildNode(const QString& name, Node::Genus genus) const;
- Node* findChildNode(const QString& name, Type type);
+ Node* findChildNode(const QString& name, NodeType type);
virtual void findChildren(const QString& name, NodeList& nodes) const Q_DECL_OVERRIDE;
FunctionNode* findFunctionNode(const QString& name) const;
FunctionNode* findFunctionNode(const FunctionNode* clone) const;
void addInclude(const QString &include);
void setIncludes(const QStringList &includes);
- void setOverload(FunctionNode* func, bool overlode);
void normalizeOverloads();
void makeUndocumentedChildrenInternal();
void deleteChildren();
void removeFromRelated();
- virtual bool isInnerNode() const Q_DECL_OVERRIDE { return true; }
+ virtual bool isAggregate() const Q_DECL_OVERRIDE { return true; }
virtual bool isLeaf() const Q_DECL_OVERRIDE { return false; }
const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
const NodeList & childNodes() const { return children_; }
const NodeList & relatedNodes() const { return related_; }
int count() const { return children_.size(); }
- int overloadNumber(const FunctionNode* func) const;
NodeList overloads(const QString &funcName) const;
const QStringList& includes() const { return includes_; }
@@ -411,9 +410,11 @@ public:
void addChild(Node* child);
void removeChild(Node* child);
void setOutputSubdirectory(const QString& t) Q_DECL_OVERRIDE;
+ const NodeMap& primaryFunctionMap() { return primaryFunctionMap_; }
+ const QMap<QString, NodeList>& secondaryFunctionMap() { return secondaryFunctionMap_; }
protected:
- InnerNode(Type type, InnerNode* parent, const QString& name);
+ Aggregate(NodeType type, Aggregate* parent, const QString& name);
private:
friend class Node;
@@ -428,9 +429,9 @@ private:
NodeList children_;
NodeList enumChildren_;
NodeList related_;
- QMap<QString, Node*> childMap;
- QMap<QString, Node*> primaryFunctionMap;
- QMap<QString, NodeList> secondaryFunctionMap;
+ NodeMap childMap_;
+ NodeMap primaryFunctionMap_;
+ QMap<QString, NodeList> secondaryFunctionMap_;
};
class LeafNode : public Node
@@ -439,18 +440,18 @@ public:
LeafNode();
virtual ~LeafNode() { }
- virtual bool isInnerNode() const Q_DECL_OVERRIDE { return false; }
+ virtual bool isAggregate() const Q_DECL_OVERRIDE { return false; }
virtual bool isLeaf() const Q_DECL_OVERRIDE { return true; }
protected:
- LeafNode(Type type, InnerNode* parent, const QString& name);
- LeafNode(InnerNode* parent, Type type, const QString& name);
+ LeafNode(NodeType type, Aggregate* parent, const QString& name);
+ LeafNode(Aggregate* parent, NodeType type, const QString& name);
};
-class NamespaceNode : public InnerNode
+class NamespaceNode : public Aggregate
{
public:
- NamespaceNode(InnerNode* parent, const QString& name);
+ NamespaceNode(Aggregate* parent, const QString& name);
virtual ~NamespaceNode() { }
virtual bool isNamespace() const Q_DECL_OVERRIDE { return true; }
virtual Tree* tree() const Q_DECL_OVERRIDE { return (parent() ? parent()->tree() : tree_); }
@@ -498,10 +499,10 @@ struct UsingClause
QString signature_;
};
-class ClassNode : public InnerNode
+class ClassNode : public Aggregate
{
public:
- ClassNode(InnerNode* parent, const QString& name);
+ ClassNode(Aggregate* parent, const QString& name);
virtual ~ClassNode() { }
virtual bool isClass() const Q_DECL_OVERRIDE { return true; }
virtual bool isWrapper() const Q_DECL_OVERRIDE { return wrapper_; }
@@ -544,13 +545,13 @@ private:
QmlTypeNode* qmlelement;
};
-class DocumentNode : public InnerNode
+class DocumentNode : public Aggregate
{
public:
- DocumentNode(InnerNode* parent,
+ DocumentNode(Aggregate* parent,
const QString& name,
- SubType subType,
+ DocSubtype docSubtype,
PageType ptype);
virtual ~DocumentNode() { }
@@ -558,7 +559,7 @@ public:
virtual void setTitle(const QString &title) Q_DECL_OVERRIDE;
virtual void setSubTitle(const QString &subTitle) Q_DECL_OVERRIDE { subtitle_ = subTitle; }
- SubType subType() const Q_DECL_OVERRIDE { return nodeSubtype_; }
+ DocSubtype docSubtype() const Q_DECL_OVERRIDE { return nodeSubtype_; }
virtual QString title() const Q_DECL_OVERRIDE { return title_; }
virtual QString fullTitle() const Q_DECL_OVERRIDE;
virtual QString subTitle() const Q_DECL_OVERRIDE;
@@ -566,13 +567,13 @@ public:
virtual QString nameForLists() const Q_DECL_OVERRIDE { return title(); }
virtual void setImageFileName(const QString& ) { }
- virtual bool isHeaderFile() const Q_DECL_OVERRIDE { return (subType() == Node::HeaderFile); }
- virtual bool isExample() const Q_DECL_OVERRIDE { return (subType() == Node::Example); }
+ virtual bool isHeaderFile() const Q_DECL_OVERRIDE { return (docSubtype() == Node::HeaderFile); }
+ virtual bool isExample() const Q_DECL_OVERRIDE { return (docSubtype() == Node::Example); }
virtual bool isExampleFile() const Q_DECL_OVERRIDE { return (parent() && parent()->isExample()); }
virtual bool isExternalPage() const Q_DECL_OVERRIDE { return nodeSubtype_ == ExternalPage; }
protected:
- SubType nodeSubtype_;
+ DocSubtype nodeSubtype_;
QString title_;
QString subtitle_;
};
@@ -580,7 +581,7 @@ protected:
class ExampleNode : public DocumentNode
{
public:
- ExampleNode(InnerNode* parent, const QString& name)
+ ExampleNode(Aggregate* parent, const QString& name)
: DocumentNode(parent, name, Node::Example, Node::ExamplePage) { }
virtual ~ExampleNode() { }
virtual QString imageFileName() const Q_DECL_OVERRIDE { return imageFileName_; }
@@ -610,10 +611,10 @@ struct ImportRec {
typedef QList<ImportRec> ImportList;
-class QmlTypeNode : public InnerNode
+class QmlTypeNode : public Aggregate
{
public:
- QmlTypeNode(InnerNode* parent, const QString& name);
+ QmlTypeNode(Aggregate* parent, const QString& name);
virtual ~QmlTypeNode();
virtual bool isQmlType() const Q_DECL_OVERRIDE { return genus() == Node::QML; }
virtual bool isJsType() const Q_DECL_OVERRIDE { return genus() == Node::JS; }
@@ -665,17 +666,17 @@ private:
ImportList importList_;
};
-class QmlBasicTypeNode : public InnerNode
+class QmlBasicTypeNode : public Aggregate
{
public:
- QmlBasicTypeNode(InnerNode* parent,
+ QmlBasicTypeNode(Aggregate* parent,
const QString& name);
virtual ~QmlBasicTypeNode() { }
virtual bool isQmlBasicType() const Q_DECL_OVERRIDE { return (genus() == Node::QML); }
virtual bool isJsBasicType() const Q_DECL_OVERRIDE { return (genus() == Node::JS); }
};
-class QmlPropertyGroupNode : public InnerNode
+class QmlPropertyGroupNode : public Aggregate
{
public:
QmlPropertyGroupNode(QmlTypeNode* parent, const QString& name);
@@ -705,7 +706,7 @@ class QmlPropertyNode : public LeafNode
Q_DECLARE_TR_FUNCTIONS(QDoc::QmlPropertyNode)
public:
- QmlPropertyNode(InnerNode *parent,
+ QmlPropertyNode(Aggregate *parent,
const QString& name,
const QString& type,
bool attached);
@@ -760,57 +761,58 @@ class EnumItem
public:
EnumItem() { }
EnumItem(const QString& name, const QString& value)
- : nam(name), val(value) { }
+ : name_(name), value_(value) { }
- const QString& name() const { return nam; }
- const QString& value() const { return val; }
+ const QString& name() const { return name_; }
+ const QString& value() const { return value_; }
private:
- QString nam;
- QString val;
+ QString name_;
+ QString value_;
};
class EnumNode : public LeafNode
{
public:
- EnumNode(InnerNode* parent, const QString& name);
+ EnumNode(Aggregate* parent, const QString& name);
virtual ~EnumNode() { }
void addItem(const EnumItem& item);
void setFlagsType(TypedefNode* typedeff);
- bool hasItem(const QString &name) const { return names.contains(name); }
+ bool hasItem(const QString &name) const { return names_.contains(name); }
+ virtual bool isEnumType() const Q_DECL_OVERRIDE { return true; }
- const QList<EnumItem>& items() const { return itms; }
+ const QList<EnumItem>& items() const { return items_; }
Access itemAccess(const QString& name) const;
- const TypedefNode* flagsType() const { return ft; }
+ const TypedefNode* flagsType() const { return flagsType_; }
QString itemValue(const QString &name) const;
private:
- QList<EnumItem> itms;
- QSet<QString> names;
- const TypedefNode* ft;
+ QList<EnumItem> items_;
+ QSet<QString> names_;
+ const TypedefNode* flagsType_;
};
class TypedefNode : public LeafNode
{
public:
- TypedefNode(InnerNode* parent, const QString& name);
+ TypedefNode(Aggregate* parent, const QString& name);
virtual ~TypedefNode() { }
- const EnumNode* associatedEnum() const { return ae; }
+ const EnumNode* associatedEnum() const { return associatedEnum_; }
private:
- void setAssociatedEnum(const EnumNode* enume);
+ void setAssociatedEnum(const EnumNode* t);
friend class EnumNode;
- const EnumNode* ae;
+ const EnumNode* associatedEnum_;
};
-inline void EnumNode::setFlagsType(TypedefNode* typedeff)
+inline void EnumNode::setFlagsType(TypedefNode* t)
{
- ft = typedeff;
- typedeff->setAssociatedEnum(this);
+ flagsType_ = t;
+ t->setAssociatedEnum(this);
}
@@ -826,21 +828,21 @@ public:
Parameter& operator=(const Parameter& p);
- void setName(const QString& name) { nam = name; }
+ void setName(const QString& name) { name_ = name; }
- bool hasType() const { return lef.length() + rig.length() > 0; }
- const QString& leftType() const { return lef; }
- const QString& rightType() const { return rig; }
- const QString& name() const { return nam; }
- const QString& defaultValue() const { return def; }
+ bool hasType() const { return leftType_.length() + rightType_.length() > 0; }
+ const QString& leftType() const { return leftType_; }
+ const QString& rightType() const { return rightType_; }
+ const QString& name() const { return name_; }
+ const QString& defaultValue() const { return defaultValue_; }
QString reconstruct(bool value = false) const;
private:
- QString lef;
- QString rig;
- QString nam;
- QString def;
+ QString leftType_;
+ QString rightType_;
+ QString name_;
+ QString defaultValue_;
};
class FunctionNode : public LeafNode
@@ -855,35 +857,37 @@ public:
MacroWithParams,
MacroWithoutParams,
Native };
- enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual };
+ enum Virtualness { NonVirtual, NormalVirtual, PureVirtual };
- FunctionNode(InnerNode* parent, const QString &name);
- FunctionNode(Type type, InnerNode* parent, const QString &name, bool attached);
+ FunctionNode(Aggregate* parent, const QString &name);
+ FunctionNode(NodeType type, Aggregate* parent, const QString &name, bool attached);
virtual ~FunctionNode() { }
- void setReturnType(const QString& returnType) { rt = returnType; }
- void setParentPath(const QStringList& parentPath) { pp = parentPath; }
- void setMetaness(Metaness metaness) { met = metaness; }
- void setVirtualness(Virtualness virtualness);
- void setConst(bool conste) { con = conste; }
- void setStatic(bool statique) { sta = statique; }
- void setOverload(bool overlode);
- void setReimp(bool r);
+ void setReturnType(const QString& t) { returnType_ = t; }
+ void setParentPath(const QStringList& p) { parentPath_ = p; }
+ void setMetaness(Metaness t) { metaness_ = t; }
+ void setVirtualness(Virtualness v);
+ void setConst(bool b) { const_ = b; }
+ void setStatic(bool b) { static_ = b; }
+ unsigned char overloadNumber() const { return overloadNumber_; }
+ void setOverloadFlag(bool b) { overload_ = b; }
+ void setOverloadNumber(unsigned char n) { overloadNumber_ = n; }
+ void setReimplemented(bool b);
void addParameter(const Parameter& parameter);
inline void setParameters(const QList<Parameter>& parameters);
void borrowParameterNames(const FunctionNode* source);
void setReimplementedFrom(FunctionNode* from);
- const QString& returnType() const { return rt; }
- Metaness metaness() const { return met; }
+ const QString& returnType() const { return returnType_; }
+ Metaness metaness() const { return metaness_; }
bool isMacro() const {
- return met == MacroWithParams || met == MacroWithoutParams;
+ return metaness_ == MacroWithParams || metaness_ == MacroWithoutParams;
}
- Virtualness virtualness() const { return vir; }
- bool isConst() const { return con; }
- bool isStatic() const { return sta; }
- bool isOverload() const { return ove; }
- bool isReimp() const Q_DECL_OVERRIDE { return reimp; }
+ Virtualness virtualness() const { return virtualness_; }
+ bool isConst() const { return const_; }
+ bool isStatic() const { return static_; }
+ bool isOverload() const { return overload_; }
+ bool isReimplemented() const Q_DECL_OVERRIDE { return reimplemented_; }
bool isFunction() const Q_DECL_OVERRIDE { return true; }
virtual bool isQmlSignal() const Q_DECL_OVERRIDE {
return (type() == Node::QmlSignal) && (genus() == Node::QML);
@@ -903,17 +907,20 @@ public:
virtual bool isJsMethod() const Q_DECL_OVERRIDE {
return (type() == Node::QmlMethod) && (genus() == Node::JS);
}
- int overloadNumber() const;
- const QList<Parameter>& parameters() const { return params; }
- void clearParams() { params.clear(); }
+ const QList<Parameter>& parameters() const { return parameters_; }
+ void clearParams() { parameters_.clear(); }
QStringList parameterNames() const;
QString rawParameters(bool names = false, bool values = false) const;
- const FunctionNode* reimplementedFrom() const { return rf; }
- const QList<FunctionNode*> &reimplementedBy() const { return rb; }
- const PropertyNode* associatedProperty() const { return ap; }
- const QStringList& parentPath() const { return pp; }
-
- QStringList reconstructParams(bool values = false) const;
+ const FunctionNode* reimplementedFrom() const { return reimplementedFrom_; }
+ const QList<FunctionNode*> &reimplementedBy() const { return reimplementedBy_; }
+ const PropNodeList& associatedProperties() const { return associatedProperties_; }
+ const QStringList& parentPath() const { return parentPath_; }
+ bool hasAssociatedProperties() const { return !associatedProperties_.isEmpty(); }
+ bool hasOneAssociatedProperty() const { return (associatedProperties_.size() == 1); }
+ PropertyNode* firstAssociatedProperty() const { return associatedProperties_[0]; }
+ bool hasActiveAssociatedProperty() const;
+
+ QStringList reconstructParameters(bool values = false) const;
QString signature(bool values = false) const;
virtual QString element() const Q_DECL_OVERRIDE { return parent()->name(); }
virtual bool isAttached() const Q_DECL_OVERRIDE { return attached_; }
@@ -934,25 +941,26 @@ public:
void debug() const;
private:
- void setAssociatedProperty(PropertyNode* property);
+ void addAssociatedProperty(PropertyNode* property);
- friend class InnerNode;
+ friend class Aggregate;
friend class PropertyNode;
- QString rt;
- QStringList pp;
- Metaness met;
- Virtualness vir;
- bool con : 1;
- bool sta : 1;
- bool ove : 1;
- bool reimp: 1;
+ QString returnType_;
+ QStringList parentPath_;
+ Metaness metaness_;
+ Virtualness virtualness_;
+ bool const_ : 1;
+ bool static_ : 1;
+ bool reimplemented_: 1;
bool attached_: 1;
bool privateSignal_: 1;
- QList<Parameter> params;
- const FunctionNode* rf;
- const PropertyNode* ap;
- QList<FunctionNode*> rb;
+ bool overload_ : 1;
+ unsigned char overloadNumber_;
+ QList<Parameter> parameters_;
+ const FunctionNode* reimplementedFrom_;
+ PropNodeList associatedProperties_;
+ QList<FunctionNode*> reimplementedBy_;
};
class PropertyNode : public LeafNode
@@ -961,7 +969,7 @@ public:
enum FunctionRole { Getter, Setter, Resetter, Notifier };
enum { NumFunctionRoles = Notifier + 1 };
- PropertyNode(InnerNode* parent, const QString& name);
+ PropertyNode(Aggregate* parent, const QString& name);
virtual ~PropertyNode() { }
virtual void setDataType(const QString& dataType) Q_DECL_OVERRIDE { type_ = dataType; }
@@ -974,30 +982,31 @@ public:
void setWritable(bool writable) { writable_ = toFlagValue(writable); }
void setUser(bool user) { user_ = toFlagValue(user); }
void setOverriddenFrom(const PropertyNode* baseProperty);
- void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; }
- void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; }
- void setConstant() { cst = true; }
- void setFinal() { fnl = true; }
- void setRevision(int revision) { rev = revision; }
+ void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc_ = rdf; }
+ void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc_ = scrf; }
+ void setConstant() { const_ = true; }
+ void setFinal() { final_ = true; }
+ void setRevision(int revision) { revision_ = revision; }
const QString &dataType() const { return type_; }
QString qualifiedDataType() const;
NodeList functions() const;
- NodeList functions(FunctionRole role) const { return funcs[(int)role]; }
+ NodeList functions(FunctionRole role) const { return functions_[(int)role]; }
NodeList getters() const { return functions(Getter); }
NodeList setters() const { return functions(Setter); }
NodeList resetters() const { return functions(Resetter); }
NodeList notifiers() const { return functions(Notifier); }
+ FunctionRole role(const FunctionNode* fn) const;
bool isStored() const { return fromFlagValue(stored_, storedDefault()); }
bool isDesignable() const { return fromFlagValue(designable_, designableDefault()); }
bool isScriptable() const { return fromFlagValue(scriptable_, scriptableDefault()); }
- const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; }
- const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; }
+ const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc_; }
+ const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc_; }
bool isWritable() const { return fromFlagValue(writable_, writableDefault()); }
bool isUser() const { return fromFlagValue(user_, userDefault()); }
- bool isConstant() const { return cst; }
- bool isFinal() const { return fnl; }
- const PropertyNode* overriddenFrom() const { return overrides; }
+ bool isConstant() const { return const_; }
+ bool isFinal() const { return final_; }
+ const PropertyNode* overriddenFrom() const { return overrides_; }
bool storedDefault() const { return true; }
bool userDefault() const { return false; }
@@ -1007,68 +1016,68 @@ public:
private:
QString type_;
- QString runtimeDesFunc;
- QString runtimeScrFunc;
- NodeList funcs[NumFunctionRoles];
+ QString runtimeDesFunc_;
+ QString runtimeScrFunc_;
+ NodeList functions_[NumFunctionRoles];
FlagValue stored_;
FlagValue designable_;
FlagValue scriptable_;
FlagValue writable_;
FlagValue user_;
- bool cst;
- bool fnl;
- int rev;
- const PropertyNode* overrides;
+ bool const_;
+ bool final_;
+ int revision_;
+ const PropertyNode* overrides_;
};
-inline void FunctionNode::setParameters(const QList<Parameter> &parameters)
+inline void FunctionNode::setParameters(const QList<Parameter> &p)
{
- params = parameters;
+ parameters_ = p;
}
inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
{
- funcs[(int)role].append(function);
- function->setAssociatedProperty(this);
+ functions_[(int)role].append(function);
+ function->addAssociatedProperty(this);
}
inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
{
- funcs[(int)role].append(function);
- function->setAssociatedProperty(this);
+ functions_[(int)role].append(function);
+ function->addAssociatedProperty(this);
}
inline NodeList PropertyNode::functions() const
{
NodeList list;
for (int i = 0; i < NumFunctionRoles; ++i)
- list += funcs[i];
+ list += functions_[i];
return list;
}
class VariableNode : public LeafNode
{
public:
- VariableNode(InnerNode* parent, const QString &name);
+ VariableNode(Aggregate* parent, const QString &name);
virtual ~VariableNode() { }
- void setLeftType(const QString &leftType) { lt = leftType; }
- void setRightType(const QString &rightType) { rt = rightType; }
- void setStatic(bool statique) { sta = statique; }
+ void setLeftType(const QString &leftType) { lrftType_ = leftType; }
+ void setRightType(const QString &rightType) { rightType_ = rightType; }
+ void setStatic(bool b) { static_ = b; }
- const QString &leftType() const { return lt; }
- const QString &rightType() const { return rt; }
- QString dataType() const { return lt + rt; }
- bool isStatic() const { return sta; }
+ const QString &leftType() const { return lrftType_; }
+ const QString &rightType() const { return rightType_; }
+ QString dataType() const { return lrftType_ + rightType_; }
+ bool isStatic() const { return static_; }
private:
- QString lt;
- QString rt;
- bool sta;
+ QString lrftType_;
+ QString rightType_;
+ bool static_;
};
-inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
- : LeafNode(Variable, parent, name), sta(false)
+inline VariableNode::VariableNode(Aggregate* parent, const QString &name)
+ : LeafNode(Variable, parent, name), static_(false)
{
setGenus(Node::CPP);
}
@@ -1076,20 +1085,21 @@ inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
class DitaMapNode : public DocumentNode
{
public:
- DitaMapNode(InnerNode* parent, const QString& name)
+ DitaMapNode(Aggregate* parent, const QString& name)
: DocumentNode(parent, name, Node::Page, Node::DitaMapPage) { }
virtual ~DitaMapNode() { }
const DitaRefList& map() const { return doc().ditamap(); }
};
-class CollectionNode : public InnerNode
+class CollectionNode : public Aggregate
{
public:
- CollectionNode(Type type,
- InnerNode* parent,
+ CollectionNode(NodeType type,
+ Aggregate* parent,
const QString& name,
- Genus genus) : InnerNode(type, parent, name), seen_(false)
+ Genus genus)
+ : Aggregate(type, parent, name), seen_(false), noAutoList_(false)
{
setPageType(Node::OverviewPage);
setGenus(genus);
@@ -1108,7 +1118,7 @@ class CollectionNode : public InnerNode
virtual bool hasNamespaces() const Q_DECL_OVERRIDE;
virtual bool hasClasses() const Q_DECL_OVERRIDE;
virtual void getMemberNamespaces(NodeMap& out) Q_DECL_OVERRIDE;
- virtual void getMemberClasses(NodeMap& out) Q_DECL_OVERRIDE;
+ virtual void getMemberClasses(NodeMap& out) const Q_DECL_OVERRIDE;
virtual bool wasSeen() const Q_DECL_OVERRIDE { return seen_; }
virtual QString title() const Q_DECL_OVERRIDE { return title_; }
virtual QString subTitle() const Q_DECL_OVERRIDE { return subtitle_; }
@@ -1132,9 +1142,12 @@ class CollectionNode : public InnerNode
void markSeen() { seen_ = true; }
void markNotSeen() { seen_ = false; }
+ bool noAutoList() const { return noAutoList_; }
+ virtual void setNoAutoList(bool b) Q_DECL_OVERRIDE { noAutoList_ = b; }
private:
bool seen_;
+ bool noAutoList_;
QString title_;
QString subtitle_;
NodeList members_;
diff --git a/src/tools/qdoc/openedlist.h b/src/tools/qdoc/openedlist.h
index ee45714cfd..3a564b018d 100644
--- a/src/tools/qdoc/openedlist.h
+++ b/src/tools/qdoc/openedlist.h
@@ -79,6 +79,7 @@ private:
QString pref;
QString suff;
};
+Q_DECLARE_TYPEINFO(OpenedList, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/plaincodemarker.cpp b/src/tools/qdoc/plaincodemarker.cpp
index 94561c3f48..bf2a55b2d5 100644
--- a/src/tools/qdoc/plaincodemarker.cpp
+++ b/src/tools/qdoc/plaincodemarker.cpp
@@ -58,7 +58,7 @@ bool PlainCodeMarker::recognizeLanguage( const QString& /* lang */ )
return false;
}
-Atom::Type PlainCodeMarker::atomType() const
+Atom::AtomType PlainCodeMarker::atomType() const
{
return Atom::Code;
}
@@ -109,7 +109,7 @@ QString PlainCodeMarker::functionEndRegExp( const QString& /* funcName */ )
return QString();
}
-QList<Section> PlainCodeMarker::sections(const InnerNode * /* innerNode */,
+QList<Section> PlainCodeMarker::sections(const Aggregate * /* innerNode */,
SynopsisStyle /* style */,
Status /* status */)
{
diff --git a/src/tools/qdoc/plaincodemarker.h b/src/tools/qdoc/plaincodemarker.h
index 6d41b3dd81..b83a3e4697 100644
--- a/src/tools/qdoc/plaincodemarker.h
+++ b/src/tools/qdoc/plaincodemarker.h
@@ -51,7 +51,7 @@ public:
bool recognizeCode( const QString& code ) Q_DECL_OVERRIDE;
bool recognizeExtension( const QString& ext ) Q_DECL_OVERRIDE;
bool recognizeLanguage( const QString& lang ) Q_DECL_OVERRIDE;
- Atom::Type atomType() const Q_DECL_OVERRIDE;
+ Atom::AtomType atomType() const Q_DECL_OVERRIDE;
QString markedUpCode( const QString& code, const Node *relative, const Location &location ) Q_DECL_OVERRIDE;
QString markedUpSynopsis( const Node *node, const Node *relative,
SynopsisStyle style ) Q_DECL_OVERRIDE;
@@ -61,7 +61,7 @@ public:
QString markedUpIncludes( const QStringList& includes ) Q_DECL_OVERRIDE;
QString functionBeginRegExp( const QString& funcName ) Q_DECL_OVERRIDE;
QString functionEndRegExp( const QString& funcName ) Q_DECL_OVERRIDE;
- QList<Section> sections(const InnerNode *innerNode, SynopsisStyle style, Status status) Q_DECL_OVERRIDE;
+ QList<Section> sections(const Aggregate *innerNode, SynopsisStyle style, Status status) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp
index e47460efb2..80a7ec4bf5 100644
--- a/src/tools/qdoc/puredocparser.cpp
+++ b/src/tools/qdoc/puredocparser.cpp
@@ -149,12 +149,6 @@ bool PureDocParser::processQdocComments()
isJsPropertyTopic = true;
}
}
- if ((isQmlPropertyTopic || isJsPropertyTopic) && topics.size() > 1) {
- qDebug() << "MULTIPLE TOPICS:" << doc.location().fileName() << doc.location().lineNo();
- for (int i=0; i<topics.size(); ++i) {
- qDebug() << " " << topics[i].topic << topics[i].args;
- }
- }
NodeList nodes;
DocList docs;
@@ -207,14 +201,14 @@ bool PureDocParser::processQdocComments()
processOtherMetaCommands(*d, *n);
(*n)->setDoc(*d);
checkModuleInclusion(*n);
- if ((*n)->isInnerNode() && ((InnerNode *)*n)->includes().isEmpty()) {
- InnerNode *m = static_cast<InnerNode *>(*n);
+ if ((*n)->isAggregate() && ((Aggregate *)*n)->includes().isEmpty()) {
+ Aggregate *m = static_cast<Aggregate *>(*n);
while (m->parent() && m->parent() != treeRoot)
m = m->parent();
if (m == *n)
- ((InnerNode *)*n)->addInclude((*n)->name());
+ ((Aggregate *)*n)->addInclude((*n)->name());
else
- ((InnerNode *)*n)->setIncludes(m->includes());
+ ((Aggregate *)*n)->setIncludes(m->includes());
}
++d;
++n;
diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro
index f0df113af8..634d30a9a3 100644
--- a/src/tools/qdoc/qdoc.pro
+++ b/src/tools/qdoc/qdoc.pro
@@ -1,11 +1,10 @@
!force_bootstrap {
load(qfeatures)
requires(!contains(QT_DISABLED_FEATURES, xmlstreamwriter))
- requires(!contains(QT_DISABLED_FEATURES, dom))
}
option(host_build)
-QT = core xml
+QT = core
DEFINES += \
QT_QMLDEVTOOLS_LIB \ # force static exports even if not bootstrapping
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index bf84fa8335..5f2a61bb76 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -167,7 +167,7 @@ void QDocForest::setSearchOrder(QStringList& t)
forest_.remove(primaryName);
QMap<QString, Tree*>::iterator i;
- foreach (QString m, t) {
+ foreach (const QString &m, t) {
if (primaryName != m) {
i = forest_.find(m);
if (i != forest_.end()) {
@@ -815,7 +815,7 @@ void QDocDatabase::processForest()
mode, each tree is analyzed in turn, and its classes and
types are added to the appropriate node maps.
*/
-void QDocDatabase::processForest(void (QDocDatabase::*func) (InnerNode*))
+void QDocDatabase::processForest(void (QDocDatabase::*func) (Aggregate*))
{
Tree* t = forest_.firstTree();
while (t) {
@@ -930,7 +930,7 @@ NodeMultiMap& QDocDatabase::getCppClasses()
Finds all the C++ class nodes and QML type nodes and
sorts them into maps.
*/
-void QDocDatabase::findAllClasses(InnerNode* node)
+void QDocDatabase::findAllClasses(Aggregate* node)
{
NodeList::const_iterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
@@ -957,8 +957,8 @@ void QDocDatabase::findAllClasses(InnerNode* node)
if ((*c)->isQmlBasicType() || (*c)->isJsType())
qmlBasicTypes_.insert(qmlTypeName,*c);
}
- else if ((*c)->isInnerNode()) {
- findAllClasses(static_cast<InnerNode*>(*c));
+ else if ((*c)->isAggregate()) {
+ findAllClasses(static_cast<Aggregate*>(*c));
}
}
++c;
@@ -978,13 +978,13 @@ NodeMapMap& QDocDatabase::getFunctionIndex()
/*!
Finds all the function nodes
*/
-void QDocDatabase::findAllFunctions(InnerNode* node)
+void QDocDatabase::findAllFunctions(Aggregate* node)
{
NodeList::ConstIterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
if ((*c)->access() != Node::Private) {
- if ((*c)->isInnerNode()) {
- findAllFunctions(static_cast<InnerNode*>(*c));
+ if ((*c)->isAggregate()) {
+ findAllFunctions(static_cast<Aggregate*>(*c));
}
else if ((*c)->type() == Node::Function) {
const FunctionNode* func = static_cast<const FunctionNode*>(*c);
@@ -1004,15 +1004,15 @@ void QDocDatabase::findAllFunctions(InnerNode* node)
Finds all the nodes containing legalese text and puts them
in a map.
*/
-void QDocDatabase::findAllLegaleseTexts(InnerNode* node)
+void QDocDatabase::findAllLegaleseTexts(Aggregate* node)
{
NodeList::ConstIterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
if ((*c)->access() != Node::Private) {
if (!(*c)->doc().legaleseText().isEmpty())
legaleseTexts_.insertMulti((*c)->doc().legaleseText(), *c);
- if ((*c)->isInnerNode())
- findAllLegaleseTexts(static_cast<InnerNode *>(*c));
+ if ((*c)->isAggregate())
+ findAllLegaleseTexts(static_cast<Aggregate *>(*c));
}
++c;
}
@@ -1021,13 +1021,13 @@ void QDocDatabase::findAllLegaleseTexts(InnerNode* node)
/*!
Finds all the namespace nodes and puts them in an index.
*/
-void QDocDatabase::findAllNamespaces(InnerNode* node)
+void QDocDatabase::findAllNamespaces(Aggregate* node)
{
NodeList::ConstIterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
if ((*c)->access() != Node::Private || (*c)->isNamespace()) {
- if ((*c)->isInnerNode()) {
- findAllNamespaces(static_cast<InnerNode *>(*c));
+ if ((*c)->isAggregate()) {
+ findAllNamespaces(static_cast<Aggregate *>(*c));
if ((*c)->isNamespace()) {
// Ensure that the namespace's name is not empty (the root
// namespace has no name).
@@ -1046,7 +1046,7 @@ void QDocDatabase::findAllNamespaces(InnerNode* node)
maps. They can be C++ classes, QML types, or they can be
functions, enum types, typedefs, methods, etc.
*/
-void QDocDatabase::findAllObsoleteThings(InnerNode* node)
+void QDocDatabase::findAllObsoleteThings(Aggregate* node)
{
NodeList::const_iterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
@@ -1067,7 +1067,7 @@ void QDocDatabase::findAllObsoleteThings(InnerNode* node)
}
}
else if ((*c)->type() == Node::Class) {
- InnerNode* n = static_cast<InnerNode*>(*c);
+ Aggregate* n = static_cast<Aggregate*>(*c);
bool inserted = false;
NodeList::const_iterator p = n->childNodes().constBegin();
while (p != n->childNodes().constEnd()) {
@@ -1096,7 +1096,7 @@ void QDocDatabase::findAllObsoleteThings(InnerNode* node)
}
}
else if ((*c)->isQmlType() || (*c)->isJsType()) {
- InnerNode* n = static_cast<InnerNode*>(*c);
+ Aggregate* n = static_cast<Aggregate*>(*c);
bool inserted = false;
NodeList::const_iterator p = n->childNodes().constBegin();
while (p != n->childNodes().constEnd()) {
@@ -1127,8 +1127,8 @@ void QDocDatabase::findAllObsoleteThings(InnerNode* node)
++p;
}
}
- else if ((*c)->isInnerNode()) {
- findAllObsoleteThings(static_cast<InnerNode*>(*c));
+ else if ((*c)->isAggregate()) {
+ findAllObsoleteThings(static_cast<Aggregate*>(*c));
}
}
++c;
@@ -1143,7 +1143,7 @@ void QDocDatabase::findAllObsoleteThings(InnerNode* node)
This function is used for generating the "New Classes... in x.y"
section on the \e{What's New in Qt x.y} page.
*/
-void QDocDatabase::findAllSince(InnerNode* node)
+void QDocDatabase::findAllSince(Aggregate* node)
{
NodeList::const_iterator child = node->childNodes().constBegin();
while (child != node->childNodes().constEnd()) {
@@ -1206,8 +1206,8 @@ void QDocDatabase::findAllSince(InnerNode* node)
}
}
// Recursively find child nodes with since commands.
- if ((*child)->isInnerNode())
- findAllSince(static_cast<InnerNode *>(*child));
+ if ((*child)->isAggregate())
+ findAllSince(static_cast<Aggregate *>(*child));
++child;
}
@@ -1264,6 +1264,10 @@ const NodeMap& QDocDatabase::getSinceMap(const QString& key)
to generating documentation.
*/
void QDocDatabase::resolveIssues() {
+ primaryTreeRoot()->normalizeOverloads();
+ fixInheritance();
+ resolveProperties();
+ primaryTreeRoot()->makeUndocumentedChildrenInternal();
resolveQmlInheritance(primaryTreeRoot());
primaryTree()->resolveTargets(primaryTreeRoot());
primaryTree()->resolveCppToQmlLinks();
@@ -1277,6 +1281,7 @@ void QDocDatabase::resolveStuff()
primaryTree()->resolveCppToQmlLinks();
primaryTree()->resolveUsingClauses();
resolveNamespaces();
+ primaryTreeRoot()->normalizeOverloads();
}
/*!
@@ -1291,7 +1296,7 @@ void QDocDatabase::resolveNamespaces()
t = forest_.nextTree();
}
QList<QString> keys = nmm_.uniqueKeys();
- foreach (QString s, keys) {
+ foreach (const QString &s, keys) {
NamespaceNode* ns = 0;
QList<Node*> nodes = nmm_.values(s);
int count = nmm_.remove(s);
@@ -1394,7 +1399,7 @@ const Node* QDocDatabase::findNodeForTarget(const QString& target, const Node* r
base type node. If the node is found in the tree, set the
node's QML base type node pointer.
*/
-void QDocDatabase::resolveQmlInheritance(InnerNode* root)
+void QDocDatabase::resolveQmlInheritance(Aggregate* root)
{
NodeMap previousSearches;
// Do we need recursion?
@@ -1515,7 +1520,7 @@ FunctionNode* QDocDatabase::findNodeInOpenNamespace(const QStringList& parentPat
This function only searches in the current primary tree.
*/
-Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path, Node::Type type)
+Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path, Node::NodeType type)
{
if (path.isEmpty())
return 0;
@@ -1574,6 +1579,13 @@ void QDocDatabase::mergeCollections(Node::Genus genus, CNMap& cnm, const Node* r
if (values.size() > 1) {
foreach (CollectionNode* v, values) {
if (v != n) {
+ // Allow multiple (major) versions of QML/JS modules
+ if (n->type() == Node::QmlModule
+ && n->logicalModuleIdentifier() != v->logicalModuleIdentifier()) {
+ if (v->wasSeen() && v != relative && !v->members().isEmpty())
+ cnm.insert(v->fullTitle().toLower(), v);
+ continue;
+ }
foreach (Node* t, v->members())
n->addMember(t);
}
@@ -1594,12 +1606,19 @@ void QDocDatabase::mergeCollections(Node::Genus genus, CNMap& cnm, const Node* r
Finds all the collection nodes with the same name
and genus as \a c and merges their members into the
members list of \a c.
+
+ For QML and JS modules, the merge is done only if
+ the module identifier matches between the nodes, to avoid
+ merging modules with different (major) versions.
*/
void QDocDatabase::mergeCollections(CollectionNode* c)
{
foreach (Tree* t, searchOrder()) {
CollectionNode* cn = t->getCollection(c->name(), c->genus());
if (cn && cn != c) {
+ if (cn->type() == Node::QmlModule
+ && cn->logicalModuleIdentifier() != c->logicalModuleIdentifier())
+ continue;
foreach (Node* n, cn->members())
c->addMember(n);
}
@@ -1626,7 +1645,7 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q
Tree* domain = 0;
Node::Genus genus = Node::DontCare;
// Reserved for future use
- //Node::Type goal = Node::NoType;
+ //Node::NodeType goal = Node::NoType;
if (atom->isLinkAtom()) {
domain = atom->domain();
diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h
index b8ca8bc32d..5d55ea48e1 100644
--- a/src/tools/qdoc/qdocdatabase.h
+++ b/src/tools/qdoc/qdocdatabase.h
@@ -103,7 +103,7 @@ class QDocForest
return 0;
}
- Node* findNodeByNameAndType(const QStringList& path, Node::Type type) {
+ Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) {
foreach (Tree* t, searchOrder()) {
Node* n = t->findNodeByNameAndType(path, type);
if (n)
@@ -130,9 +130,9 @@ class QDocForest
return 0;
}
- InnerNode* findRelatesNode(const QStringList& path) {
+ Aggregate* findRelatesNode(const QStringList& path) {
foreach (Tree* t, searchOrder()) {
- InnerNode* n = t->findRelatesNode(path);
+ Aggregate* n = t->findRelatesNode(path);
if (n)
return n;
}
@@ -177,6 +177,16 @@ class QDocForest
return 0;
}
+ const CollectionNode* getCollectionNode(const QString& name, Node::Genus genus)
+ {
+ foreach (Tree* t, searchOrder()) {
+ const CollectionNode* cn = t->getCollection(name, genus);
+ if (cn)
+ return cn;
+ }
+ return 0;
+ }
+
QmlTypeNode* lookupQmlType(const QString& name)
{
foreach (Tree* t, searchOrder()) {
@@ -221,19 +231,11 @@ class QDocDatabase
Tree* findTree(const QString& t) { return forest_.findTree(t); }
- CollectionNode* getCollection(const QString& name, Node::Genus genus) {
- return primaryTree()->getCollection(name, genus);
- }
const CNMap& groups() { return primaryTree()->groups(); }
const CNMap& modules() { return primaryTree()->modules(); }
const CNMap& qmlModules() { return primaryTree()->qmlModules(); }
const CNMap& jsModules() { return primaryTree()->jsModules(); }
- CollectionNode* findGroup(const QString& name) { return primaryTree()->findGroup(name); }
- CollectionNode* findModule(const QString& name) { return primaryTree()->findModule(name); }
- CollectionNode* findQmlModule(const QString& name) { return primaryTree()->findQmlModule(name); }
- CollectionNode* findJsModule(const QString& name) { return primaryTree()->findJsModule(name); }
-
CollectionNode* addGroup(const QString& name) { return primaryTree()->addGroup(name); }
CollectionNode* addModule(const QString& name) { return primaryTree()->addModule(name); }
CollectionNode* addQmlModule(const QString& name) { return primaryTree()->addQmlModule(name); }
@@ -260,12 +262,12 @@ class QDocDatabase
QmlTypeNode* findQmlType(const ImportRec& import, const QString& name);
private:
- void findAllClasses(InnerNode *node);
- void findAllFunctions(InnerNode *node);
- void findAllLegaleseTexts(InnerNode *node);
- void findAllNamespaces(InnerNode *node);
- void findAllObsoleteThings(InnerNode* node);
- void findAllSince(InnerNode *node);
+ void findAllClasses(Aggregate *node);
+ void findAllFunctions(Aggregate *node);
+ void findAllLegaleseTexts(Aggregate *node);
+ void findAllNamespaces(Aggregate *node);
+ void findAllObsoleteThings(Aggregate* node);
+ void findAllSince(Aggregate *node);
public:
/*******************************************************************
@@ -289,7 +291,7 @@ class QDocDatabase
Many of these will be either eliminated or replaced.
********************************************************************/
void resolveInheritance() { primaryTree()->resolveInheritance(); }
- void resolveQmlInheritance(InnerNode* root);
+ void resolveQmlInheritance(Aggregate* root);
void resolveIssues();
void resolveStuff();
void fixInheritance() { primaryTree()->fixInheritance(); }
@@ -297,7 +299,7 @@ class QDocDatabase
void insertTarget(const QString& name,
const QString& title,
- TargetRec::Type type,
+ TargetRec::TargetType type,
Node* node,
int priority) {
primaryTree()->insertTarget(name, title, type, node, priority);
@@ -310,7 +312,7 @@ class QDocDatabase
return primaryTree()->findFunctionNode(parentPath, clone);
}
FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone);
- Node* findNodeInOpenNamespace(QStringList& path, Node::Type type);
+ Node* findNodeInOpenNamespace(QStringList& path, Node::NodeType type);
const Node* checkForCollision(const QString& name) {
return primaryTree()->checkForCollision(name);
}
@@ -327,7 +329,7 @@ class QDocDatabase
********************************************************************/
ClassNode* findClassNode(const QStringList& path) { return forest_.findClassNode(path); }
Node* findNodeForInclude(const QStringList& path) { return forest_.findNodeForInclude(path); }
- InnerNode* findRelatesNode(const QStringList& path) { return forest_.findRelatesNode(path); }
+ Aggregate* findRelatesNode(const QStringList& path) { return forest_.findRelatesNode(path); }
const Node* findFunctionNode(const QString& target, const Node* relative, Node::Genus genus) {
return forest_.findFunctionNode(target, relative, genus);
}
@@ -336,9 +338,12 @@ class QDocDatabase
const DocumentNode* findDocumentNodeByTitle(const QString& title) {
return forest_.findDocumentNodeByTitle(title);
}
- Node* findNodeByNameAndType(const QStringList& path, Node::Type type) {
+ Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) {
return forest_.findNodeByNameAndType(path, type);
}
+ const CollectionNode* getCollectionNode(const QString& name, Node::Genus genus) {
+ return forest_.getCollectionNode(name, genus);
+ }
private:
const Node* findNodeForTarget(QStringList& targetPath,
@@ -414,7 +419,7 @@ class QDocDatabase
Node::Genus genus) {
return forest_.findNode(path, relative, findFlags, genus);
}
- void processForest(void (QDocDatabase::*) (InnerNode*));
+ void processForest(void (QDocDatabase::*) (Aggregate*));
bool isLoaded(const QString& t) { return forest_.isLoaded(t); }
static void initializeDB();
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 8961ff71ad..37194b911c 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -31,7 +31,6 @@
**
****************************************************************************/
-#include "qdom.h"
#include "qxmlstream.h"
#include "qdocindexfiles.h"
#include "qdoctagfiles.h"
@@ -117,72 +116,83 @@ static bool readingRoot = true;
void QDocIndexFiles::readIndexFile(const QString& path)
{
QFile file(path);
- if (file.open(QFile::ReadOnly)) {
- QDomDocument document;
- document.setContent(&file);
- file.close();
-
- QDomElement indexElement = document.documentElement();
-
- // Generate a relative URL between the install dir and the index file
- // when the -installdir command line option is set.
- QString indexUrl;
- if (Config::installDir.isEmpty()) {
- indexUrl = indexElement.attribute("url", QString());
- }
- else {
- // Use a fake directory, since we will copy the output to a sub directory of
- // installDir when using "make install". This is just for a proper relative path.
- //QDir installDir(path.section('/', 0, -3) + "/outputdir");
- QDir installDir(path.section('/', 0, -3) + '/' + Generator::outputSubdir());
- indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
- }
- project_ = indexElement.attribute("project", QString());
+ if (!file.open(QFile::ReadOnly)) {
+ qWarning() << "Could not read index file" << path;
+ return;
+ }
- basesList_.clear();
- relatedList_.clear();
+ QXmlStreamReader reader(&file);
+ reader.setNamespaceProcessing(false);
- readingRoot = true;
- NamespaceNode* root = qdb_->newIndexTree(project_);
-
- // Scan all elements in the XML file, constructing a map that contains
- // base classes for each class found.
- QDomElement child = indexElement.firstChildElement();
- while (!child.isNull()) {
- readIndexSection(child, root, indexUrl);
- child = child.nextSiblingElement();
- readingRoot = true;
- }
+ if (!reader.readNextStartElement())
+ return;
+
+ if (reader.name() != QLatin1String("INDEX"))
+ return;
+
+ QXmlStreamAttributes attrs = reader.attributes();
+
+ // Generate a relative URL between the install dir and the index file
+ // when the -installdir command line option is set.
+ QString indexUrl;
+ if (Config::installDir.isEmpty()) {
+ indexUrl = attrs.value(QLatin1String("url")).toString();
+ }
+ else {
+ // Use a fake directory, since we will copy the output to a sub directory of
+ // installDir when using "make install". This is just for a proper relative path.
+ //QDir installDir(path.section('/', 0, -3) + "/outputdir");
+ QDir installDir(path.section('/', 0, -3) + '/' + Generator::outputSubdir());
+ indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
+ }
+ project_ = attrs.value(QLatin1String("project")).toString();
+
+ basesList_.clear();
+ relatedList_.clear();
- // Now that all the base classes have been found for this index,
- // arrange them into an inheritance hierarchy.
- resolveIndex();
+ NamespaceNode* root = qdb_->newIndexTree(project_);
+
+ // Scan all elements in the XML file, constructing a map that contains
+ // base classes for each class found.
+ while (reader.readNextStartElement()) {
+ readingRoot = true;
+ readIndexSection(reader, root, indexUrl);
}
+
+ // Now that all the base classes have been found for this index,
+ // arrange them into an inheritance hierarchy.
+ resolveIndex();
}
/*!
Read a <section> element from the index file and create the
appropriate node(s).
*/
-void QDocIndexFiles::readIndexSection(const QDomElement& element,
+void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
Node* current,
const QString& indexUrl)
{
- QString name = element.attribute("name");
- QString href = element.attribute("href");
+ QXmlStreamAttributes attributes = reader.attributes();
+ QStringRef elementName = reader.name();
+
+ QString name = attributes.value(QLatin1String("name")).toString();
+ QString href = attributes.value(QLatin1String("href")).toString();
Node* node;
Location location;
- InnerNode* parent = 0;
- if (current->isInnerNode())
- parent = static_cast<InnerNode*>(current);
+ Aggregate* parent = 0;
+
+ bool hasReadChildren = false;
+
+ if (current->isAggregate())
+ parent = static_cast<Aggregate*>(current);
QString filePath;
int lineNo = 0;
- if (element.hasAttribute("filepath")) {
- filePath = element.attribute("filepath", QString());
- lineNo = element.attribute("lineno", QString()).toInt();
+ if (attributes.hasAttribute(QLatin1String("filepath"))) {
+ filePath = attributes.value(QLatin1String("filepath")).toString();
+ lineNo = attributes.value("lineno").toInt();
}
- if (element.nodeName() == "namespace") {
+ if (elementName == QLatin1String("namespace")) {
node = new NamespaceNode(parent, name);
if (!indexUrl.isEmpty())
@@ -191,10 +201,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(name.toLower() + ".html");
}
- else if (element.nodeName() == "class") {
+ else if (elementName == QLatin1String("class")) {
node = new ClassNode(parent, name);
- if (element.hasAttribute("bases")) {
- QString bases = element.attribute("bases");
+ if (attributes.hasAttribute(QLatin1String("bases"))) {
+ QString bases = attributes.value(QLatin1String("bases")).toString();
if (!bases.isEmpty())
basesList_.append(QPair<ClassNode*,QString>(static_cast<ClassNode*>(node), bases));
}
@@ -203,108 +213,108 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
else if (!indexUrl.isNull())
location = Location(name.toLower() + ".html");
bool abstract = false;
- if (element.attribute("abstract") == "true")
+ if (attributes.value(QLatin1String("abstract")) == QLatin1String("true"))
abstract = true;
node->setAbstract(abstract);
}
- else if (element.nodeName() == "qmlclass") {
+ else if (elementName == QLatin1String("qmlclass")) {
QmlTypeNode* qcn = new QmlTypeNode(parent, name);
- qcn->setTitle(element.attribute("title"));
- QString logicalModuleName = element.attribute("qml-module-name");
+ qcn->setTitle(attributes.value(QLatin1String("title")).toString());
+ QString logicalModuleName = attributes.value(QLatin1String("qml-module-name")).toString();
if (!logicalModuleName.isEmpty())
qdb_->addToQmlModule(logicalModuleName, qcn);
bool abstract = false;
- if (element.attribute("abstract") == "true")
+ if (attributes.value(QLatin1String("abstract")) == QLatin1String("true"))
abstract = true;
qcn->setAbstract(abstract);
- QString qmlFullBaseName = element.attribute("qml-base-type");
+ QString qmlFullBaseName = attributes.value(QLatin1String("qml-base-type")).toString();
if (!qmlFullBaseName.isEmpty()) {
qcn->setQmlBaseName(qmlFullBaseName);
}
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qcn;
}
- else if (element.nodeName() == "jstype") {
+ else if (elementName == QLatin1String("jstype")) {
QmlTypeNode* qcn = new QmlTypeNode(parent, name);
qcn->setGenus(Node::JS);
- qcn->setTitle(element.attribute("title"));
- QString logicalModuleName = element.attribute("js-module-name");
+ qcn->setTitle(attributes.value(QLatin1String("title")).toString());
+ QString logicalModuleName = attributes.value(QLatin1String("js-module-name")).toString();
if (!logicalModuleName.isEmpty())
qdb_->addToQmlModule(logicalModuleName, qcn);
bool abstract = false;
- if (element.attribute("abstract") == "true")
+ if (attributes.value(QLatin1String("abstract")) == QLatin1String("true"))
abstract = true;
qcn->setAbstract(abstract);
- QString qmlFullBaseName = element.attribute("js-base-type");
+ QString qmlFullBaseName = attributes.value(QLatin1String("js-base-type")).toString();
if (!qmlFullBaseName.isEmpty()) {
qcn->setQmlBaseName(qmlFullBaseName);
}
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qcn;
}
- else if (element.nodeName() == "qmlbasictype") {
+ else if (elementName == QLatin1String("qmlbasictype")) {
QmlBasicTypeNode* qbtn = new QmlBasicTypeNode(parent, name);
- qbtn->setTitle(element.attribute("title"));
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ qbtn->setTitle(attributes.value(QLatin1String("title")).toString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qbtn;
}
- else if (element.nodeName() == "jsbasictype") {
+ else if (elementName == QLatin1String("jsbasictype")) {
QmlBasicTypeNode* qbtn = new QmlBasicTypeNode(parent, name);
qbtn->setGenus(Node::JS);
- qbtn->setTitle(element.attribute("title"));
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ qbtn->setTitle(attributes.value(QLatin1String("title")).toString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qbtn;
}
- else if (element.nodeName() == "qmlpropertygroup") {
+ else if (elementName == QLatin1String("qmlpropertygroup")) {
QmlTypeNode* qcn = static_cast<QmlTypeNode*>(parent);
QmlPropertyGroupNode* qpgn = new QmlPropertyGroupNode(qcn, name);
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qpgn;
}
- else if (element.nodeName() == "jspropertygroup") {
+ else if (elementName == QLatin1String("jspropertygroup")) {
QmlTypeNode* qcn = static_cast<QmlTypeNode*>(parent);
QmlPropertyGroupNode* qpgn = new QmlPropertyGroupNode(qcn, name);
qpgn->setGenus(Node::JS);
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value("location").toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
else if (!indexUrl.isNull())
location = Location(name);
node = qpgn;
}
- else if (element.nodeName() == "qmlproperty") {
- QString type = element.attribute("type");
+ else if (elementName == QLatin1String("qmlproperty")) {
+ QString type = attributes.value(QLatin1String("type")).toString();
bool attached = false;
- if (element.attribute("attached") == "true")
+ if (attributes.value(QLatin1String("attached")) == QLatin1String("true"))
attached = true;
bool readonly = false;
- if (element.attribute("writable") == "false")
+ if (attributes.value(QLatin1String("writable")) == QLatin1String("false"))
readonly = true;
QmlPropertyNode* qpn = 0;
if (parent->isQmlType()) {
@@ -318,13 +328,13 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
qpn->setReadOnly(readonly);
node = qpn;
}
- else if (element.nodeName() == "jsproperty") {
- QString type = element.attribute("type");
+ else if (elementName == QLatin1String("jsproperty")) {
+ QString type = attributes.value(QLatin1String("type")).toString();
bool attached = false;
- if (element.attribute("attached") == "true")
+ if (attributes.value(QLatin1String("attached")) == QLatin1String("true"))
attached = true;
bool readonly = false;
- if (element.attribute("writable") == "false")
+ if (attributes.value(QLatin1String("writable")) == QLatin1String("false"))
readonly = true;
QmlPropertyNode* qpn = 0;
if (parent->isJsType()) {
@@ -339,103 +349,103 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
qpn->setReadOnly(readonly);
node = qpn;
}
- else if ((element.nodeName() == "qmlmethod") ||
- (element.nodeName() == "qmlsignal") ||
- (element.nodeName() == "qmlsignalhandler")) {
- Node::Type t = Node::QmlMethod;
- if (element.nodeName() == "qmlsignal")
+ else if ((elementName == QLatin1String("qmlmethod")) ||
+ (elementName == QLatin1String("qmlsignal")) ||
+ (elementName == QLatin1String("qmlsignalhandler"))) {
+ Node::NodeType t = Node::QmlMethod;
+ if (elementName == QLatin1String("qmlsignal"))
t = Node::QmlSignal;
- else if (element.nodeName() == "qmlsignalhandler")
+ else if (elementName == QLatin1String("qmlsignalhandler"))
t = Node::QmlSignalHandler;
bool attached = false;
FunctionNode* fn = new FunctionNode(t, parent, name, attached);
node = fn;
}
- else if ((element.nodeName() == "jsmethod") ||
- (element.nodeName() == "jssignal") ||
- (element.nodeName() == "jssignalhandler")) {
- Node::Type t = Node::QmlMethod;
- if (element.nodeName() == "jssignal")
+ else if ((elementName == QLatin1String("jsmethod")) ||
+ (elementName == QLatin1String("jssignal")) ||
+ (elementName == QLatin1String("jssignalhandler"))) {
+ Node::NodeType t = Node::QmlMethod;
+ if (elementName == QLatin1String("jssignal"))
t = Node::QmlSignal;
- else if (element.nodeName() == "jssignalhandler")
+ else if (elementName == QLatin1String("jssignalhandler"))
t = Node::QmlSignalHandler;
bool attached = false;
FunctionNode* fn = new FunctionNode(t, parent, name, attached);
fn->setGenus(Node::JS);
node = fn;
}
- else if (element.nodeName() == "group") {
+ else if (elementName == QLatin1String("group")) {
CollectionNode* cn = qdb_->addGroup(name);
- cn->setTitle(element.attribute("title"));
- cn->setSubTitle(element.attribute("subtitle"));
- if (element.attribute("seen") == "true")
+ cn->setTitle(attributes.value(QLatin1String("title")).toString());
+ cn->setSubTitle(attributes.value(QLatin1String("subtitle")).toString());
+ if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
cn->markSeen();
node = cn;
}
- else if (element.nodeName() == "module") {
+ else if (elementName == QLatin1String("module")) {
CollectionNode* cn = qdb_->addModule(name);
- cn->setTitle(element.attribute("title"));
- cn->setSubTitle(element.attribute("subtitle"));
- if (element.attribute("seen") == "true")
+ cn->setTitle(attributes.value(QLatin1String("title")).toString());
+ cn->setSubTitle(attributes.value(QLatin1String("subtitle")).toString());
+ if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
cn->markSeen();
node = cn;
}
- else if (element.nodeName() == "qmlmodule") {
- QString t = element.attribute("qml-module-name");
+ else if (elementName == QLatin1String("qmlmodule")) {
+ QString t = attributes.value(QLatin1String("qml-module-name")).toString();
CollectionNode* cn = qdb_->addQmlModule(t);
QStringList info;
- info << t << element.attribute("qml-module-version");
+ info << t << attributes.value(QLatin1String("qml-module-version")).toString();
cn->setLogicalModuleInfo(info);
- cn->setTitle(element.attribute("title"));
- cn->setSubTitle(element.attribute("subtitle"));
- if (element.attribute("seen") == "true")
+ cn->setTitle(attributes.value(QLatin1String("title")).toString());
+ cn->setSubTitle(attributes.value(QLatin1String("subtitle")).toString());
+ if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
cn->markSeen();
node = cn;
}
- else if (element.nodeName() == "jsmodule") {
- QString t = element.attribute("js-module-name");
+ else if (elementName == QLatin1String("jsmodule")) {
+ QString t = attributes.value(QLatin1String("js-module-name")).toString();
CollectionNode* cn = qdb_->addJsModule(t);
QStringList info;
- info << t << element.attribute("js-module-version");
+ info << t << attributes.value(QLatin1String("js-module-version")).toString();
cn->setLogicalModuleInfo(info);
- cn->setTitle(element.attribute("title"));
- cn->setSubTitle(element.attribute("subtitle"));
- if (element.attribute("seen") == "true")
+ cn->setTitle(attributes.value(QLatin1String("title")).toString());
+ cn->setSubTitle(attributes.value(QLatin1String("subtitle")).toString());
+ if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
cn->markSeen();
node = cn;
}
- else if (element.nodeName() == "page") {
- Node::SubType subtype;
+ else if (elementName == QLatin1String("page")) {
+ Node::DocSubtype subtype;
Node::PageType ptype = Node::NoPageType;
- QString attr = element.attribute("subtype");
- if (attr == "example") {
+ QString attr = attributes.value(QLatin1String("subtype")).toString();
+ if (attr == QLatin1String("example")) {
subtype = Node::Example;
ptype = Node::ExamplePage;
}
- else if (attr == "header") {
+ else if (attr == QLatin1String("header")) {
subtype = Node::HeaderFile;
ptype = Node::ApiPage;
}
- else if (attr == "file") {
+ else if (attr == QLatin1String("file")) {
subtype = Node::File;
ptype = Node::NoPageType;
}
- else if (attr == "page") {
+ else if (attr == QLatin1String("page")) {
subtype = Node::Page;
ptype = Node::ArticlePage;
}
- else if (attr == "externalpage") {
+ else if (attr == QLatin1String("externalpage")) {
subtype = Node::ExternalPage;
ptype = Node::ArticlePage;
}
else
- return;
+ goto done;
DocumentNode* docNode = new DocumentNode(parent, name, subtype, ptype);
- docNode->setTitle(element.attribute("title"));
+ docNode->setTitle(attributes.value(QLatin1String("title")).toString());
- if (element.hasAttribute("location"))
- name = element.attribute("location", QString());
+ if (attributes.hasAttribute(QLatin1String("location")))
+ name = attributes.value(QLatin1String("location")).toString();
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name);
@@ -445,7 +455,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
node = docNode;
}
- else if (element.nodeName() == "enum") {
+ else if (elementName == QLatin1String("enum")) {
EnumNode* enumNode = new EnumNode(parent, name);
if (!indexUrl.isEmpty())
@@ -453,17 +463,20 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
else if (!indexUrl.isNull())
location = Location(parent->name().toLower() + ".html");
- QDomElement child = element.firstChildElement("value");
- while (!child.isNull()) {
- EnumItem item(child.attribute("name"), child.attribute("value"));
- enumNode->addItem(item);
- child = child.nextSiblingElement("value");
+ while (reader.readNextStartElement()) {
+ if (reader.name() == QLatin1String("value")) {
+ QXmlStreamAttributes childAttributes = reader.attributes();
+ EnumItem item(childAttributes.value(QLatin1String("name")).toString(), childAttributes.value(QLatin1String("value")).toString());
+ enumNode->addItem(item);
+ }
+ reader.skipCurrentElement();
}
node = enumNode;
+ hasReadChildren = true;
}
- else if (element.nodeName() == "typedef") {
+ else if (elementName == QLatin1String("typedef")) {
node = new TypedefNode(parent, name);
if (!indexUrl.isEmpty())
@@ -472,7 +485,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(parent->name().toLower() + ".html");
}
- else if (element.nodeName() == "property") {
+ else if (elementName == QLatin1String("property")) {
node = new PropertyNode(parent, name);
if (!indexUrl.isEmpty())
@@ -481,68 +494,76 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(parent->name().toLower() + ".html");
}
- else if (element.nodeName() == "function") {
+ else if (elementName == QLatin1String("function")) {
FunctionNode::Virtualness virt;
- QString t = element.attribute("virtual");
- if (t == "non")
+ QString t = attributes.value(QLatin1String("virtual")).toString();
+ if (t == QLatin1String("non"))
virt = FunctionNode::NonVirtual;
- else if (t == "impure")
- virt = FunctionNode::ImpureVirtual;
- else if (t == "pure")
+ else if (t == QLatin1String("virtual"))
+ virt = FunctionNode::NormalVirtual;
+ else if (t == QLatin1String("pure"))
virt = FunctionNode::PureVirtual;
else
- return;
+ goto done;
- t = element.attribute("meta");
+ t = attributes.value(QLatin1String("meta")).toString();
FunctionNode::Metaness meta;
- if (t == "plain")
+ if (t == QLatin1String("plain"))
meta = FunctionNode::Plain;
- else if (t == "signal")
+ else if (t == QLatin1String("signal"))
meta = FunctionNode::Signal;
- else if (t == "slot")
+ else if (t == QLatin1String("slot"))
meta = FunctionNode::Slot;
- else if (t == "constructor")
+ else if (t == QLatin1String("constructor"))
meta = FunctionNode::Ctor;
- else if (t == "destructor")
+ else if (t == QLatin1String("destructor"))
meta = FunctionNode::Dtor;
- else if (t == "macro")
+ else if (t == QLatin1String("macro"))
meta = FunctionNode::MacroWithParams;
- else if (t == "macrowithparams")
+ else if (t == QLatin1String("macrowithparams"))
meta = FunctionNode::MacroWithParams;
- else if (t == "macrowithoutparams")
+ else if (t == QLatin1String("macrowithoutparams"))
meta = FunctionNode::MacroWithoutParams;
else
- return;
+ goto done;
FunctionNode* functionNode = new FunctionNode(parent, name);
- functionNode->setReturnType(element.attribute("return"));
+ functionNode->setReturnType(attributes.value(QLatin1String("return")).toString());
functionNode->setVirtualness(virt);
functionNode->setMetaness(meta);
- functionNode->setConst(element.attribute("const") == "true");
- functionNode->setStatic(element.attribute("static") == "true");
- functionNode->setOverload(element.attribute("overload") == "true");
-
- if (element.hasAttribute("relates")
- && element.attribute("relates") != parent->name()) {
+ functionNode->setConst(attributes.value(QLatin1String("const")) == QLatin1String("true"));
+ functionNode->setStatic(attributes.value(QLatin1String("static")) == QLatin1String("true"));
+ if (attributes.value(QLatin1String("overload")) == QLatin1String("true")) {
+ functionNode->setOverloadFlag(true);
+ functionNode->setOverloadNumber(attributes.value(QLatin1String("overload-number")).toUInt());
+ }
+ else {
+ functionNode->setOverloadFlag(false);
+ functionNode->setOverloadNumber(0);
+ }
+ if (attributes.hasAttribute(QLatin1String("relates"))
+ && attributes.value(QLatin1String("relates")) != parent->name()) {
relatedList_.append(
QPair<FunctionNode*,QString>(functionNode,
- element.attribute("relates")));
+ attributes.value(QLatin1String("relates")).toString()));
}
/*
Note: The "signature" attribute was written to the
index file, but it is not read back in. Is that ok?
*/
- QDomElement child = element.firstChildElement("parameter");
- while (!child.isNull()) {
- // Do not use the default value for the parameter; it is not
- // required, and has been known to cause problems.
- Parameter parameter(child.attribute("left"),
- child.attribute("right"),
- child.attribute("name"),
- QString()); // child.attribute("default")
- functionNode->addParameter(parameter);
- child = child.nextSiblingElement("parameter");
+ while (reader.readNextStartElement()) {
+ if (reader.name() == QLatin1String("parameter")) {
+ QXmlStreamAttributes childAttributes = reader.attributes();
+ // Do not use the default value for the parameter; it is not
+ // required, and has been known to cause problems.
+ Parameter parameter(childAttributes.value(QLatin1String("left")).toString(),
+ childAttributes.value(QLatin1String("right")).toString(),
+ childAttributes.value(QLatin1String("name")).toString(),
+ QString()); // childAttributes.value(QLatin1String("default"))
+ functionNode->addParameter(parameter);
+ }
+ reader.skipCurrentElement();
}
node = functionNode;
@@ -550,125 +571,134 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
else if (!indexUrl.isNull())
location = Location(parent->name().toLower() + ".html");
+
+ hasReadChildren = true;
}
- else if (element.nodeName() == "variable") {
+ else if (elementName == QLatin1String("variable")) {
node = new VariableNode(parent, name);
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
else if (!indexUrl.isNull())
location = Location(parent->name().toLower() + ".html");
}
- else if (element.nodeName() == "keyword") {
- QString title = element.attribute("title");
+ else if (elementName == QLatin1String("keyword")) {
+ QString title = attributes.value(QLatin1String("title")).toString();
qdb_->insertTarget(name, title, TargetRec::Keyword, current, 1);
- return;
+ goto done;
}
- else if (element.nodeName() == "target") {
- QString title = element.attribute("title");
+ else if (elementName == QLatin1String("target")) {
+ QString title = attributes.value(QLatin1String("title")).toString();
qdb_->insertTarget(name, title, TargetRec::Target, current, 2);
- return;
+ goto done;
}
- else if (element.nodeName() == "contents") {
- QString title = element.attribute("title");
+ else if (elementName == QLatin1String("contents")) {
+ QString title = attributes.value(QLatin1String("title")).toString();
qdb_->insertTarget(name, title, TargetRec::Contents, current, 3);
- return;
+ goto done;
}
else
- return;
-
- QString access = element.attribute("access");
- if (access == "public")
- node->setAccess(Node::Public);
- else if (access == "protected")
- node->setAccess(Node::Protected);
- else if ((access == "private") || (access == "internal"))
- node->setAccess(Node::Private);
- else
- node->setAccess(Node::Public);
-
- if ((element.nodeName() != "page") &&
- (element.nodeName() != "qmlclass") &&
- (element.nodeName() != "qmlbasictype") &&
- (element.nodeName() != "jstype") &&
- (element.nodeName() != "jsbasictype")) {
- QString threadSafety = element.attribute("threadsafety");
- if (threadSafety == "non-reentrant")
- node->setThreadSafeness(Node::NonReentrant);
- else if (threadSafety == "reentrant")
- node->setThreadSafeness(Node::Reentrant);
- else if (threadSafety == "thread safe")
- node->setThreadSafeness(Node::ThreadSafe);
+ goto done;
+
+ {
+ QString access = attributes.value(QLatin1String("access")).toString();
+ if (access == "public")
+ node->setAccess(Node::Public);
+ else if (access == "protected")
+ node->setAccess(Node::Protected);
+ else if ((access == "private") || (access == "internal"))
+ node->setAccess(Node::Private);
+ else
+ node->setAccess(Node::Public);
+
+ if ((elementName != QLatin1String("page")) &&
+ (elementName != QLatin1String("qmlclass")) &&
+ (elementName != QLatin1String("qmlbasictype")) &&
+ (elementName != QLatin1String("jstype")) &&
+ (elementName != QLatin1String("jsbasictype"))) {
+ QString threadSafety = attributes.value(QLatin1String("threadsafety")).toString();
+ if (threadSafety == QLatin1String("non-reentrant"))
+ node->setThreadSafeness(Node::NonReentrant);
+ else if (threadSafety == QLatin1String("reentrant"))
+ node->setThreadSafeness(Node::Reentrant);
+ else if (threadSafety == QLatin1String("thread safe"))
+ node->setThreadSafeness(Node::ThreadSafe);
+ else
+ node->setThreadSafeness(Node::UnspecifiedSafeness);
+ }
else
node->setThreadSafeness(Node::UnspecifiedSafeness);
- }
- else
- node->setThreadSafeness(Node::UnspecifiedSafeness);
-
- QString status = element.attribute("status");
- if (status == "compat")
- node->setStatus(Node::Compat);
- else if (status == "obsolete")
- node->setStatus(Node::Obsolete);
- else if (status == "deprecated")
- node->setStatus(Node::Obsolete);
- else if (status == "preliminary")
- node->setStatus(Node::Preliminary);
- else if (status == "commendable")
- node->setStatus(Node::Commendable);
- else if (status == "internal")
- node->setStatus(Node::Internal);
- else
- node->setStatus(Node::Commendable);
-
- QString physicalModuleName = element.attribute("module");
- if (!physicalModuleName.isEmpty())
- qdb_->addToModule(physicalModuleName, node);
- if (!href.isEmpty()) {
- if (node->isExternalPage())
- node->setUrl(href);
- else if (!indexUrl.isEmpty())
- node->setUrl(indexUrl + QLatin1Char('/') + href);
- }
- QString since = element.attribute("since");
- if (!since.isEmpty()) {
- node->setSince(since);
- }
+ QString status = attributes.value(QLatin1String("status")).toString();
+ if (status == QLatin1String("compat"))
+ node->setStatus(Node::Compat);
+ else if (status == QLatin1String("obsolete"))
+ node->setStatus(Node::Obsolete);
+ else if (status == QLatin1String("deprecated"))
+ node->setStatus(Node::Obsolete);
+ else if (status == QLatin1String("preliminary"))
+ node->setStatus(Node::Preliminary);
+ else if (status == QLatin1String("active"))
+ node->setStatus(Node::Active);
+ else if (status == QLatin1String("internal"))
+ node->setStatus(Node::Internal);
+ else
+ node->setStatus(Node::Active);
+
+ QString physicalModuleName = attributes.value(QLatin1String("module")).toString();
+ if (!physicalModuleName.isEmpty())
+ qdb_->addToModule(physicalModuleName, node);
+ if (!href.isEmpty()) {
+ if (node->isExternalPage())
+ node->setUrl(href);
+ else if (!indexUrl.isEmpty())
+ node->setUrl(indexUrl + QLatin1Char('/') + href);
+ }
- QString groupsAttr = element.attribute("groups");
- if (!groupsAttr.isEmpty()) {
- QStringList groupNames = groupsAttr.split(",");
- foreach (const QString &name, groupNames) {
- qdb_->addToGroup(name, node);
+ QString since = attributes.value(QLatin1String("since")).toString();
+ if (!since.isEmpty()) {
+ node->setSince(since);
}
- }
- // Create some content for the node.
- QSet<QString> emptySet;
- Location t(filePath);
- if (!filePath.isEmpty()) {
- t.setLineNo(lineNo);
- node->setLocation(t);
- location = t;
- }
- Doc doc(location, location, " ", emptySet, emptySet); // placeholder
- node->setDoc(doc);
- node->setIndexNodeFlag();
- node->setOutputSubdirectory(project_.toLower());
- QString briefAttr = element.attribute("brief");
- if (!briefAttr.isEmpty()) {
- node->setReconstitutedBrief(briefAttr);
+ QString groupsAttr = attributes.value(QLatin1String("groups")).toString();
+ if (!groupsAttr.isEmpty()) {
+ QStringList groupNames = groupsAttr.split(",");
+ foreach (const QString &name, groupNames) {
+ qdb_->addToGroup(name, node);
+ }
+ }
+
+ // Create some content for the node.
+ QSet<QString> emptySet;
+ Location t(filePath);
+ if (!filePath.isEmpty()) {
+ t.setLineNo(lineNo);
+ node->setLocation(t);
+ location = t;
+ }
+ Doc doc(location, location, " ", emptySet, emptySet); // placeholder
+ node->setDoc(doc);
+ node->setIndexNodeFlag();
+ node->setOutputSubdirectory(project_.toLower());
+ QString briefAttr = attributes.value(QLatin1String("brief")).toString();
+ if (!briefAttr.isEmpty()) {
+ node->setReconstitutedBrief(briefAttr);
+ }
+
+ if (!hasReadChildren) {
+ bool useParent = (elementName == QLatin1String("namespace") && name.isEmpty());
+ while (reader.readNextStartElement()) {
+ if (useParent)
+ readIndexSection(reader, parent, indexUrl);
+ else
+ readIndexSection(reader, node, indexUrl);
+ }
+ }
}
- bool useParent = (element.nodeName() == "namespace" && name.isEmpty());
- if (element.hasChildNodes()) {
- QDomElement child = element.firstChildElement();
- while (!child.isNull()) {
- if (useParent)
- readIndexSection(child, parent, indexUrl);
- else
- readIndexSection(child, node, indexUrl);
- child = child.nextSiblingElement();
+ done:
+ while (!reader.isEndElement()) {
+ if (reader.readNext() == QXmlStreamReader::Invalid) {
+ break;
}
}
}
@@ -726,7 +756,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
/*
Don't include index nodes in a new index file. Or DITA map nodes.
*/
- if (node->isIndexNode() || node->subType() == Node::DitaMap)
+ if (node->isIndexNode() || node->docSubtype() == Node::DitaMap)
return false;
QString nodeName;
@@ -885,8 +915,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
case Node::Preliminary:
status = "preliminary";
break;
- case Node::Commendable:
- status = "commendable";
+ case Node::Active:
+ status = "active";
break;
case Node::Internal:
status = "internal";
@@ -937,7 +967,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
else
href = node->name();
if (node->isQmlNode() || node->isJsNode()) {
- InnerNode* p = node->parent();
+ Aggregate* p = node->parent();
if (p) {
if (p->isQmlPropertyGroup() || p->isJsPropertyGroup())
p = p->parent();
@@ -954,11 +984,12 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (node->isAbstract())
writer.writeAttribute("abstract", "true");
}
- if (!node->location().fileName().isEmpty())
- writer.writeAttribute("location", node->location().fileName());
- if (!node->location().filePath().isEmpty()) {
- writer.writeAttribute("filepath", node->location().filePath());
- writer.writeAttribute("lineno", QString("%1").arg(node->location().lineNo()));
+ const Location& declLocation = node->declLocation();
+ if (!declLocation.fileName().isEmpty())
+ writer.writeAttribute("location", declLocation.fileName());
+ if (!declLocation.filePath().isEmpty()) {
+ writer.writeAttribute("filepath", declLocation.filePath());
+ writer.writeAttribute("lineno", QString("%1").arg(declLocation.lineNo()));
}
if (!node->since().isEmpty()) {
@@ -1019,7 +1050,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
*/
bool writeModuleName = false;
const DocumentNode* docNode = static_cast<const DocumentNode*>(node);
- switch (docNode->subType()) {
+ switch (docNode->docSubtype()) {
case Node::Example:
writer.writeAttribute("subtype", "example");
writeModuleName = true;
@@ -1139,8 +1170,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
case FunctionNode::NonVirtual:
writer.writeAttribute("virtual", "non");
break;
- case FunctionNode::ImpureVirtual:
- writer.writeAttribute("virtual", "impure");
+ case FunctionNode::NormalVirtual:
+ writer.writeAttribute("virtual", "virtual");
break;
case FunctionNode::PureVirtual:
writer.writeAttribute("virtual", "pure");
@@ -1182,9 +1213,15 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (functionNode->relates()) {
writer.writeAttribute("relates", functionNode->relates()->name());
}
- const PropertyNode* propertyNode = functionNode->associatedProperty();
- if (propertyNode)
- writer.writeAttribute("associated-property", propertyNode->name());
+ if (functionNode->hasAssociatedProperties()) {
+ QString associatedProperties;
+ foreach (PropertyNode* pn, functionNode->associatedProperties()) {
+ if (!associatedProperties.isEmpty())
+ associatedProperties += QLatin1String(", ");
+ associatedProperties += pn->name();
+ }
+ writer.writeAttribute("associated-property", associatedProperties);
+ }
writer.writeAttribute("type", functionNode->returnType());
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
@@ -1316,7 +1353,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
bool external = false;
if (node->type() == Node::Document) {
const DocumentNode* docNode = static_cast<const DocumentNode*>(node);
- if (docNode->subType() == Node::ExternalPage)
+ if (docNode->docSubtype() == Node::ExternalPage)
external = true;
}
foreach (const Atom* target, node->doc().targets()) {
@@ -1349,8 +1386,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
// opening tag, create child elements, then add a closing tag for the
// element. Elements for all other nodes are closed in the opening tag.
- if (node->isInnerNode()) {
- const InnerNode* inner = static_cast<const InnerNode*>(node);
+ if (node->isAggregate()) {
+ const Aggregate* inner = static_cast<const Aggregate*>(node);
if (inner->doc().hasTableOfContents()) {
for (int i = 0; i < inner->doc().tableOfContents().size(); ++i) {
@@ -1453,8 +1490,8 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter& writer,
return;
if (generateIndexSection(writer, node, generateInternalNodes)) {
- if (node->isInnerNode()) {
- const InnerNode* inner = static_cast<const InnerNode*>(node);
+ if (node->isAggregate()) {
+ const Aggregate* inner = static_cast<const Aggregate*>(node);
NodeList cnodes = inner->childNodes();
std::sort(cnodes.begin(), cnodes.end(), compareNodes);
diff --git a/src/tools/qdoc/qdocindexfiles.h b/src/tools/qdoc/qdocindexfiles.h
index 9a18639251..1b9b6afc40 100644
--- a/src/tools/qdoc/qdocindexfiles.h
+++ b/src/tools/qdoc/qdocindexfiles.h
@@ -42,7 +42,6 @@ class Atom;
class Generator;
class QStringList;
class QDocDatabase;
-class QDomElement;
class QXmlStreamWriter;
class QDocIndexFiles
@@ -64,7 +63,7 @@ class QDocIndexFiles
bool generateInternalNodes = false);
void readIndexFile(const QString& path);
- void readIndexSection(const QDomElement& element, Node* current, const QString& indexUrl);
+ void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl);
void resolveIndex();
bool generateIndexSection(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false);
void generateIndexSections(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false);
@@ -74,8 +73,8 @@ class QDocIndexFiles
QDocDatabase* qdb_;
Generator* gen_;
QString project_;
- QList<QPair<ClassNode*,QString> > basesList_;
- QList<QPair<FunctionNode*,QString> > relatedList_;
+ QVector<QPair<ClassNode*,QString> > basesList_;
+ QVector<QPair<FunctionNode*,QString> > relatedList_;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/qdoctagfiles.cpp b/src/tools/qdoc/qdoctagfiles.cpp
index 778df33048..1210ac7c36 100644
--- a/src/tools/qdoc/qdoctagfiles.cpp
+++ b/src/tools/qdoc/qdoctagfiles.cpp
@@ -35,7 +35,6 @@
#include "qdoctagfiles.h"
#include "qdocdatabase.h"
-#include "qdom.h"
#include "atom.h"
#include "doc.h"
#include "htmlgenerator.h"
@@ -100,7 +99,7 @@ void QDocTagFiles::destroyQDocTagFiles()
specified, returning true if an element was written; otherwise returns
false.
*/
-void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter& writer, const InnerNode* inner)
+void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter& writer, const Aggregate* inner)
{
foreach (const Node* node, inner->childNodes()) {
if (!node->url().isEmpty())
@@ -161,22 +160,22 @@ void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter& writer, const Inne
}
// Recurse to write all members.
- generateTagFileMembers(writer, static_cast<const InnerNode*>(node));
+ generateTagFileMembers(writer, static_cast<const Aggregate*>(node));
writer.writeEndElement();
// Recurse to write all compounds.
- generateTagFileCompounds(writer, static_cast<const InnerNode*>(node));
+ generateTagFileCompounds(writer, static_cast<const Aggregate*>(node));
}
else {
writer.writeTextElement("name", node->fullDocumentName());
writer.writeTextElement("filename", gen_->fullDocumentLocation(node, false));
// Recurse to write all members.
- generateTagFileMembers(writer, static_cast<const InnerNode*>(node));
+ generateTagFileMembers(writer, static_cast<const Aggregate*>(node));
writer.writeEndElement();
// Recurse to write all compounds.
- generateTagFileCompounds(writer, static_cast<const InnerNode*>(node));
+ generateTagFileCompounds(writer, static_cast<const Aggregate*>(node));
}
}
}
@@ -185,7 +184,7 @@ void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter& writer, const Inne
Writes all the members of the \a inner node with the \a writer.
The node represents a C++ class, namespace, etc.
*/
-void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const InnerNode* inner)
+void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const Aggregate* inner)
{
foreach (const Node* node, inner->childNodes()) {
if (!node->url().isEmpty())
@@ -268,7 +267,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const InnerN
case FunctionNode::NonVirtual:
writer.writeAttribute("virtualness", "non");
break;
- case FunctionNode::ImpureVirtual:
+ case FunctionNode::NormalVirtual:
writer.writeAttribute("virtualness", "virtual");
break;
case FunctionNode::PureVirtual:
diff --git a/src/tools/qdoc/qdoctagfiles.h b/src/tools/qdoc/qdoctagfiles.h
index 94d3450478..ad1d383bfd 100644
--- a/src/tools/qdoc/qdoctagfiles.h
+++ b/src/tools/qdoc/qdoctagfiles.h
@@ -38,7 +38,7 @@
QT_BEGIN_NAMESPACE
-class InnerNode;
+class Aggregate;
class QDocDatabase;
class Generator;
@@ -53,8 +53,8 @@ class QDocTagFiles
QDocTagFiles();
~QDocTagFiles();
- void generateTagFileCompounds(QXmlStreamWriter& writer, const InnerNode* inner);
- void generateTagFileMembers(QXmlStreamWriter& writer, const InnerNode* inner);
+ void generateTagFileCompounds(QXmlStreamWriter& writer, const Aggregate* inner);
+ void generateTagFileMembers(QXmlStreamWriter& writer, const Aggregate* inner);
void generateTagFile(const QString& fileName, Generator* g);
private:
diff --git a/src/tools/qdoc/qmlcodemarker.cpp b/src/tools/qdoc/qmlcodemarker.cpp
index 86fc79be66..cfb5e16b44 100644
--- a/src/tools/qdoc/qmlcodemarker.cpp
+++ b/src/tools/qdoc/qmlcodemarker.cpp
@@ -96,7 +96,7 @@ bool QmlCodeMarker::recognizeLanguage(const QString &language)
/*!
Returns the type of atom used to represent QML code in the documentation.
*/
-Atom::Type QmlCodeMarker::atomType() const
+Atom::AtomType QmlCodeMarker::atomType() const
{
return Atom::Qml;
}
@@ -166,7 +166,7 @@ QString QmlCodeMarker::addMarkUp(const QString &code,
QQmlJS::Lexer lexer(&engine);
QString newCode = code;
- QList<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
+ QVector<QQmlJS::AST::SourceLocation> pragmas = extractPragmas(newCode);
lexer.setCode(newCode, 1);
QQmlJS::Parser parser(&engine);
@@ -209,11 +209,11 @@ static void replaceWithSpace(QString &str, int idx, int n)
Searches for ".pragma <value>" or ".import <stuff>" declarations
in \a script. Currently supported pragmas are: library
*/
-QList<QQmlJS::AST::SourceLocation> QmlCodeMarker::extractPragmas(QString &script)
+QVector<QQmlJS::AST::SourceLocation> QmlCodeMarker::extractPragmas(QString &script)
{
const QString pragma(QLatin1String("pragma"));
const QString library(QLatin1String("library"));
- QList<QQmlJS::AST::SourceLocation> removed;
+ QVector<QQmlJS::AST::SourceLocation> removed;
QQmlJS::Lexer l(0);
l.setCode(script, 0);
diff --git a/src/tools/qdoc/qmlcodemarker.h b/src/tools/qdoc/qmlcodemarker.h
index 805229e366..b3ec03965f 100644
--- a/src/tools/qdoc/qmlcodemarker.h
+++ b/src/tools/qdoc/qmlcodemarker.h
@@ -54,7 +54,7 @@ public:
virtual bool recognizeCode(const QString &code) Q_DECL_OVERRIDE;
virtual bool recognizeExtension(const QString &ext) Q_DECL_OVERRIDE;
virtual bool recognizeLanguage(const QString &language) Q_DECL_OVERRIDE;
- virtual Atom::Type atomType() const Q_DECL_OVERRIDE;
+ virtual Atom::AtomType atomType() const Q_DECL_OVERRIDE;
virtual QString markedUpCode(const QString &code,
const Node *relative,
const Location &location) Q_DECL_OVERRIDE;
@@ -66,7 +66,7 @@ public:
virtual QString functionEndRegExp(const QString &funcName) Q_DECL_OVERRIDE;
/* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */
- QList<QQmlJS::AST::SourceLocation> extractPragmas(QString &script);
+ QVector<QQmlJS::AST::SourceLocation> extractPragmas(QString &script);
private:
QString addMarkUp(const QString &code, const Node *relative,
diff --git a/src/tools/qdoc/qmlcodeparser.cpp b/src/tools/qdoc/qmlcodeparser.cpp
index 4f5720a94d..bcc0fedc9a 100644
--- a/src/tools/qdoc/qmlcodeparser.cpp
+++ b/src/tools/qdoc/qmlcodeparser.cpp
@@ -56,7 +56,9 @@ QT_BEGIN_NAMESPACE
#define COMMAND_PRELIMINARY Doc::alias("preliminary")
#define COMMAND_SINCE Doc::alias("since")
#define COMMAND_WRAPPER Doc::alias("wrapper")
+#define COMMAND_NOAUTOLIST Doc::alias("noautolist")
+#define COMMAND_ABSTRACT Doc::alias("abstract")
#define COMMAND_QMLABSTRACT Doc::alias("qmlabstract")
#define COMMAND_QMLCLASS Doc::alias("qmlclass")
#define COMMAND_QMLTYPE Doc::alias("qmltype")
@@ -251,10 +253,12 @@ const QSet<QString>& QmlCodeParser::otherMetaCommands()
<< COMMAND_OBSOLETE
<< COMMAND_PRELIMINARY
<< COMMAND_SINCE
+ << COMMAND_ABSTRACT
<< COMMAND_QMLABSTRACT
<< COMMAND_INQMLMODULE
<< COMMAND_INJSMODULE
- << COMMAND_WRAPPER;
+ << COMMAND_WRAPPER
+ << COMMAND_NOAUTOLIST;
}
return otherMetaCommands_;
}
diff --git a/src/tools/qdoc/qmlmarkupvisitor.cpp b/src/tools/qdoc/qmlmarkupvisitor.cpp
index ee86b6de32..3a7635778e 100644
--- a/src/tools/qdoc/qmlmarkupvisitor.cpp
+++ b/src/tools/qdoc/qmlmarkupvisitor.cpp
@@ -42,7 +42,7 @@
QT_BEGIN_NAMESPACE
QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
- const QList<QQmlJS::AST::SourceLocation> &pragmas,
+ const QVector<QQmlJS::AST::SourceLocation> &pragmas,
QQmlJS::Engine *engine)
{
this->source = source;
@@ -54,21 +54,22 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source,
// Merge the lists of locations of pragmas and comments in the source code.
int i = 0;
int j = 0;
- while (i < engine->comments().length() && j < pragmas.length()) {
- if (engine->comments()[i].offset < pragmas[j].offset) {
+ const QVector<QQmlJS::AST::SourceLocation> comments = engine->comments();
+ while (i < comments.size() && j < pragmas.length()) {
+ if (comments[i].offset < pragmas[j].offset) {
extraTypes.append(Comment);
- extraLocations.append(engine->comments()[i]);
+ extraLocations.append(comments[i]);
++i;
} else {
extraTypes.append(Pragma);
- extraLocations.append(engine->comments()[j]);
+ extraLocations.append(comments[j]);
++j;
}
}
- while (i < engine->comments().length()) {
+ while (i < comments.size()) {
extraTypes.append(Comment);
- extraLocations.append(engine->comments()[i]);
+ extraLocations.append(comments[i]);
++i;
}
diff --git a/src/tools/qdoc/qmlmarkupvisitor.h b/src/tools/qdoc/qmlmarkupvisitor.h
index 04d6a57564..ddd16209ab 100644
--- a/src/tools/qdoc/qmlmarkupvisitor.h
+++ b/src/tools/qdoc/qmlmarkupvisitor.h
@@ -50,7 +50,7 @@ public:
};
QmlMarkupVisitor(const QString &code,
- const QList<QQmlJS::AST::SourceLocation> &pragmas,
+ const QVector<QQmlJS::AST::SourceLocation> &pragmas,
QQmlJS::Engine *engine);
virtual ~QmlMarkupVisitor();
@@ -157,13 +157,14 @@ private:
QString sourceText(QQmlJS::AST::SourceLocation &location);
QQmlJS::Engine *engine;
- QList<ExtraType> extraTypes;
- QList<QQmlJS::AST::SourceLocation> extraLocations;
+ QVector<ExtraType> extraTypes;
+ QVector<QQmlJS::AST::SourceLocation> extraLocations;
QString source;
QString output;
quint32 cursor;
int extraIndex;
};
+Q_DECLARE_TYPEINFO(QmlMarkupVisitor::ExtraType, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
index eae4125ab2..bfaa4401d2 100644
--- a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
@@ -37,6 +37,7 @@
#include "qqmljsglobal_p.h"
#include <QtCore/qglobal.h>
+#include <QtCore/qtypeinfo.h>
//
// W A R N I N G
@@ -53,27 +54,6 @@ QT_QML_BEGIN_NAMESPACE
namespace QQmlJS { namespace AST {
-class SourceLocation
-{
-public:
- explicit SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0)
- : offset(offset), length(length),
- startLine(line), startColumn(column)
- { }
-
- bool isValid() const { return length != 0; }
-
- quint32 begin() const { return offset; }
- quint32 end() const { return offset + length; }
-
-// attributes
- // ### encode
- quint32 offset;
- quint32 length;
- quint32 startLine;
- quint32 startColumn;
-};
-
class Visitor;
class Node;
class ExpressionNode;
@@ -176,8 +156,31 @@ class UiQualifiedId;
class UiQualifiedPragmaId;
class UiHeaderItemList;
+class SourceLocation
+{
+public:
+ explicit SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0)
+ : offset(offset), length(length),
+ startLine(line), startColumn(column)
+ { }
+
+ bool isValid() const { return length != 0; }
+
+ quint32 begin() const { return offset; }
+ quint32 end() const { return offset + length; }
+
+// attributes
+ // ### encode
+ quint32 offset;
+ quint32 length;
+ quint32 startLine;
+ quint32 startColumn;
+};
+
} } // namespace AST
+Q_DECLARE_TYPEINFO(QQmlJS::AST::SourceLocation, Q_PRIMITIVE_TYPE);
+
QT_QML_END_NAMESPACE
#endif
diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp b/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp
index 1c0a70a372..2a949b630c 100644
--- a/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp
@@ -35,7 +35,6 @@
#include "qqmljsglobal_p.h"
#include <QtCore/qnumeric.h>
-#include <QtCore/qhash.h>
#include <QtCore/qdebug.h>
QT_QML_BEGIN_NAMESPACE
@@ -126,7 +125,7 @@ void Engine::setCode(const QString &code)
void Engine::addComment(int pos, int len, int line, int col)
{ if (len > 0) _comments.append(QQmlJS::AST::SourceLocation(pos, len, line, col)); }
-QList<QQmlJS::AST::SourceLocation> Engine::comments() const
+QVector<QQmlJS::AST::SourceLocation> Engine::comments() const
{ return _comments; }
Lexer *Engine::lexer() const
diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.h b/src/tools/qdoc/qmlparser/qqmljsengine_p.h
index fb65d7f028..9ab26f0d0f 100644
--- a/src/tools/qdoc/qmlparser/qqmljsengine_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.h
@@ -50,7 +50,7 @@
#include "qqmljsmemorypool_p.h"
#include <QtCore/qstring.h>
-#include <QtCore/qset.h>
+#include <QtCore/qvector.h>
QT_QML_BEGIN_NAMESPACE
@@ -87,7 +87,7 @@ class QML_PARSER_EXPORT Engine
Lexer *_lexer;
Directives *_directives;
MemoryPool _pool;
- QList<AST::SourceLocation> _comments;
+ QVector<AST::SourceLocation> _comments;
QString _extraCode;
QString _code;
@@ -99,7 +99,7 @@ public:
const QString &code() const { return _code; }
void addComment(int pos, int len, int line, int col);
- QList<AST::SourceLocation> comments() const;
+ QVector<AST::SourceLocation> comments() const;
Lexer *lexer() const;
void setLexer(Lexer *lexer);
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 190c9f0444..6f63624bf0 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -54,7 +54,9 @@ QT_BEGIN_NAMESPACE
#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
#define COMMAND_WRAPPER Doc::alias(QLatin1String("wrapper"))
+#define COMMAND_NOAUTOLIST Doc::alias(QLatin1String("noautolist"))
+#define COMMAND_ABSTRACT Doc::alias(QLatin1String("abstract"))
#define COMMAND_QMLABSTRACT Doc::alias(QLatin1String("qmlabstract"))
#define COMMAND_QMLCLASS Doc::alias(QLatin1String("qmlclass"))
#define COMMAND_QMLTYPE Doc::alias(QLatin1String("qmltype"))
@@ -118,7 +120,7 @@ QmlDocVisitor::~QmlDocVisitor()
*/
QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
- QListIterator<QQmlJS::AST::SourceLocation> it(engine->comments());
+ QVectorIterator<QQmlJS::AST::SourceLocation> it(engine->comments());
it.toBack();
while (it.hasPrevious()) {
@@ -196,18 +198,11 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
const TopicList& topicsUsed = doc.topicsUsed();
NodeList nodes;
Node* nodePassedIn = node;
- InnerNode* parent = nodePassedIn->parent();
+ Aggregate* parent = nodePassedIn->parent();
node->setDoc(doc);
nodes.append(node);
if (topicsUsed.size() > 0) {
for (int i=0; i<topicsUsed.size(); ++i) {
- if ((topicsUsed.at(i).topic == COMMAND_QMLPROPERTYGROUP) ||
- (topicsUsed.at(i).topic == COMMAND_JSPROPERTYGROUP)) {
- qDebug() << "PROPERTY GROUP COMMAND SEEN:" << topicsUsed.at(i).args << filePath_;
- break;
- }
- }
- for (int i=0; i<topicsUsed.size(); ++i) {
QString topic = topicsUsed.at(i).topic;
QString args = topicsUsed.at(i).args;
if ((topic == COMMAND_QMLPROPERTY) || (topic == COMMAND_QMLATTACHEDPROPERTY) ||
@@ -497,7 +492,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
while (i != metacommands.end()) {
QString command = *i;
ArgList args = doc.metaCommandArgs(command);
- if (command == COMMAND_QMLABSTRACT) {
+ if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
if (node->isQmlType() || node->isJsType()) {
node->setAbstract(true);
}
@@ -751,14 +746,14 @@ bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
if (current->isJsType())
qmlMethod->setGenus(Node::JS);
int overloads = 0;
- NodeList::ConstIterator overloadIterator = current->childNodes().constBegin();
- while (overloadIterator != current->childNodes().constEnd()) {
- if ((*overloadIterator)->name() == name)
+ NodeList::ConstIterator i = current->childNodes().constBegin();
+ while (i != current->childNodes().constEnd()) {
+ if ((*i)->name() == name)
overloads++;
- overloadIterator++;
+ i++;
}
if (overloads > 1)
- qmlMethod->setOverload(true);
+ qmlMethod->setOverloadFlag(true);
QList<Parameter> parameters;
QQmlJS::AST::FormalParameterList* formals = fd->formals;
if (formals) {
diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h
index cfb167c985..8c5e8c5042 100644
--- a/src/tools/qdoc/qmlvisitor.h
+++ b/src/tools/qdoc/qmlvisitor.h
@@ -111,7 +111,7 @@ private:
QSet<QString> commands_;
QSet<QString> topics_;
QSet<quint32> usedComments;
- InnerNode *current;
+ Aggregate *current;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/quoter.cpp b/src/tools/qdoc/quoter.cpp
index d8a4df33f3..25cf27f731 100644
--- a/src/tools/qdoc/quoter.cpp
+++ b/src/tools/qdoc/quoter.cpp
@@ -39,6 +39,8 @@
QT_BEGIN_NAMESPACE
+QHash<QString,QString> Quoter::commentHash;
+
static void replaceMultipleNewlines(QString &s)
{
const int n = s.size();
@@ -120,14 +122,16 @@ Quoter::Quoter()
* .html, .qrc, .ui, .xq, .xml .dita files:
<!-- [<id>] -->
*/
- commentHash["pro"] = "#!";
- commentHash["py"] = "#!";
- commentHash["html"] = "<!--";
- commentHash["qrc"] = "<!--";
- commentHash["ui"] = "<!--";
- commentHash["xml"] = "<!--";
- commentHash["dita"] = "<!--";
- commentHash["xq"] = "<!--";
+ if (!commentHash.size()) {
+ commentHash["pro"] = "#!";
+ commentHash["py"] = "#!";
+ commentHash["html"] = "<!--";
+ commentHash["qrc"] = "<!--";
+ commentHash["ui"] = "<!--";
+ commentHash["xml"] = "<!--";
+ commentHash["dita"] = "<!--";
+ commentHash["xq"] = "<!--";
+ }
}
void Quoter::reset()
diff --git a/src/tools/qdoc/quoter.h b/src/tools/qdoc/quoter.h
index 2c3fa3980d..7877eda696 100644
--- a/src/tools/qdoc/quoter.h
+++ b/src/tools/qdoc/quoter.h
@@ -78,7 +78,7 @@ private:
QStringList plainLines;
QStringList markedLines;
Location codeLocation;
- QHash<QString,QString> commentHash;
+ static QHash<QString,QString> commentHash;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/text.cpp b/src/tools/qdoc/text.cpp
index b4eebe4c75..fa105a8344 100644
--- a/src/tools/qdoc/text.cpp
+++ b/src/tools/qdoc/text.cpp
@@ -72,7 +72,7 @@ Text& Text::operator=(const Text& text)
return *this;
}
-Text& Text::operator<<(Atom::Type atomType)
+Text& Text::operator<<(Atom::AtomType atomType)
{
return operator<<(Atom(atomType));
}
@@ -177,7 +177,7 @@ QString Text::toString() const
return str;
}
-Text Text::subText(Atom::Type left, Atom::Type right, const Atom* from, bool inclusive) const
+Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom* from, bool inclusive) const
{
const Atom* begin = from ? from : firstAtom();
const Atom* end;
diff --git a/src/tools/qdoc/text.h b/src/tools/qdoc/text.h
index 7f4eeb3ec2..40ecf3eddc 100644
--- a/src/tools/qdoc/text.h
+++ b/src/tools/qdoc/text.h
@@ -54,7 +54,7 @@ public:
Atom *firstAtom() { return first; }
Atom *lastAtom() { return last; }
- Text& operator<<(Atom::Type atomType);
+ Text& operator<<(Atom::AtomType atomType);
Text& operator<<(const QString& string);
Text& operator<<(const Atom& atom);
Text& operator<<(const LinkAtom& atom);
@@ -66,7 +66,7 @@ public:
QString toString() const;
const Atom *firstAtom() const { return first; }
const Atom *lastAtom() const { return last; }
- Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0, bool inclusive = false) const;
+ Text subText(Atom::AtomType left, Atom::AtomType right, const Atom *from = 0, bool inclusive = false) const;
void dump() const;
void clear();
diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp
index 68c6fb7831..a85c3b00d8 100644
--- a/src/tools/qdoc/tokenizer.cpp
+++ b/src/tools/qdoc/tokenizer.cpp
@@ -186,7 +186,7 @@ int Tokenizer::getToken()
}
else if (strcmp(yyLex, kwords[i - 1]) == 0) {
int ret = (int) Tok_FirstKeyword + i - 1;
- if (ret != Tok_explicit && ret != Tok_inline && ret != Tok_typename)
+ if (ret != Tok_typename)
return ret;
break;
}
diff --git a/src/tools/qdoc/tokenizer.h b/src/tools/qdoc/tokenizer.h
index 2b79320567..41a3ffd931 100644
--- a/src/tools/qdoc/tokenizer.h
+++ b/src/tools/qdoc/tokenizer.h
@@ -107,6 +107,7 @@ public:
int braceDepth() const { return yyBraceDepth; }
int parenDepth() const { return yyParenDepth; }
int bracketDepth() const { return yyBracketDepth; }
+ Location& tokenLocation() { return yyTokLoc; }
static void initialize(const Config &config);
static void terminate();
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp
index 1b0aba1a0c..e0fd68d2e7 100644
--- a/src/tools/qdoc/tree.cpp
+++ b/src/tools/qdoc/tree.cpp
@@ -181,9 +181,9 @@ FunctionNode* Tree::findFunctionNode(const QStringList& parentPath, const Functi
parent = findClassNode(parentPath, 0);
if (parent == 0)
parent = findNode(parentPath, 0, 0, Node::DontCare);
- if (parent == 0 || !parent->isInnerNode())
+ if (parent == 0 || !parent->isAggregate())
return 0;
- return ((const InnerNode*)parent)->findFunctionNode(clone);
+ return ((const Aggregate*)parent)->findFunctionNode(clone);
}
@@ -249,22 +249,22 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& path,
int i;
for (i = 0; i < path.size(); ++i) {
- if (node == 0 || !node->isInnerNode())
+ if (node == 0 || !node->isAggregate())
break;
const Node* next;
if (i == path.size() - 1)
- next = ((const InnerNode*) node)->findFunctionNode(path.at(i));
+ next = ((const Aggregate*) node)->findFunctionNode(path.at(i));
else
- next = ((const InnerNode*) node)->findChildNode(path.at(i), genus);
+ next = ((const Aggregate*) node)->findChildNode(path.at(i), genus);
if (!next && node->isClass() && (findFlags & SearchBaseClasses)) {
NodeList baseClasses = allBaseClasses(static_cast<const ClassNode*>(node));
foreach (const Node* baseClass, baseClasses) {
if (i == path.size() - 1)
- next = static_cast<const InnerNode*>(baseClass)->findFunctionNode(path.at(i));
+ next = static_cast<const Aggregate*>(baseClass)->findFunctionNode(path.at(i));
else
- next = static_cast<const InnerNode*>(baseClass)->findChildNode(path.at(i), genus);
+ next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus);
if (next)
break;
@@ -301,8 +301,8 @@ static const NodeTypeList& relatesTypes()
{
if (t.isEmpty()) {
t.reserve(3);
- t.append(NodeTypePair(Node::Class, Node::NoSubType));
- t.append(NodeTypePair(Node::Namespace, Node::NoSubType));
+ t.append(NodeTypePair(Node::Class, Node::NoSubtype));
+ t.append(NodeTypePair(Node::Namespace, Node::NoSubtype));
t.append(NodeTypePair(Node::Document, Node::HeaderFile));
}
return t;
@@ -320,13 +320,15 @@ static const NodeTypeList& relatesTypes()
If a matching node is found, a pointer to it is returned.
Otherwise 0 is returned.
*/
-InnerNode* Tree::findRelatesNode(const QStringList& path)
+Aggregate* Tree::findRelatesNode(const QStringList& path)
{
Node* n = findNodeRecursive(path, 0, root(), relatesTypes());
- return ((n && n->isInnerNode()) ? static_cast<InnerNode*>(n) : 0);
+ return ((n && n->isAggregate()) ? static_cast<Aggregate*>(n) : 0);
}
/*!
+ Inserts function name \a funcName and function role \a funcRole into
+ the property function map for the specified \a property.
*/
void Tree::addPropertyFunction(PropertyNode* property,
const QString& funcName,
@@ -344,7 +346,7 @@ void Tree::addPropertyFunction(PropertyNode* property,
This function does not resolve QML inheritance.
*/
-void Tree::resolveInheritance(InnerNode* n)
+void Tree::resolveInheritance(Aggregate* n)
{
if (!n)
n = root();
@@ -399,7 +401,7 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn)
node) using the unqualified base class name.
*/
if (!n) {
- InnerNode* parent = cn->parent();
+ Aggregate* parent = cn->parent();
if (parent)
// Exclude the root namespace
if (parent->isNamespace() && !parent->name().isEmpty())
@@ -422,7 +424,7 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn)
FunctionNode* from = findVirtualFunctionInBaseClasses(cn, func);
if (from != 0) {
if (func->virtualness() == FunctionNode::NonVirtual)
- func->setVirtualness(FunctionNode::ImpureVirtual);
+ func->setVirtualness(FunctionNode::NormalVirtual);
func->setReimplementedFrom(from);
}
}
@@ -442,7 +444,7 @@ void Tree::resolveProperties()
propEntry = unresolvedPropertyMap.constBegin();
while (propEntry != unresolvedPropertyMap.constEnd()) {
PropertyNode* property = propEntry.key();
- InnerNode* parent = property->parent();
+ Aggregate* parent = property->parent();
QString getterName = (*propEntry)[PropertyNode::Getter];
QString setterName = (*propEntry)[PropertyNode::Setter];
QString resetterName = (*propEntry)[PropertyNode::Resetter];
@@ -587,7 +589,7 @@ NodeList Tree::allBaseClasses(const ClassNode* classNode) const
search at the tree root. \a subtype is not used unless
\a type is \c{Document}.
*/
-Node* Tree::findNodeByNameAndType(const QStringList& path, Node::Type type) const
+Node* Tree::findNodeByNameAndType(const QStringList& path, Node::NodeType type) const
{
return findNodeRecursive(path, 0, root(), type);
}
@@ -611,7 +613,7 @@ Node* Tree::findNodeByNameAndType(const QStringList& path, Node::Type type) cons
Node* Tree::findNodeRecursive(const QStringList& path,
int pathIndex,
const Node* start,
- Node::Type type) const
+ Node::NodeType type) const
{
if (!start || path.isEmpty())
return 0; // no place to start, or nothing to search for.
@@ -622,7 +624,7 @@ Node* Tree::findNodeRecursive(const QStringList& path,
return 0; // premature leaf
}
- InnerNode* current = static_cast<InnerNode*>(node);
+ Aggregate* current = static_cast<Aggregate*>(node);
const NodeList& children = current->childNodes();
const QString& name = path.at(pathIndex);
for (int i=0; i<children.size(); ++i) {
@@ -678,7 +680,7 @@ Node* Tree::findNodeRecursive(const QStringList& path,
if (pathIndex >= path.size())
return 0;
- InnerNode* current = static_cast<InnerNode*>(start);
+ Aggregate* current = static_cast<Aggregate*>(start);
const NodeList& children = current->childNodes();
for (int i=0; i<children.size(); ++i) {
Node* n = children.at(i);
@@ -778,7 +780,7 @@ const Node* Tree::findNodeForTarget(const QStringList& path,
}
while (current) {
- if (current->isInnerNode()) {
+ if (current->isAggregate()) {
const Node* node = matchPathAndTarget(path, path_idx, target, current, flags, genus, ref);
if (node)
return node;
@@ -848,8 +850,8 @@ const Node* Tree::matchPathAndTarget(const QStringList& path,
return t;
}
if (target.isEmpty()) {
- if ((idx) == (path.size()-1) && node->isInnerNode() && (flags & SearchEnumValues)) {
- t = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(idx));
+ if ((idx) == (path.size()-1) && node->isAggregate() && (flags & SearchEnumValues)) {
+ t = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(idx));
if (t)
return t;
}
@@ -863,7 +865,7 @@ const Node* Tree::matchPathAndTarget(const QStringList& path,
return t;
if (target.isEmpty()) {
if ((idx) == (path.size()-1) && (flags & SearchEnumValues)) {
- t = static_cast<const InnerNode*>(bc)->findEnumNodeForValue(path.at(idx));
+ t = static_cast<const Aggregate*>(bc)->findEnumNodeForValue(path.at(idx));
if (t)
return t;
}
@@ -915,20 +917,20 @@ const Node* Tree::findNode(const QStringList& path,
}
for (i = start_idx; i < path.size(); ++i) {
- if (node == 0 || !node->isInnerNode())
+ if (node == 0 || !node->isAggregate())
break;
- const Node* next = static_cast<const InnerNode*>(node)->findChildNode(path.at(i), genus);
+ const Node* next = static_cast<const Aggregate*>(node)->findChildNode(path.at(i), genus);
if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) {
- next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i));
+ next = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(i));
}
if (!next && ((genus == Node::CPP) || (genus == Node::DontCare)) &&
node->isClass() && (findFlags & SearchBaseClasses)) {
NodeList baseClasses = allBaseClasses(static_cast<const ClassNode*>(node));
foreach (const Node* baseClass, baseClasses) {
- next = static_cast<const InnerNode*>(baseClass)->findChildNode(path.at(i), genus);
+ next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus);
if (!next && (findFlags & SearchEnumValues) && i == path.size() - 1)
- next = static_cast<const InnerNode*>(baseClass)->findEnumNodeForValue(path.at(i));
+ next = static_cast<const Aggregate*>(baseClass)->findEnumNodeForValue(path.at(i));
if (next) {
break;
}
@@ -980,7 +982,7 @@ QString Tree::getRef(const QString& target, const Node* node) const
*/
void Tree::insertTarget(const QString& name,
const QString& title,
- TargetRec::Type type,
+ TargetRec::TargetType type,
Node* node,
int priority)
{
@@ -991,9 +993,8 @@ void Tree::insertTarget(const QString& name,
/*!
*/
-void Tree::resolveTargets(InnerNode* root)
+void Tree::resolveTargets(Aggregate* root)
{
- // need recursion
foreach (Node* child, root->childNodes()) {
if (child->type() == Node::Document) {
DocumentNode* node = static_cast<DocumentNode*>(child);
@@ -1005,7 +1006,7 @@ void Tree::resolveTargets(InnerNode* root)
bool alreadyThere = false;
if (!nodes.empty()) {
for (int i=0; i< nodes.size(); ++i) {
- if (nodes[i]->subType() == Node::ExternalPage) {
+ if (nodes[i]->docSubtype() == Node::ExternalPage) {
if (node->name() == nodes[i]->name()) {
alreadyThere = true;
break;
@@ -1037,9 +1038,8 @@ void Tree::resolveTargets(InnerNode* root)
QString ref = refForAtom(keywords.at(i));
QString title = keywords.at(i)->string();
if (!ref.isEmpty() && !title.isEmpty()) {
- QString key = Doc::canonicalTitle(title);
TargetRec* target = new TargetRec(ref, title, TargetRec::Keyword, child, 1);
- nodesByTargetRef_.insert(key, target);
+ nodesByTargetRef_.insert(Doc::canonicalTitle(title), target);
nodesByTargetTitle_.insert(title, target);
}
}
@@ -1057,6 +1057,8 @@ void Tree::resolveTargets(InnerNode* root)
}
}
}
+ if (child->isAggregate())
+ resolveTargets(static_cast<Aggregate*>(child));
}
}
@@ -1140,18 +1142,15 @@ const DocumentNode* Tree::findDocumentNodeByTitle(const QString& title) const
DocumentNodeMultiMap::const_iterator j = i;
++j;
if (j != docNodesByTitle_.constEnd() && j.key() == i.key()) {
- QList<Location> internalLocations;
while (j != docNodesByTitle_.constEnd()) {
if (j.key() == i.key() && j.value()->url().isEmpty()) {
- internalLocations.append(j.value()->location());
break; // Just report one duplicate for now.
}
++j;
}
- if (internalLocations.size() > 0) {
+ if (j != docNodesByTitle_.cend()) {
i.value()->location().warning("This page title exists in more than one file: " + title);
- foreach (const Location &location, internalLocations)
- location.warning("[It also exists here]");
+ j.value()->location().warning("[It also exists here]");
}
}
return i.value();
@@ -1252,7 +1251,7 @@ CollectionNode* Tree::findCollection(const QString& name, Node::Genus genus)
CNMap::const_iterator i = m->constFind(name);
if (i != m->cend())
return i.value();
- Node::Type t = Node::NoType;
+ Node::NodeType t = Node::NoType;
switch (genus) {
case Node::DOC:
t = Node::Group;
diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h
index 1e9612aeec..9e195c90ae 100644
--- a/src/tools/qdoc/tree.h
+++ b/src/tools/qdoc/tree.h
@@ -49,14 +49,19 @@ class QDocDatabase;
struct TargetRec
{
public:
- enum Type { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle };
+ enum TargetType { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle };
TargetRec(const QString& name,
const QString& title,
- TargetRec::Type type,
+ TargetRec::TargetType type,
Node* node,
int priority)
- : node_(node), ref_(name), title_(title), priority_(priority), type_(type) { }
+ : node_(node), ref_(name), title_(title), priority_(priority), type_(type) {
+ // Discard the dedicated ref for keywords - they always
+ // link to the top of the QDoc comment they appear in
+ if (type == Keyword)
+ ref_.clear();
+ }
bool isEmpty() const { return ref_.isEmpty(); }
@@ -64,7 +69,7 @@ struct TargetRec
QString ref_;
QString title_;
int priority_;
- Type type_;
+ TargetType type_;
};
struct TargetLoc
@@ -107,7 +112,7 @@ class Tree
Node* findNodeRecursive(const QStringList& path,
int pathIndex,
const Node* start,
- Node::Type type) const;
+ Node::NodeType type) const;
Node* findNodeRecursive(const QStringList& path,
int pathIndex,
Node* start,
@@ -134,22 +139,22 @@ class Tree
QmlTypeNode* findQmlTypeNode(const QStringList& path);
- Node* findNodeByNameAndType(const QStringList& path, Node::Type type) const;
- InnerNode* findRelatesNode(const QStringList& path);
+ Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) const;
+ Aggregate* findRelatesNode(const QStringList& path);
QString getRef(const QString& target, const Node* node) const;
void insertTarget(const QString& name,
const QString& title,
- TargetRec::Type type,
+ TargetRec::TargetType type,
Node* node,
int priority);
- void resolveTargets(InnerNode* root);
+ void resolveTargets(Aggregate* root);
const Node* findUnambiguousTarget(const QString& target, QString& ref) const;
const DocumentNode* findDocumentNodeByTitle(const QString& title) const;
void addPropertyFunction(PropertyNode *property,
const QString &funcName,
PropertyNode::FunctionRole funcRole);
- void resolveInheritance(InnerNode* n = 0);
+ void resolveInheritance(Aggregate* n = 0);
void resolveInheritanceHelper(int pass, ClassNode* cn);
void resolveProperties();
void resolveCppToQmlLinks();
diff --git a/src/tools/qlalr/compress.cpp b/src/tools/qlalr/compress.cpp
index 247b284421..fa67504a08 100644
--- a/src/tools/qlalr/compress.cpp
+++ b/src/tools/qlalr/compress.cpp
@@ -183,7 +183,7 @@ void Compress::operator () (int *table, int row_count, int column_count)
index.fill (-999999, row_count);
- foreach (UncompressedRow row, sortedTable)
+ foreach (const UncompressedRow &row, sortedTable)
{
int first_token = std::distance (row.begin (), row.beginNonZeros ());
QVector<int>::iterator pos = info.begin ();
diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp
index 80f7a4ed2b..3005690e6e 100644
--- a/src/tools/qlalr/cppgenerator.cpp
+++ b/src/tools/qlalr/cppgenerator.cpp
@@ -163,7 +163,7 @@ void CppGenerator::operator () ()
if (item->rule == grammar.goal)
accept_state = q;
- foreach (Name s, lookaheads)
+ foreach (const Name &s, lookaheads)
{
int &u = ACTION (q, aut.id (s));
@@ -616,7 +616,7 @@ void CppGenerator::generateImpl (QTextStream &out)
out << name_ids.value(rule->lhs);
- foreach (Name n, rule->rhs)
+ foreach (const Name &n, rule->rhs)
out << ", " << name_ids.value (n);
}
out << "};" << endl << endl;
diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp
index 3d780cd618..537051956e 100644
--- a/src/tools/qlalr/lalr.cpp
+++ b/src/tools/qlalr/lalr.cpp
@@ -367,7 +367,7 @@ void Automaton::closure (StatePointer state)
if (_M_grammar->isNonTerminal (*item->dot))
{
- foreach (RulePointer rule, _M_grammar->rule_map.values (*item->dot))
+ foreach (const RulePointer &rule, _M_grammar->rule_map.values (*item->dot))
{
Item ii;
ii.rule = rule;
@@ -413,7 +413,7 @@ void Automaton::buildLookbackSets ()
if (! _M_grammar->isNonTerminal (A))
continue;
- foreach (RulePointer rule, _M_grammar->rule_map.values (A))
+ foreach (const RulePointer &rule, _M_grammar->rule_map.values (A))
{
StatePointer q = p;
@@ -606,7 +606,7 @@ void Automaton::buildIncludesDigraph ()
if (! _M_grammar->isNonTerminal (name))
continue;
- foreach (RulePointer rule, _M_grammar->rule_map.values (name))
+ foreach (const RulePointer &rule, _M_grammar->rule_map.values (name))
{
StatePointer p = pp;
@@ -706,7 +706,7 @@ void Automaton::buildLookaheads ()
{
for (ItemPointer item = p->closure.begin (); item != p->closure.end (); ++item)
{
- foreach (Lookback lookback, lookbacks.values (item))
+ foreach (const Lookback &lookback, lookbacks.values (item))
{
StatePointer q = lookback.state;
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h
index 138b1bb876..bdd6609ba6 100644
--- a/src/tools/qlalr/lalr.h
+++ b/src/tools/qlalr/lalr.h
@@ -396,6 +396,9 @@ public:
StatePointer state;
Name nt;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(OrderedSet<Node<Read> >::const_iterator, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
class Include
{
@@ -417,6 +420,9 @@ public:
StatePointer state;
Name nt;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(OrderedSet<Node<Include> >::const_iterator, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
class Automaton
{
diff --git a/src/tools/qlalr/parsetable.cpp b/src/tools/qlalr/parsetable.cpp
index 8b62e597ef..77e2219987 100644
--- a/src/tools/qlalr/parsetable.cpp
+++ b/src/tools/qlalr/parsetable.cpp
@@ -91,7 +91,7 @@ void ParseTable::operator () (Automaton *aut)
first = false;
- foreach (Name la, aut->lookaheads.value (item))
+ foreach (const Name &la, aut->lookaheads.value (item))
out << " " << *la << " reduce using rule " << aut->id (item->rule) << " (" << *item->rule->lhs << ")" << endl;
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 7bd1ac0bc6..40e77c9876 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -366,6 +366,7 @@ enum RCCXmlTag {
ResourceTag,
FileTag
};
+Q_DECLARE_TYPEINFO(RCCXmlTag, Q_PRIMITIVE_TYPE);
bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
const QString &fname, QString currentPath, bool ignoreErrors)
@@ -938,10 +939,14 @@ bool RCCResourceLibrary::writeDataNames()
return true;
}
-static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right)
+struct qt_rcc_compare_hash
{
- return qt_hash(left->m_name) < qt_hash(right->m_name);
-}
+ typedef bool result_type;
+ result_type operator()(const RCCFileInfo *left, const RCCFileInfo *right) const
+ {
+ return qt_hash(left->m_name) < qt_hash(right->m_name);
+ }
+};
bool RCCResourceLibrary::writeDataStructure()
{
@@ -963,7 +968,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values();
- std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash());
//write out the actual data now
for (int i = 0; i < m_children.size(); ++i) {
@@ -982,7 +987,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values();
- std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash());
//write out the actual data now
for (int i = 0; i < m_children.size(); ++i) {
diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h
index 6e7888c62b..e4f1aedb7e 100644
--- a/src/tools/uic/cpp/cppwriteincludes.h
+++ b/src/tools/uic/cpp/cppwriteincludes.h
@@ -36,7 +36,6 @@
#include "treewalker.h"
-#include <qhash.h>
#include <qmap.h>
#include <qset.h>
#include <qstring.h>
diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h
index e88326f0da..b65b662473 100644
--- a/src/tools/uic/uic.h
+++ b/src/tools/uic/uic.h
@@ -38,7 +38,6 @@
#include "customwidgetsinfo.h"
#include <qstring.h>
#include <qstringlist.h>
-#include <qhash.h>
#include <qstack.h>
#include <qxmlstream.h>