From 5a54b2c4c448ea22adb56bc191303abca34f230b Mon Sep 17 00:00:00 2001
From: Martin Smith <msmith@trolltech.com>
Date: Tue, 30 Jun 2009 12:11:32 +0200
Subject: qdoc: Added more handling of \reimp command

Also fixed a few qdoc error reports.

Task-number: 162182, 222650
---
 src/gui/kernel/qevent.cpp        | 33 +++++++++++++++++++++----------
 tools/qdoc3/cppcodeparser.cpp    |  3 ++-
 tools/qdoc3/generator.cpp        | 42 +++++++++++++++++++++++-----------------
 tools/qdoc3/generator.h          |  4 ++--
 tools/qdoc3/javadocgenerator.cpp |  3 ++-
 tools/qdoc3/javadocgenerator.h   |  2 +-
 tools/qdoc3/node.cpp             | 12 ++++++++++++
 tools/qdoc3/node.h               |  4 ++++
 8 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 2467a62..e40ad9d 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3647,12 +3647,13 @@ void QGestureEvent::acceptAll()
 }
 
 /*!
-    Sets the accept flag of the specified gesture inside the event
-    object, the equivalent of calling
-    \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
+    Sets the accept flag of the gesture specified by \a type.
+    This is equivalent to calling
+    \l{QGestureEvent::gesture()}{gesture(type)}->
+    \l{QGesture::accept()}{accept()}
 
-    Setting the accept parameter indicates that the event receiver
-    wants the gesture. Unwanted gestures might be propagated to the parent
+    Setting the accept flag indicates that the event receiver wants
+    the gesture. Unwanted gestures might be propagated to the parent
     widget.
 */
 void QGestureEvent::accept(Qt::GestureType type)
@@ -3662,12 +3663,13 @@ void QGestureEvent::accept(Qt::GestureType type)
 }
 
 /*!
-    Sets the accept flag of the specified gesture inside the event
-    object, the equivalent of calling
-    \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
+    Sets the accept flag of the gesture specified by \a type.
+    This is equivalent to calling
+    \l{QGestureEvent::gesture()}{gesture(type)}->
+    \l{QGesture::accept()}{accept()}
 
-    Setting the accept parameter indicates that the event receiver
-    wants the gesture. Unwanted gestures might be propagated to the parent
+    Setting the accept flag indicates that the event receiver wants
+    the gesture. Unwanted gestures might be propagated to the parent
     widget.
 */
 void QGestureEvent::accept(const QString &type)
@@ -4165,4 +4167,15 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
     return *this;
 }
 
+/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
+  Returns the touch device Type, which is of type
+  \l {QTouchEvent::DeviceType} {DeviceType}.
+ */
+
+/*! \fn void QTouchEvent::setDeviceType(DeviceType deviceType)
+  Sets the device type to \a deviceType, which is of type
+  \l {QTouchEvent::DeviceType} {DeviceType}. 
+ */
+
+
 QT_END_NAMESPACE
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 792190d..cb6caa9 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -743,7 +743,8 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
             // Reimplemented functions now reported in separate sections.
             func->setAccess(Node::Private);
             func->setStatus(Node::Internal);
