summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-02-19 13:44:31 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-02-19 13:44:31 (GMT)
commit96a3f7950346b7bba3097167c5fe8d9223c9b0a4 (patch)
treed0e3902d9c5985b02c222da1e5befaa28b891e5f /tools/qdoc3
parentd049509ba60b90f28c12db83c74e22649384e48c (diff)
parent09dc6df0472957d75f6c99cf81c939cb9a31602c (diff)
downloadQt-96a3f7950346b7bba3097167c5fe8d9223c9b0a4.zip
Qt-96a3f7950346b7bba3097167c5fe8d9223c9b0a4.tar.gz
Qt-96a3f7950346b7bba3097167c5fe8d9223c9b0a4.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodeparser.cpp2
-rw-r--r--tools/qdoc3/generator.cpp26
-rw-r--r--tools/qdoc3/generator.h7
-rw-r--r--tools/qdoc3/htmlgenerator.cpp30
-rw-r--r--tools/qdoc3/node.cpp8
-rw-r--r--tools/qdoc3/node.h6
6 files changed, 44 insertions, 35 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 021d64a..d9e9c3b 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -1034,7 +1034,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
else if (command == COMMAND_QMLINHERITS) {
setLink(node, Node::InheritsLink, arg);
if (node->subType() == Node::QmlClass) {
- QmlClassNode::addInheritedBy(arg,node->name());
+ QmlClassNode::addInheritedBy(arg,node);
}
}
else if (command == COMMAND_QMLDEFAULT) {
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 6a8899a..a7ab453 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -1186,6 +1186,32 @@ void Generator::appendSortedNames(Text& text,
}
}
+void Generator::appendSortedNames(Text& text,
+ const Node* base,
+ const NodeList& subs,
+ CodeMarker *marker)
+{
+ NodeList::ConstIterator r;
+ QMap<QString,Text> classMap;
+ int index = 0;
+
+ r = subs.begin();
+ while (r != subs.end()) {
+ Text className;
+ appendFullName(className, (*r), base, marker);
+ classMap[className.toString().toLower()] = className;
+ ++r;
+ }
+
+ QStringList classNames = classMap.keys();
+ classNames.sort();
+
+ foreach (const QString &className, classNames) {
+ text << classMap[className];
+ text << separator(index++, classNames.count());
+ }
+}
+
int Generator::skipAtoms(const Atom *atom, Atom::Type type) const
{
int skipAhead = 0;
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 44f56e2..50ffb0a 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -169,6 +169,13 @@ class Generator
const QList<RelatedClass> &classes,
CodeMarker *marker);
+ protected:
+ void appendSortedNames(Text& text,
+ const Node* base,
+ const NodeList& subs,
+ CodeMarker *marker);
+
+ private:
QString amp;
QString lt;
QString gt;
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index e767460..c20f745 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4316,40 +4316,16 @@ void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn,
CodeMarker* marker)
{
if (cn) {
- QStringList subs;
+ NodeList subs;
QmlClassNode::subclasses(cn->name(),subs);
if (!subs.isEmpty()) {
- subs.sort();
+ //subs.sort();
Text text;
text << Atom::ParaLeft << "Inherited by ";
- for (int i = 0; i < subs.size(); ++i) {
- text << subs.at(i);
- text << separator(i, subs.size());
- }
+ appendSortedNames(text,cn,subs,marker);
text << Atom::ParaRight;
generateText(text, cn, marker);
}
-#if 0
- if (cn->links().contains(Node::InheritsLink)) {
- QPair<QString,QString> linkPair;
- linkPair = cn->links()[Node::InheritsLink];
- QStringList strList(linkPair.first);
- const Node* n = myTree->findNode(strList,Node::Fake);
- if (n && n->subType() == Node::QmlClass) {
- const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
- out() << "<p style=\"text-align: center\">";
- Text text;
- text << "[Inherits ";
- text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
- text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
- text << Atom(Atom::String, linkPair.second);
- text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
- text << "]";
- generateText(text, cn, marker);
- out() << "</p>";
- }
- }
-#endif
}
}
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 4ddcfb1..5357597 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1257,7 +1257,7 @@ bool TargetNode::isInnerNode() const
#ifdef QDOC_QML
bool QmlClassNode::qmlOnly = false;
-QMultiMap<QString,QString> QmlClassNode::inheritedBy;
+QMultiMap<QString,Node*> QmlClassNode::inheritedBy;
/*!
Constructs a Qml class node (i.e. a Fake node with the
@@ -1294,15 +1294,15 @@ QString QmlClassNode::fileBase() const
Record the fact that QML class \a base is inherited by
QML class \a sub.
*/
-void QmlClassNode::addInheritedBy(const QString& base, const QString& sub)
+void QmlClassNode::addInheritedBy(const QString& base, Node* sub)
{
inheritedBy.insert(base,sub);
}
/*!
- Loads the list \a subs with the names of all the subclasses of \a base.
+ Loads the list \a subs with the nodes of all the subclasses of \a base.
*/
-void QmlClassNode::subclasses(const QString& base, QStringList& subs)
+void QmlClassNode::subclasses(const QString& base, NodeList& subs)
{
subs.clear();
if (inheritedBy.contains(base))
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index de26025..3798e4e 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -383,12 +383,12 @@ class QmlClassNode : public FakeNode
const ClassNode* classNode() const { return cnode; }
virtual QString fileBase() const;
- static void addInheritedBy(const QString& base, const QString& sub);
- static void subclasses(const QString& base, QStringList& subs);
+ static void addInheritedBy(const QString& base, Node* sub);
+ static void subclasses(const QString& base, NodeList& subs);
public:
static bool qmlOnly;
- static QMultiMap<QString,QString> inheritedBy;
+ static QMultiMap<QString,Node*> inheritedBy;
private:
const ClassNode* cnode;