tools/qdoc3/cppcodeparser.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/tools/qdoc3/cppcodeparser.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/tools/qdoc3/cppcodeparser.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -728,20 +728,12 @@
             if (n)
                 classNode = static_cast<const ClassNode*>(n);
         }
-        return new QmlClassNode(tre->root(), names[0], classNode);
+        if (names[0].startsWith("Qt"))
+            return new QmlClassNode(tre->root(), QLatin1String("QML:")+names[0], classNode);
+        else
+            return new QmlClassNode(tre->root(), names[0], classNode);
     }
     else if (command == COMMAND_QMLBASICTYPE) {
-#if 0
-        QStringList parts = arg.split(" ");
-        qDebug() << command << parts;
-        if (parts.size() > 1) {
-            FakeNode* pageNode = static_cast<FakeNode*>(tre->root()->findNode(parts[1], Node::Fake));
-            if (pageNode) {
-                qDebug() << "FOUND";
-                return new QmlBasicTypeNode(pageNode, parts[0]);
-            }
-        }
-#endif
         return new QmlBasicTypeNode(tre->root(), arg);
     }
     else if ((command == COMMAND_QMLSIGNAL) ||
@@ -752,6 +744,8 @@
         QString type;
         QmlClassNode* qmlClass = 0;
         if (splitQmlMethodArg(doc,arg,type,element)) {
+            if (element.startsWith(QLatin1String("Qt")))
+                element = QLatin1String("QML:") + element;
             Node* n = tre->findNode(QStringList(element),Node::Fake);
             if (n && n->subType() == Node::QmlClass) {
                 qmlClass = static_cast<QmlClassNode*>(n);
@@ -1126,6 +1120,17 @@
 }
 
 /*!
+  Skip to \a target. If \a target is found before the end
+  of input, return true. Otherwise return false.
+ */
+bool CppCodeParser::skipTo(int target)
+{
+    while ((tok != Tok_Eoi) && (tok != target))
+        readToken();
+    return (tok == target ? true : false);
+}
+
+/*!
   If the current token is one of the keyword thingees that
   are used in Qt, skip over it to the next token and return
   true. Otherwise just return false without reading the
@@ -1368,7 +1373,9 @@
 
     if (!matchDataType(&returnType)) {
         if (tokenizer->parsingFnOrMacro()
-                && (match(Tok_Q_DECLARE_FLAGS) || match(Tok_Q_PROPERTY)))
+                && (match(Tok_Q_DECLARE_FLAGS) ||
+                    match(Tok_Q_PROPERTY) ||
+                    match(Tok_Q_PRIVATE_PROPERTY)))
             returnType = CodeChunk(previousLexeme());
         else {
             return false;
@@ -1802,11 +1809,19 @@
 
 bool CppCodeParser::matchProperty(InnerNode *parent)
 {
-    if (!match(Tok_Q_PROPERTY) &&
-        !match(Tok_Q_OVERRIDE) &&
-        !match(Tok_QDOC_PROPERTY))
+    int expected_tok = Tok_LeftParen;
+    if (match(Tok_Q_PRIVATE_PROPERTY)) {
+        expected_tok = Tok_Comma;
+        if (!skipTo(Tok_Comma))
+            return false;
+    }
+    else if (!match(Tok_Q_PROPERTY) &&
+             !match(Tok_Q_OVERRIDE) &&
+             !match(Tok_QDOC_PROPERTY)) {
         return false;
-    if (!match(Tok_LeftParen))
+    }
+    
+    if (!match(expected_tok))
         return false;
 
     QString name;
@@ -1850,16 +1865,40 @@
         else if (key == "WRITE") {
             tre->addPropertyFunction(property, value, PropertyNode::Setter);
             property->setWritable(true);
-        } else if (key == "STORED")
+        }
+        else if (key == "STORED")
             property->setStored(value.toLower() == "true");
-        else if (key == "DESIGNABLE")
-            property->setDesignable(value.toLower() == "true");
+        else if (key == "DESIGNABLE") {
+            QString v = value.toLower();
+            if (v == "true")
+                property->setDesignable(true);
+            else if (v == "false")
+                property->setDesignable(false);
+            else {
+                property->setDesignable(false);
+                property->setRuntimeDesFunc(value);
+            }
+        }
         else if (key == "RESET")
             tre->addPropertyFunction(property, value, PropertyNode::Resetter);
         else if (key == "NOTIFY") {
             tre->addPropertyFunction(property, value, PropertyNode::Notifier);
         }
-
+        else if (key == "SCRIPTABLE") {
+            QString v = value.toLower();
+            if (v == "true")
+                property->setScriptable(true);
+            else if (v == "false")
+                property->setScriptable(false);
+            else {
+                property->setScriptable(false);
+                property->setRuntimeScrFunc(value);
+            }
+        }
+        else if (key == "COSTANT") 
+            property->setConstant();
+        else if (key == "FINAL") 
+            property->setFinal();
     }
     match(Tok_RightParen);
     return true;
@@ -1931,6 +1970,7 @@
             break;
         case Tok_Q_OVERRIDE:
         case Tok_Q_PROPERTY:
+        case Tok_Q_PRIVATE_PROPERTY:
         case Tok_QDOC_PROPERTY:
             matchProperty(parent);
             break;