tools/qdoc3/node.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/tools/qdoc3/node.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/tools/qdoc3/node.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -218,6 +218,7 @@
 }
 
 /*!
+  Find the function node in this node for the function named \a name.
  */
 FunctionNode *InnerNode::findFunctionNode(const QString& name)
 {
@@ -225,6 +226,7 @@
 }
 
 /*!
+  Find the function node in this node that has the same name as \a clone.
  */
 FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone)
 {
@@ -248,6 +250,34 @@
 }
 
 /*!
+  Returns the list of keys from the primary function map.
+ */
+QStringList InnerNode::primaryKeys()
+{
+    QStringList t;
+    QMap<QString, Node*>::iterator i = primaryFunctionMap.begin();
+    while (i != primaryFunctionMap.end()) {
+        t.append(i.key());
+        ++i;
+    }
+    return t;
+}
+
+/*!
+  Returns the list of keys from the secondary function map.
+ */
+QStringList InnerNode::secondaryKeys()
+{
+    QStringList t;
+    QMap<QString, NodeList>::iterator i = secondaryFunctionMap.begin();
+    while (i != secondaryFunctionMap.end()) {
+        t.append(i.key());
+        ++i;
+    }
+    return t;
+}
+
+/*!
  */
 void InnerNode::setOverload(const FunctionNode *func, bool overlode)
 {
@@ -392,6 +422,7 @@
 }
 
 /*!
+  Find the function node in this node that has the given \a name. 
  */
 const FunctionNode *InnerNode::findFunctionNode(const QString& name) const
 {
@@ -400,9 +431,9 @@
 }
 
 /*!
+  Find the function node in this node that has the same name as \a clone.
  */
-const FunctionNode *InnerNode::findFunctionNode(
-	const FunctionNode *clone) const
+const FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const
 {
     InnerNode *that = (InnerNode *) this;
     return that->findFunctionNode(clone);
@@ -520,7 +551,7 @@
 void InnerNode::addChild(Node *child)
 {
     children.append(child);
-    if (child->type() == Function) {
+    if ((child->type() == Function) || (child->type() == QmlMethod)) {
         FunctionNode *func = (FunctionNode *) child;
         if (!primaryFunctionMap.contains(func->name())) {
             primaryFunctionMap.insert(func->name(), func);
@@ -736,6 +767,9 @@
 }
 
 /*!
+  Returns the fake node's full title, which is usually
+  just title(), but for some SubType values is different
+  from title()
  */
 QString FakeNode::fullTitle() const
 {
@@ -745,6 +779,12 @@
         else
             return title();
     }
+    else if (sub == Image) {
+        if (title().isEmpty())
+            return name().mid(name().lastIndexOf('/') + 1) + " Image File";
+        else
+            return title();
+    }
     else if (sub == HeaderFile) {
         if (title().isEmpty())
             return name();
@@ -757,13 +797,14 @@
 }
 
 /*!
+  Returns the subtitle.
  */
 QString FakeNode::subTitle() const
 {
     if (!stle.isEmpty())
         return stle;
 
-    if (sub == File) {
+    if ((sub == File) || (sub == Image)) {
         if (title().isEmpty() && name().contains("/"))
             return name();
     }
@@ -896,11 +937,40 @@
  */
 
 /*!
+  Construct a function node for a C++ function. It's parent
+  is \a parent, and it's name is \a name.
  */
 FunctionNode::FunctionNode(InnerNode *parent, const QString& name)
-    : LeafNode(Function, parent, name), met(Plain), vir(NonVirtual),
-      con(false), sta(false), ove(false), rf(0), ap(0)
+    : LeafNode(Function, parent, name),
+      met(Plain),
+      vir(NonVirtual),
+      con(false),
+      sta(false),
+      ove(false),
+      att(false),
+      rf(0),
+      ap(0)
 {
+    // nothing.
+}
+
+/*!
+  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.
+ */
+FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bool attached)
+    : LeafNode(type, parent, name),
+      met(Plain),
+      vir(NonVirtual),
+      con(false),
+      sta(false),
+      ove(false),
+      att(attached),
+      rf(0),
+      ap(0)
+{
+    // nothing.
 }
 
 /*!
@@ -1034,6 +1104,13 @@
     return s;
 }
 
+/*!
+  Print some debugging stuff.
+ */
+void FunctionNode::debug() const
+{
+    qDebug() << "QML METHOD" << name() << "rt" << rt << "pp" << pp;
+}
 
 /*!
   \class PropertyNode
@@ -1127,6 +1204,8 @@
 }
 
 #ifdef QDOC_QML
+bool QmlClassNode::qmlOnly = false;
+
 /*!
   Constructor for the Qml class node.
  */
@@ -1135,7 +1214,7 @@
                            const ClassNode* cn)
     : FakeNode(parent, name, QmlClass), cnode(cn)
 {
-    setTitle("QML " + name + " Element Reference");
+    setTitle((qmlOnly ? "" : "QML ") + name + " Element Reference");
 }
 
 /*!
@@ -1206,24 +1285,6 @@
         return defaultValue;
     }
 }
-
-/*!
-  Constructor for the QML signal node.
- */
-QmlSignalNode::QmlSignalNode(QmlClassNode *parent, const QString& name)
-    : LeafNode(QmlSignal, parent, name)
-{
-    // nothing.
-}
-
-/*!
-  Constructor for the QML method node.
- */
-QmlMethodNode::QmlMethodNode(QmlClassNode *parent, const QString& name)
-    : LeafNode(QmlMethod, parent, name)
-{
-    // nothing.
-}
 #endif
 
 QT_END_NAMESPACE