diff options
author | Martin Smith <msmith@trolltech.com> | 2009-09-30 12:37:29 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2009-09-30 12:39:23 (GMT) |
commit | dcbba3c0b603ad3b38c0d3ed128b230857cb38be (patch) | |
tree | 6f2216b2bf12513b77f50eb81e726cdc40393063 /tools/qdoc3/htmlgenerator.cpp | |
parent | ca2834b0056b301f1d1b732840fcb106fdd477ac (diff) | |
download | Qt-dcbba3c0b603ad3b38c0d3ed128b230857cb38be.zip Qt-dcbba3c0b603ad3b38c0d3ed128b230857cb38be.tar.gz Qt-dcbba3c0b603ad3b38c0d3ed128b230857cb38be.tar.bz2 |
qdoc: Modified the support for \sincelist.
It now finds a lot more \since 4.6 stuff.
Diffstat (limited to 'tools/qdoc3/htmlgenerator.cpp')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 132 |
1 files changed, 108 insertions, 24 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5406017..2757cd8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -330,7 +330,65 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) #ifdef ZZZ_QDOC_QML findAllQmlClasses(tree->root()); #endif - findAllSince(tree->root(),tree->version()); + findAllSince(tree->root()); + +#if 0 + if (!sinceVersions.isEmpty()) { + SinceVersionMap::const_iterator v = sinceVersions.constEnd(); + do { + --v; + qDebug() << "SINCE:" << v.key(); + if (!v.value().isEmpty()) { + QString type; + SinceNodeMultiMap::const_iterator n = v.value().constBegin(); + while (n != v.value().constEnd()) { + switch (n.value()->type()) { + case Node::Namespace: + type = "namespace"; + break; + case Node::Class: + type = "class"; + break; + case Node::Fake: + type = "fake"; + break; + case Node::Enum: + type = "enum"; + break; + case Node::Typedef: + type = "typedef"; + break; + case Node::Function: + type = "function"; + break; + case Node::Property: + type = "property"; + break; + case Node::Variable: + type = "variable"; + break; + case Node::Target: + type = "target"; + break; + case Node::QmlProperty: + type = "QML property"; + break; + case Node::QmlSignal: + type = "QML signal"; + break; + case Node::QmlMethod: + type = "QML method"; + break; + default: + type = "No type"; + } + qDebug() << " " << type << n.key(); + ++n; + } + } + } while (v != sinceVersions.constBegin()); + } +#endif PageGenerator::generateTree(tree, marker); @@ -655,21 +713,32 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::SinceList: { - QList<Node*> values; - if (atom->string() == "classes") { - values = sinceClasses.values(); - } - else if (atom->string() == "functions") { - values = sinceFunctions.values(); - } - if (!values.isEmpty()) { - QMap<QString, const Node*> nodeMap; - for (int i=0; i<values.size(); ++i) { - const Node* n = values.at(i); - nodeMap.insert(n->nameForLists(),n); + QList<Node*> nodes; + SinceVersionMap::const_iterator v; + v = sinceVersions.find(atom->string()); + if ((v != sinceVersions.constEnd()) && !v.value().isEmpty()) { + for (int i=0; !Node::typeName(i).isEmpty(); i++) { + Node::Type t = (Node::Type) i; + SinceNodeMultiMap::const_iterator n=v.value().constBegin(); + QMultiMap<QString, const Node*> nodeMap; + while (n != v.value().constEnd()) { + const Node* node = n.value(); + if (node->type() == t) + nodeMap.insert(node->nameForLists(),node); + ++n; + } + if (!nodeMap.isEmpty()) { + out() << "<h2>" + << Node::typeName(i) + << " new in Qt " + << atom->string() + << "<h2>"; + generateAnnotatedList(relative, marker, nodeMap); + nodeMap.clear(); + } } - generateAnnotatedList(relative, marker, nodeMap); } + } break; case Atom::Image: @@ -3517,22 +3586,21 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) /*! For generating the "Since x.y" page. */ -void HtmlGenerator::findAllSince(const InnerNode *node, QString version) +void HtmlGenerator::findAllSince(const InnerNode *node) { - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); - NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { - if (((*c)->access() != Node::Private) && ((*c)->since() == version)) { + QString sinceVersion = (*c)->since(); + if (((*c)->access() != Node::Private) && !sinceVersion.isEmpty()) { + SinceVersionMap::iterator vmap = sinceVersions.find(sinceVersion); + if (vmap == sinceVersions.end()) + vmap = sinceVersions.insert(sinceVersion,SinceNodeMultiMap()); if ((*c)->type() == Node::Function) { FunctionNode *func = static_cast<FunctionNode *>(*c); if ((func->status() > Node::Obsolete) && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { - sinceFunctions.insert(func->name(), func); + vmap.value().insert(func->name(),(*c)); } } else if ((*c)->url().isEmpty()) { @@ -3542,17 +3610,33 @@ void HtmlGenerator::findAllSince(const InnerNode *node, QString version) (*c)->parent()->type() == Node::Namespace && !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; - sinceClasses.insert(className, *c); + vmap.value().insert(className,(*c)); } } + else { + QString name = (*c)->name(); + if ((*c)->parent() && + (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name()+"::"+name; + vmap.value().insert(name,(*c)); + qDebug() << "GOT HEAH" << name; + } if ((*c)->isInnerNode()) { - findAllSince(static_cast<InnerNode *>(*c),version); + findAllSince(static_cast<InnerNode *>(*c)); } } ++c; } } +#if 0 + const QRegExp versionSeparator("[\\-\\.]"); + const int minorIndex = version.indexOf(versionSeparator); + const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); + version = version.left(patchIndex); +#endif + void HtmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); |