-#endif            
+#endif
+            func->setReimp(true);
         }
         else {
             doc.location().warning(tr("Ignored '\\%1' in %2")
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index fa55b8a..7e10f3e 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -241,7 +241,7 @@ void Generator::generateFakeNode(const FakeNode * /* fake */,
 {
 }
 
-void Generator::generateText(const Text& text,
+bool Generator::generateText(const Text& text,
                              const Node *relative,
                              CodeMarker *marker)
 {
@@ -254,31 +254,35 @@ void Generator::generateText(const Text& text,
                          true,
                          numAtoms);
         endText(relative, marker);
+        return true;
     }
+    return false;
 }
 
 #ifdef QDOC_QML
-void Generator::generateQmlText(const Text& text,
+bool Generator::generateQmlText(const Text& text,
                                 const Node *relative,
                                 CodeMarker *marker)
 {
-    if (text.firstAtom() != 0) {
-        startText(relative, marker);
-        const Atom *atom = text.firstAtom();
-        while (atom) {
-            if (atom->type() != Atom::QmlText)
-                atom = atom->next();
-            else {
-                atom = atom->next();
-                while (atom && (atom->type() != Atom::EndQmlText)) {
-                    int n = 1 + generateAtom(atom, relative, marker);
-                    while (n-- > 0)
-                        atom = atom->next();
-                }
+    const Atom* atom = text.firstAtom();
+    if (atom == 0)
+        return false;
+
+    startText(relative, marker);
+    while (atom) {
+        if (atom->type() != Atom::QmlText)
+            atom = atom->next();
+        else {
+            atom = atom->next();
+            while (atom && (atom->type() != Atom::EndQmlText)) {
+                int n = 1 + generateAtom(atom, relative, marker);
+                while (n-- > 0)
+                    atom = atom->next();
             }
         }
-        endText(relative, marker);
     }
+    endText(relative, marker);
+    return true;
 }
 #endif
 
@@ -302,7 +306,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
     }
 
     if (node->doc().isEmpty()) {
-        if (!quiet) // ### might be unnecessary
+        if (!quiet && !node->isReimp()) // ### might be unnecessary
             node->location().warning(tr("No documentation for '%1'")
                             .arg(marker->plainFullName(node)));
     }
@@ -313,7 +317,9 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
                 generateReimplementedFrom(func, marker);
         }
         
-        generateText(node->doc().body(), node, marker);
+        if (!generateText(node->doc().body(), node, marker))
+            if (node->isReimp())
+                return;
 
         if (node->type() == Node::Enum) {
             const EnumNode *enume = (const EnumNode *) node;
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 75134d2..08b857b 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -93,11 +93,11 @@ class Generator
     virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
     virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker);
 
-    virtual void generateText(const Text& text, 
+    virtual bool generateText(const Text& text, 
                               const Node *relative,
                               CodeMarker *marker);
 #ifdef QDOC_QML
-    virtual void generateQmlText(const Text& text, 
+    virtual bool generateQmlText(const Text& text, 
                                  const Node *relative,
                                  CodeMarker *marker);
 #endif
diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp
index b32425c..294877b 100644
--- a/tools/qdoc3/javadocgenerator.cpp
+++ b/tools/qdoc3/javadocgenerator.cpp
@@ -272,9 +272,10 @@ void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker
     HtmlGenerator::generateFakeNode(fake, marker);
 }
 
-void JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker)
+bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker)
 {
     HtmlGenerator::generateText(text, relative, marker);
+    return true;
 }
 
 void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker)
diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h
index ba9b15d..5431c38 100644
--- a/tools/qdoc3/javadocgenerator.h
+++ b/tools/qdoc3/javadocgenerator.h
@@ -68,7 +68,7 @@ protected:
     void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker);
     void generateFakeNode( const FakeNode *fake, CodeMarker *marker );
 
-    void generateText( const Text& text, const Node *relative, CodeMarker *marker );
+    bool generateText( const Text& text, const Node *relative, CodeMarker *marker );
     void generateBody( const Node *node, CodeMarker *marker );
     void generateAlsoList( const Node *node, CodeMarker *marker );
 
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 0f9468a..b2e53ab 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -868,6 +868,18 @@ void FunctionNode::setOverload(bool overlode)
 }
 
 /*!
+  Sets the function node's reimplementation flag to \a r.
+  When \a r 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.
+ */
+void FunctionNode::setReimp(bool r)
+{
+    reimp = r;
+}
+
+/*!
  */
 void FunctionNode::addParameter(const Parameter& parameter)
 {
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 0a671b37d..a35bc17 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -123,6 +123,7 @@ class Node
     void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; }
 
     virtual bool isInnerNode() const = 0;
+    virtual bool isReimp() const { return false; }
     Type type() const { return typ; }
     InnerNode *parent() const { return par; }
     InnerNode *relates() const { return rel; }
@@ -444,6 +445,7 @@ class FunctionNode : public LeafNode
     void setConst(bool conste) { con = conste; }
     void setStatic(bool statique) { sta = statique; }
     void setOverload(bool overlode);
+    void setReimp(bool r);
     void addParameter(const Parameter& parameter);
     inline void setParameters(const QList<Parameter>& parameters);
     void borrowParameterNames(const FunctionNode *source);
@@ -458,6 +460,7 @@ class FunctionNode : public LeafNode
     bool isConst() const { return con; }
     bool isStatic() const { return sta; }
     bool isOverload() const { return ove; }
+    bool isReimp() const { return reimp; }
     int overloadNumber() const;
     int numOverloads() const;
     const QList<Parameter>& parameters() const { return params; }
@@ -483,6 +486,7 @@ class FunctionNode : public LeafNode
     bool con : 1;
     bool sta : 1;
     bool ove : 1;
+    bool reimp: 1; 
     QList<Parameter> params;
     const FunctionNode *rf;
     const PropertyNode *ap;
-- 
cgit v0.12