summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdoc/node.cpp')
-rw-r--r--src/tools/qdoc/node.cpp770
1 files changed, 461 insertions, 309 deletions
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index 37bc0c5fef..1fe0af352d 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -34,26 +34,27 @@
#include "node.h"
#include "tree.h"
#include "codemarker.h"
-#include "codeparser.h"
+#include "cppcodeparser.h"
#include <quuid.h>
#include "qdocdatabase.h"
#include <qdebug.h>
#include "generator.h"
+#include "tokenizer.h"
QT_BEGIN_NAMESPACE
int Node::propertyGroupCount_ = 0;
QStringMap Node::operators_;
-QMap<QString,Node::Type> Node::goals_;
+QMap<QString,Node::NodeType> Node::goals_;
/*!
Initialize the map of search goals. This is called once
by QDocDatabase::initializeDB(). The map key is a string
- representing a value in the enum Node::Type. The map value
+ representing a value in the enum Node::NodeType. The map value
is the enum value.
There should be an entry in the map for each value in the
- Type enum.
+ NodeType enum.
*/
void Node::initialize()
{
@@ -105,7 +106,24 @@ Node::~Node()
{
if (parent_)
parent_->removeChild(this);
+
if (relatesTo_)
+ removeRelates();
+}
+
+/*!
+ Removes this node from the aggregate's list of related
+ nodes, or if this node has created a dummy "relates"
+ aggregate, deletes it.
+*/
+void Node::removeRelates()
+{
+ if (!relatesTo_)
+ return;
+
+ if (relatesTo_->isDocumentNode() && !relatesTo_->parent())
+ delete relatesTo_;
+ else
relatesTo_->removeRelated(this);
}
@@ -160,8 +178,8 @@ QString Node::fullName(const Node* relative) const
match is found, return false.
\a types is a list of type/subtype pairs, where the first
- value in the pair is a Node::Type, and the second value is
- a Node::SubType. The second value is used in the match if
+ value in the pair is a Node::NodeType, and the second value is
+ a Node::DocSubtype. The second value is used in the match if
this node's type is Node::Document.
*/
bool Node::match(const NodeTypeList& types) const
@@ -169,7 +187,7 @@ bool Node::match(const NodeTypeList& types) const
for (int i=0; i<types.size(); ++i) {
if (type() == types.at(i).first) {
if (type() == Node::Document) {
- if (subType() == types.at(i).second)
+ if (docSubtype() == types.at(i).second)
return true;
}
else
@@ -200,12 +218,12 @@ void Node::setDoc(const Doc& doc, bool replace)
given \a parent and \a name. The new node is added to the
parent's child list.
*/
-Node::Node(Type type, InnerNode *parent, const QString& name)
+Node::Node(NodeType type, Aggregate *parent, const QString& name)
: nodeType_((unsigned char) type),
access_((unsigned char) Public),
safeness_((unsigned char) UnspecifiedSafeness),
pageType_((unsigned char) NoPageType),
- status_((unsigned char) Commendable),
+ status_((unsigned char) Active),
indexNodeFlag_(false),
parent_(parent),
relatesTo_(0),
@@ -320,7 +338,7 @@ QString Node::nodeTypeString() const
*/
QString Node::nodeTypeString(unsigned char t)
{
- switch ((Type)t) {
+ switch ((NodeType)t) {
case Namespace:
return "namespace";
case Class:
@@ -370,7 +388,7 @@ QString Node::nodeTypeString(unsigned char t)
*/
QString Node::nodeSubtypeString() const
{
- return nodeSubtypeString(subType());
+ return nodeSubtypeString(docSubtype());
}
/*!
@@ -380,7 +398,7 @@ QString Node::nodeSubtypeString() const
*/
QString Node::nodeSubtypeString(unsigned char t)
{
- switch ((SubType)t) {
+ switch ((DocSubtype)t) {
case Example:
return "example";
case HeaderFile:
@@ -395,7 +413,7 @@ QString Node::nodeSubtypeString(unsigned char t)
return "external page";
case DitaMap:
return "ditamap";
- case NoSubType:
+ case NoSubtype:
default:
break;
}
@@ -460,13 +478,24 @@ bool Node::fromFlagValue(FlagValue fv, bool defaultValue)
/*!
Sets the pointer to the node that this node relates to.
*/
-void Node::setRelates(InnerNode *pseudoParent)
+void Node::setRelates(Aggregate *pseudoParent)
{
- if (relatesTo_) {
- relatesTo_->removeRelated(this);
- }
+ if (pseudoParent == parent())
+ return;
+
+ removeRelates();
relatesTo_ = pseudoParent;
- pseudoParent->related_.append(this);
+ pseudoParent->addRelated(this);
+}
+
+/*!
+ Sets the (unresolved) entity \a name that this node relates to.
+ */
+void Node::setRelates(const QString& name)
+{
+ removeRelates();
+ // Create a dummy aggregate for writing the name into the index
+ relatesTo_ = new DocumentNode(0, name, Node::NoSubtype, Node::NoPageType);
}
/*!
@@ -558,7 +587,7 @@ QString RelatedClass::accessString() const
*/
Node::Status Node::inheritedStatus() const
{
- Status parentStatus = Commendable;
+ Status parentStatus = Active;
if (parent_)
parentStatus = parent_->inheritedStatus();
return (Status)qMin((int)status_, (int)parentStatus);
@@ -606,7 +635,6 @@ QString Node::fileBase() const
base.replace(QLatin1Char(' '), QLatin1Char('-'));
return base.toLower();
}
-#endif
/*!
Returns this node's Universally Unique IDentifier as a
QString. Creates the UUID first, if it has not been created.
@@ -617,6 +645,7 @@ QString Node::guid() const
uuid_ = idForNode();
return uuid_;
}
+#endif
/*!
If this node is a QML or JS type node, return a pointer to
@@ -683,14 +712,32 @@ const Node* Node::root() const
}
/*!
- \class InnerNode
+ Sets the node's declaration location, its definition
+ location, or both, depending on the suffix of the file
+ name from the file path in location \a t.
+ */
+void Node::setLocation(const Location& t)
+{
+ QString suffix = t.fileSuffix();
+ if (suffix == "h")
+ declLocation_ = t;
+ else if (suffix == "cpp")
+ defLocation_ = t;
+ else {
+ declLocation_ = t;
+ defLocation_ = t;
+ }
+}
+
+/*!
+ \class Aggregate
*/
/*!
The inner node destructor deletes the children and removes
this node from its related nodes.
*/
-InnerNode::~InnerNode()
+Aggregate::~Aggregate()
{
deleteChildren();
removeFromRelated();
@@ -706,17 +753,17 @@ InnerNode::~InnerNode()
find all this node's children that have the given \a name,
and return the one that satisfies the \a genus requirement.
*/
-Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
+Node *Aggregate::findChildNode(const QString& name, Node::Genus genus) const
{
if (genus == Node::DontCare) {
- Node *node = childMap.value(name);
+ Node *node = childMap_.value(name);
if (node && !node->isQmlPropertyGroup()) // mws asks: Why not property group?
return node;
if (isQmlType() || isJsType()) {
for (int i=0; i<children_.size(); ++i) {
Node* n = children_.at(i);
if (n->isQmlPropertyGroup() || isJsPropertyGroup()) {
- node = static_cast<InnerNode*>(n)->findChildNode(name, genus);
+ node = static_cast<Aggregate*>(n)->findChildNode(name, genus);
if (node)
return node;
}
@@ -724,7 +771,7 @@ Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
}
}
else {
- NodeList nodes = childMap.values(name);
+ NodeList nodes = childMap_.values(name);
if (!nodes.isEmpty()) {
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
@@ -733,20 +780,20 @@ Node *InnerNode::findChildNode(const QString& name, Node::Genus genus) const
}
}
}
- return primaryFunctionMap.value(name);
+ return primaryFunctionMap_.value(name);
}
/*!
Find all the child nodes of this node that are named
\a name and return them in \a nodes.
*/
-void InnerNode::findChildren(const QString& name, NodeList& nodes) const
+void Aggregate::findChildren(const QString& name, NodeList& nodes) const
{
- nodes = childMap.values(name);
- Node* n = primaryFunctionMap.value(name);
+ nodes = childMap_.values(name);
+ Node* n = primaryFunctionMap_.value(name);
if (n) {
nodes.append(n);
- NodeList t = secondaryFunctionMap.value(name);
+ NodeList t = secondaryFunctionMap_.value(name);
if (!t.isEmpty())
nodes.append(t);
}
@@ -756,7 +803,7 @@ void InnerNode::findChildren(const QString& name, NodeList& nodes) const
if (i < 0)
return;
QString qmlPropGroup = name.left(i);
- NodeList t = childMap.values(qmlPropGroup);
+ NodeList t = childMap_.values(qmlPropGroup);
if (t.isEmpty())
return;
foreach (Node* n, t) {
@@ -773,12 +820,12 @@ void InnerNode::findChildren(const QString& name, NodeList& nodes) const
with the specified \a name is found but it is not of the
specified \a type, 0 is returned.
*/
-Node* InnerNode::findChildNode(const QString& name, Type type)
+Node* Aggregate::findChildNode(const QString& name, NodeType type)
{
if (type == Function)
- return primaryFunctionMap.value(name);
+ return primaryFunctionMap_.value(name);
else {
- NodeList nodes = childMap.values(name);
+ NodeList nodes = childMap_.values(name);
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
if (node->type() == type)
@@ -792,9 +839,56 @@ Node* InnerNode::findChildNode(const QString& name, Type type)
Find a function node that is a child of this nose, such
that the function node has the specified \a name.
*/
-FunctionNode *InnerNode::findFunctionNode(const QString& name) const
-{
- return static_cast<FunctionNode *>(primaryFunctionMap.value(name));
+FunctionNode *Aggregate::findFunctionNode(const QString& name, const QString& params) const
+{
+ FunctionNode* pfn = static_cast<FunctionNode*>(primaryFunctionMap_.value(name));
+ FunctionNode* fn = pfn;
+ if (fn) {
+ const QVector<Parameter>* funcParams = &(fn->parameters());
+ if (params.isEmpty() && funcParams->isEmpty())
+ return fn;
+ bool isQPrivateSignal = false; // Not used in the search
+ QVector<Parameter> testParams;
+ if (!params.isEmpty()) {
+ CppCodeParser* cppParser = CppCodeParser::cppParser();
+ cppParser->parseParameters(params, testParams, isQPrivateSignal);
+ }
+ NodeList funcs = secondaryFunctionMap_.value(name);
+ int i = -1;
+ while (fn) {
+ if (testParams.size() == funcParams->size()) {
+ if (testParams.isEmpty())
+ return fn;
+ bool different = false;
+ for (int j=0; j<testParams.size(); j++) {
+ if (testParams.at(j).dataType() != funcParams->at(j).dataType()) {
+ different = true;
+ break;
+ }
+ }
+ if (!different)
+ return fn;
+ }
+ if (++i < funcs.size()) {
+ fn = static_cast<FunctionNode*>(funcs.at(i));
+ funcParams = &(fn->parameters());
+ }
+ else
+ fn = 0;
+ }
+ if (!fn && !testParams.empty())
+ return 0;
+ }
+ /*
+ Most \l commands that link to functions don't include
+ the parameter declarations in the function signature,
+ so if the \l is meant to go to a function that does
+ have parameters, the algorithm above won't find it.
+ Therefore we must return the pointer to the function
+ in the primary function map in the cases where the
+ parameters should have been specified in the \l command.
+ */
+ return (fn ? fn : pfn);
}
/*!
@@ -802,15 +896,15 @@ FunctionNode *InnerNode::findFunctionNode(const QString& name) const
that the function has the same name and signature as the
\a clone node.
*/
-FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const
+FunctionNode *Aggregate::findFunctionNode(const FunctionNode *clone) const
{
- QMap<QString,Node*>::ConstIterator c = primaryFunctionMap.constFind(clone->name());
- if (c != primaryFunctionMap.constEnd()) {
+ QMap<QString,Node*>::ConstIterator c = primaryFunctionMap_.constFind(clone->name());
+ if (c != primaryFunctionMap_.constEnd()) {
if (isSameSignature(clone, (FunctionNode *) *c)) {
return (FunctionNode *) *c;
}
- else if (secondaryFunctionMap.contains(clone->name())) {
- const NodeList& secs = secondaryFunctionMap[clone->name()];
+ else if (secondaryFunctionMap_.contains(clone->name())) {
+ const NodeList& secs = secondaryFunctionMap_[clone->name()];
NodeList::ConstIterator s = secs.constBegin();
while (s != secs.constEnd()) {
if (isSameSignature(clone, (FunctionNode *) *s))
@@ -825,11 +919,11 @@ FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const
/*!
Returns the list of keys from the primary function map.
*/
-QStringList InnerNode::primaryKeys()
+QStringList Aggregate::primaryKeys()
{
QStringList t;
- QMap<QString, Node*>::iterator i = primaryFunctionMap.begin();
- while (i != primaryFunctionMap.end()) {
+ QMap<QString, Node*>::iterator i = primaryFunctionMap_.begin();
+ while (i != primaryFunctionMap_.end()) {
t.append(i.key());
++i;
}
@@ -839,11 +933,11 @@ QStringList InnerNode::primaryKeys()
/*!
Returns the list of keys from the secondary function map.
*/
-QStringList InnerNode::secondaryKeys()
+QStringList Aggregate::secondaryKeys()
{
QStringList t;
- QMap<QString, NodeList>::iterator i = secondaryFunctionMap.begin();
- while (i != secondaryFunctionMap.end()) {
+ QMap<QString, NodeList>::iterator i = secondaryFunctionMap_.begin();
+ while (i != secondaryFunctionMap_.end()) {
t.append(i.key());
++i;
}
@@ -851,43 +945,13 @@ QStringList InnerNode::secondaryKeys()
}
/*!
- */
-void InnerNode::setOverload(FunctionNode *func, bool overlode)
-{
- Node *node = (Node *) func;
- Node *&primary = primaryFunctionMap[func->name()];
-
- if (secondaryFunctionMap.contains(func->name())) {
- NodeList& secs = secondaryFunctionMap[func->name()];
- if (overlode) {
- if (primary == node) {
- primary = secs.first();
- secs.erase(secs.begin());
- secs.append(node);
- }
- else {
- secs.removeAll(node);
- secs.append(node);
- }
- }
- else {
- if (primary != node) {
- secs.removeAll(node);
- secs.prepend(primary);
- primary = node;
- }
- }
- }
-}
-
-/*!
Mark all child nodes that have no documentation as having
private access and internal status. qdoc will then ignore
them for documentation purposes. Some nodes have an
Intermediate status, meaning that they should be ignored,
but not their children.
*/
-void InnerNode::makeUndocumentedChildrenInternal()
+void Aggregate::makeUndocumentedChildrenInternal()
{
foreach (Node *child, childNodes()) {
if (child->doc().isEmpty() && child->status() != Node::Intermediate) {
@@ -898,68 +962,93 @@ void InnerNode::makeUndocumentedChildrenInternal()
}
/*!
+ This is where we set the overload numbers for function nodes.
+ \note Overload numbers for related non-members are handled
+ separately.
*/
-void InnerNode::normalizeOverloads()
+void Aggregate::normalizeOverloads()
{
- QMap<QString, Node *>::Iterator p1 = primaryFunctionMap.begin();
- while (p1 != primaryFunctionMap.end()) {
+ QMap<QString, Node *>::Iterator p1 = primaryFunctionMap_.begin();
+ while (p1 != primaryFunctionMap_.end()) {
FunctionNode *primaryFunc = (FunctionNode *) *p1;
- if (secondaryFunctionMap.contains(primaryFunc->name()) &&
- (primaryFunc->status() != Commendable ||
- primaryFunc->access() == Private)) {
-
- NodeList& secs = secondaryFunctionMap[primaryFunc->name()];
- NodeList::ConstIterator s = secs.constBegin();
- while (s != secs.constEnd()) {
- FunctionNode *secondaryFunc = (FunctionNode *) *s;
-
- // Any non-obsolete, non-compatibility, non-private functions
- // (i.e, visible functions) are preferable to the primary
- // function.
-
- if (secondaryFunc->status() == Commendable &&
- secondaryFunc->access() != Private) {
-
- *p1 = secondaryFunc;
- int index = secondaryFunctionMap[primaryFunc->name()].indexOf(secondaryFunc);
- secondaryFunctionMap[primaryFunc->name()].replace(index, primaryFunc);
- break;
+ if (primaryFunc->status() != Active || primaryFunc->access() == Private) {
+ if (secondaryFunctionMap_.contains(primaryFunc->name())) {
+ /*
+ Either the primary function is not active or it is private.
+ It therefore can't be the primary function. Search the list
+ of overloads to find one that can be the primary function.
+ */
+ NodeList& overloads = secondaryFunctionMap_[primaryFunc->name()];
+ NodeList::ConstIterator s = overloads.constBegin();
+ while (s != overloads.constEnd()) {
+ FunctionNode *overloadFunc = (FunctionNode *) *s;
+ /*
+ Any non-obsolete, non-private function (i.e., visible function)
+ is preferable to the current primary function. Swap the primary
+ and overload functions.
+ */
+ if (overloadFunc->status() == Active && overloadFunc->access() != Private) {
+ primaryFunc->setOverloadNumber(overloadFunc->overloadNumber());
+ overloads.replace(overloads.indexOf(overloadFunc), primaryFunc);
+ *p1 = overloadFunc;
+ overloadFunc->setOverloadFlag(false);
+ overloadFunc->setOverloadNumber(0);
+ break;
+ }
+ ++s;
}
- ++s;
}
}
++p1;
}
-
- QMap<QString, Node *>::ConstIterator p = primaryFunctionMap.constBegin();
- while (p != primaryFunctionMap.constEnd()) {
+ /*
+ Ensure that none of the primary functions is marked with \overload.
+ */
+ QMap<QString, Node *>::Iterator p = primaryFunctionMap_.begin();
+ while (p != primaryFunctionMap_.end()) {
FunctionNode *primaryFunc = (FunctionNode *) *p;
- if (primaryFunc->isOverload())
- primaryFunc->ove = false;
- if (secondaryFunctionMap.contains(primaryFunc->name())) {
- NodeList& secs = secondaryFunctionMap[primaryFunc->name()];
- NodeList::ConstIterator s = secs.constBegin();
- while (s != secs.constEnd()) {
- FunctionNode *secondaryFunc = (FunctionNode *) *s;
- if (!secondaryFunc->isOverload())
- secondaryFunc->ove = true;
- ++s;
+ if (primaryFunc->isOverload()) {
+ if (secondaryFunctionMap_.contains(primaryFunc->name())) {
+ /*
+ The primary function is marked with \overload. Find an
+ overload in the secondary function map that is not marked
+ with \overload but that is active and not private. Then
+ swap it with the primary function.
+ */
+ NodeList& overloads = secondaryFunctionMap_[primaryFunc->name()];
+ NodeList::ConstIterator s = overloads.constBegin();
+ while (s != overloads.constEnd()) {
+ FunctionNode *overloadFunc = (FunctionNode *) *s;
+ if (!overloadFunc->isOverload()) {
+ if (overloadFunc->status() == Active && overloadFunc->access() != Private) {
+ primaryFunc->setOverloadNumber(overloadFunc->overloadNumber());
+ overloads.replace(overloads.indexOf(overloadFunc), primaryFunc);
+ *p = overloadFunc;
+ overloadFunc->setOverloadFlag(false);
+ overloadFunc->setOverloadNumber(0);
+ break;
+ }
+ }
+ ++s;
+ }
}
}
++p;
}
-
+ /*
+ Recursive part.
+ */
NodeList::ConstIterator c = childNodes().constBegin();
while (c != childNodes().constEnd()) {
- if ((*c)->isInnerNode())
- ((InnerNode *) *c)->normalizeOverloads();
+ if ((*c)->isAggregate())
+ ((Aggregate *) *c)->normalizeOverloads();
++c;
}
}
/*!
*/
-void InnerNode::removeFromRelated()
+void Aggregate::removeFromRelated()
{
while (!related_.isEmpty()) {
Node *p = static_cast<Node *>(related_.takeFirst());
@@ -971,13 +1060,13 @@ void InnerNode::removeFromRelated()
/*!
Deletes all this node's children.
*/
-void InnerNode::deleteChildren()
+void Aggregate::deleteChildren()
{
NodeList childrenCopy = children_; // `children_` will be changed in ~Node()
qDeleteAll(childrenCopy);
}
-/*! \fn bool InnerNode::isInnerNode() const
+/*! \fn bool Aggregate::isAggregate() const
Returns \c true because this is an inner node.
*/
@@ -997,7 +1086,7 @@ bool Node::isWrapper() const
no enum type node is found that has \a enumValue as one
of its values.
*/
-const EnumNode *InnerNode::findEnumNodeForValue(const QString &enumValue) const
+const EnumNode *Aggregate::findEnumNodeForValue(const QString &enumValue) const
{
foreach (const Node *node, enumChildren_) {
const EnumNode *en = static_cast<const EnumNode *>(node);
@@ -1008,32 +1097,16 @@ const EnumNode *InnerNode::findEnumNodeForValue(const QString &enumValue) const
}
/*!
- Returnds the sequence number of the function node \a func
- in the list of overloaded functions for a class, such that
- all the functions have the same name as the \a func.
- */
-int InnerNode::overloadNumber(const FunctionNode *func) const
-{
- Node *node = const_cast<FunctionNode *>(func);
- if (primaryFunctionMap[func->name()] == node) {
- return 1;
- }
- else {
- return secondaryFunctionMap[func->name()].indexOf(node) + 2;
- }
-}
-
-/*!
Returns a node list containing all the member functions of
some class such that the functions overload the name \a funcName.
*/
-NodeList InnerNode::overloads(const QString &funcName) const
+NodeList Aggregate::overloads(const QString &funcName) const
{
NodeList result;
- Node *primary = primaryFunctionMap.value(funcName);
+ Node *primary = primaryFunctionMap_.value(funcName);
if (primary) {
result << primary;
- result += secondaryFunctionMap[funcName];
+ result += secondaryFunctionMap_[funcName];
}
return result;
}
@@ -1042,7 +1115,7 @@ NodeList InnerNode::overloads(const QString &funcName) const
Construct an inner node (i.e., not a leaf node) of the
given \a type and having the given \a parent and \a name.
*/
-InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
+Aggregate::Aggregate(NodeType type, Aggregate *parent, const QString& name)
: Node(type, parent, name)
{
switch (type) {
@@ -1059,7 +1132,7 @@ InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
/*!
Appends an \a include file to the list of include files.
*/
-void InnerNode::addInclude(const QString& include)
+void Aggregate::addInclude(const QString& include)
{
includes_.append(include);
}
@@ -1067,7 +1140,7 @@ void InnerNode::addInclude(const QString& include)
/*!
Sets the list of include files to \a includes.
*/
-void InnerNode::setIncludes(const QStringList& includes)
+void Aggregate::setIncludes(const QStringList& includes)
{
includes_ = includes;
}
@@ -1075,22 +1148,22 @@ void InnerNode::setIncludes(const QStringList& includes)
/*!
f1 is always the clone
*/
-bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
+bool Aggregate::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
{
- if (f1->parameters().count() != f2->parameters().count())
+ if (f1->parameters().size() != f2->parameters().size())
return false;
if (f1->isConst() != f2->isConst())
return false;
- QList<Parameter>::ConstIterator p1 = f1->parameters().constBegin();
- QList<Parameter>::ConstIterator p2 = f2->parameters().constBegin();
+ QVector<Parameter>::ConstIterator p1 = f1->parameters().constBegin();
+ QVector<Parameter>::ConstIterator p2 = f2->parameters().constBegin();
while (p2 != f2->parameters().constEnd()) {
if ((*p1).hasType() && (*p2).hasType()) {
if ((*p1).rightType() != (*p2).rightType())
return false;
- QString t1 = p1->leftType();
- QString t2 = p2->leftType();
+ QString t1 = p1->dataType();
+ QString t2 = p2->dataType();
if (t1.length() < t2.length())
qSwap(t1, t2);
@@ -1113,23 +1186,26 @@ bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
be necessary to update this node's internal collections and
the child's parent pointer and output subdirectory.
*/
-void InnerNode::addChild(Node *child)
+void Aggregate::addChild(Node *child)
{
children_.append(child);
if ((child->type() == Function) || (child->type() == QmlMethod)) {
- FunctionNode *func = (FunctionNode *) child;
- if (!primaryFunctionMap.contains(func->name())) {
- primaryFunctionMap.insert(func->name(), func);
+ FunctionNode *func = static_cast<FunctionNode*>(child);
+ QString name = func->name();
+ if (!primaryFunctionMap_.contains(name)) {
+ primaryFunctionMap_.insert(name, func);
+ func->setOverloadNumber(0);
}
else {
- NodeList &secs = secondaryFunctionMap[func->name()];
- secs.append(func);
+ NodeList &overloads = secondaryFunctionMap_[name];
+ overloads.append(func);
+ func->setOverloadNumber(overloads.size());
}
}
else {
if (child->type() == Enum)
enumChildren_.append(child);
- childMap.insertMulti(child->name(), child);
+ childMap_.insertMulti(child->name(), child);
}
if (child->parent() == 0) {
child->setParent(this);
@@ -1143,9 +1219,9 @@ void InnerNode::addChild(Node *child)
again, because it is presumed to already be there. We just
want to be able to find the child by its \a title.
*/
-void InnerNode::addChild(Node* child, const QString& title)
+void Aggregate::addChild(Node* child, const QString& title)
{
- childMap.insertMulti(title, child);
+ childMap_.insertMulti(title, child);
}
/*!
@@ -1154,40 +1230,38 @@ void InnerNode::addChild(Node* child, const QString& title)
pointer is set to 0, but its output subdirectory is not
changed.
*/
-void InnerNode::removeChild(Node *child)
+void Aggregate::removeChild(Node *child)
{
children_.removeAll(child);
enumChildren_.removeAll(child);
if (child->type() == Function) {
- QMap<QString, Node *>::Iterator prim =
- primaryFunctionMap.find(child->name());
- NodeList& secs = secondaryFunctionMap[child->name()];
- if (prim != primaryFunctionMap.end() && *prim == child) {
- if (secs.isEmpty()) {
- primaryFunctionMap.remove(child->name());
- }
- else {
- primaryFunctionMap.insert(child->name(), secs.takeFirst());
+ QMap<QString, Node *>::Iterator primary = primaryFunctionMap_.find(child->name());
+ NodeList& overloads = secondaryFunctionMap_[child->name()];
+ if (primary != primaryFunctionMap_.end() && *primary == child) {
+ primaryFunctionMap_.erase(primary);
+ if (!overloads.isEmpty()) {
+ FunctionNode* fn = static_cast<FunctionNode*>(overloads.takeFirst());
+ fn->setOverloadNumber(0);
+ primaryFunctionMap_.insert(child->name(), fn);
}
}
- else {
- secs.removeAll(child);
- }
+ else
+ overloads.removeAll(child);
}
- QMap<QString, Node *>::Iterator ent = childMap.find(child->name());
- while (ent != childMap.end() && ent.key() == child->name()) {
+ QMap<QString, Node *>::Iterator ent = childMap_.find(child->name());
+ while (ent != childMap_.end() && ent.key() == child->name()) {
if (*ent == child) {
- childMap.erase(ent);
+ childMap_.erase(ent);
break;
}
++ent;
}
if (child->title().isEmpty())
return;
- ent = childMap.find(child->title());
- while (ent != childMap.end() && ent.key() == child->title()) {
+ ent = childMap_.find(child->title());
+ while (ent != childMap_.end() && ent.key() == child->title()) {
if (*ent == child) {
- childMap.erase(ent);
+ childMap_.erase(ent);
break;
}
++ent;
@@ -1198,7 +1272,7 @@ void InnerNode::removeChild(Node *child)
/*!
Recursively sets the output subdirectory for children
*/
-void InnerNode::setOutputSubdirectory(const QString &t)
+void Aggregate::setOutputSubdirectory(const QString &t)
{
Node::setOutputSubdirectory(t);
for (int i = 0; i < childNodes().size(); ++i)
@@ -1260,17 +1334,56 @@ QString Node::physicalModuleName() const
}
/*!
+ Removes a node from the list of nodes related to this one.
+ If it is a function node, also remove from the primary/
+ secondary function maps.
*/
-void InnerNode::removeRelated(Node *pseudoChild)
+void Aggregate::removeRelated(Node *pseudoChild)
{
related_.removeAll(pseudoChild);
+
+ if (pseudoChild->isFunction()) {
+ QMap<QString, Node *>::Iterator p = primaryFunctionMap_.find(pseudoChild->name());
+ while (p != primaryFunctionMap_.end()) {
+ if (p.value() == pseudoChild) {
+ primaryFunctionMap_.erase(p);
+ break;
+ }
+ ++p;
+ }
+ NodeList& overloads = secondaryFunctionMap_[pseudoChild->name()];
+ overloads.removeAll(pseudoChild);
+ }
+}
+
+/*!
+ Adds \a pseudoChild to the list of nodes related to this one. Resolve a correct
+ overload number for a related non-member function.
+ */
+void Aggregate::addRelated(Node *pseudoChild)
+{
+ related_.append(pseudoChild);
+
+ if (pseudoChild->isFunction()) {
+ FunctionNode* fn = static_cast<FunctionNode*>(pseudoChild);
+ if (primaryFunctionMap_.contains(pseudoChild->name())) {
+ secondaryFunctionMap_[pseudoChild->name()].append(pseudoChild);
+ fn->setOverloadNumber(secondaryFunctionMap_[pseudoChild->name()].size());
+ fn->setOverloadFlag(true);
+ }
+ else {
+ primaryFunctionMap_.insert(pseudoChild->name(), pseudoChild);
+ fn->setOverloadNumber(0);
+ fn->setOverloadFlag(false);
+ }
+ }
}
/*!
If this node has a child that is a QML property named \a n,
return the pointer to that child.
*/
-QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n) const
+QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const
{
foreach (Node* child, childNodes()) {
if (child->type() == Node::QmlProperty) {
@@ -1291,7 +1404,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n) const
whose type (attached or normal property) matches \a attached,
return the pointer to that child.
*/
-QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) const
+QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n, bool attached) const
{
foreach (Node* child, childNodes()) {
if (child->type() == Node::QmlProperty) {
@@ -1311,7 +1424,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) cons
\class LeafNode
*/
-/*! \fn bool LeafNode::isInnerNode() const
+/*! \fn bool LeafNode::isAggregate() const
Returns \c false because this is a LeafNode.
*/
@@ -1319,7 +1432,7 @@ QmlPropertyNode* InnerNode::hasQmlProperty(const QString& n, bool attached) cons
Constructs a leaf node named \a name of the specified
\a type. The new leaf node becomes a child of \a parent.
*/
-LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
+LeafNode::LeafNode(NodeType type, Aggregate *parent, const QString& name)
: Node(type, parent, name)
{
switch (type) {
@@ -1346,7 +1459,7 @@ LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name)
documentation case where a \e{qmlproperty} command is used
to override the QML definition of a QML property.
*/
-LeafNode::LeafNode(InnerNode* parent, Type type, const QString& name)
+LeafNode::LeafNode(Aggregate* parent, NodeType type, const QString& name)
: Node(type, 0, name)
{
setParent(parent);
@@ -1374,8 +1487,8 @@ LeafNode::LeafNode(InnerNode* parent, Type type, const QString& name)
/*!
Constructs a namespace node.
*/
-NamespaceNode::NamespaceNode(InnerNode *parent, const QString& name)
- : InnerNode(Namespace, parent, name), seen_(false), tree_(0)
+NamespaceNode::NamespaceNode(Aggregate *parent, const QString& name)
+ : Aggregate(Namespace, parent, name), seen_(false), tree_(0)
{
setGenus(Node::CPP);
setPageType(ApiPage);
@@ -1389,8 +1502,8 @@ NamespaceNode::NamespaceNode(InnerNode *parent, const QString& name)
/*!
Constructs a class node. A class node will generate an API page.
*/
-ClassNode::ClassNode(InnerNode *parent, const QString& name)
- : InnerNode(Class, parent, name)
+ClassNode::ClassNode(Aggregate *parent, const QString& name)
+ : Aggregate(Class, parent, name)
{
abstract_ = false;
wrapper_ = false;
@@ -1584,8 +1697,8 @@ QmlTypeNode* ClassNode::findQmlBaseNode()
which specifies the type of DocumentNode. The page type for
the page index is set here.
*/
-DocumentNode::DocumentNode(InnerNode* parent, const QString& name, SubType subtype, Node::PageType ptype)
- : InnerNode(Document, parent, name), nodeSubtype_(subtype)
+DocumentNode::DocumentNode(Aggregate* parent, const QString& name, DocSubtype subtype, Node::PageType ptype)
+ : Aggregate(Document, parent, name), nodeSubtype_(subtype)
{
setGenus(Node::DOC);
switch (subtype) {
@@ -1618,7 +1731,7 @@ void DocumentNode::setTitle(const QString &title)
/*!
Returns the document node's full title, which is usually
- just title(), but for some SubType values is different
+ just title(), but for some DocSubtype values is different
from title()
*/
QString DocumentNode::fullTitle() const
@@ -1669,8 +1782,8 @@ QString DocumentNode::subTitle() const
The constructor for the node representing an enum type
has a \a parent class and an enum type \a name.
*/
-EnumNode::EnumNode(InnerNode *parent, const QString& name)
- : LeafNode(Enum, parent, name), ft(0)
+EnumNode::EnumNode(Aggregate *parent, const QString& name)
+ : LeafNode(Enum, parent, name), flagsType_(0)
{
setGenus(Node::CPP);
}
@@ -1680,8 +1793,8 @@ EnumNode::EnumNode(InnerNode *parent, const QString& name)
*/
void EnumNode::addItem(const EnumItem& item)
{
- itms.append(item);
- names.insert(item.name());
+ items_.append(item);
+ names_.insert(item.name());
}
/*!
@@ -1701,7 +1814,7 @@ Node::Access EnumNode::itemAccess(const QString &name) const
*/
QString EnumNode::itemValue(const QString &name) const
{
- foreach (const EnumItem &item, itms) {
+ foreach (const EnumItem &item, items_) {
if (item.name() == name)
return item.value();
}
@@ -1714,8 +1827,8 @@ QString EnumNode::itemValue(const QString &name) const
/*!
*/
-TypedefNode::TypedefNode(InnerNode *parent, const QString& name)
- : LeafNode(Typedef, parent, name), ae(0)
+TypedefNode::TypedefNode(Aggregate *parent, const QString& name)
+ : LeafNode(Typedef, parent, name), associatedEnum_(0)
{
setGenus(Node::CPP);
}
@@ -1724,7 +1837,7 @@ TypedefNode::TypedefNode(InnerNode *parent, const QString& name)
*/
void TypedefNode::setAssociatedEnum(const EnumNode *enume)
{
- ae = enume;
+ associatedEnum_ = enume;
}
/*!
@@ -1737,36 +1850,43 @@ void TypedefNode::setAssociatedEnum(const EnumNode *enume)
/*!
Constructs this parameter from the left and right types
- \a leftType and rightType, the parameter \a name, and the
+ \a dataType and rightType, the parameter \a name, and the
\a defaultValue. In practice, \a rightType is not used,
and I don't know what is was meant for.
*/
-Parameter::Parameter(const QString& leftType,
+Parameter::Parameter(const QString& dataType,
const QString& rightType,
const QString& name,
const QString& defaultValue)
- : lef(leftType), rig(rightType), nam(name), def(defaultValue)
+ : dataType_(dataType),
+ rightType_(rightType),
+ name_(name),
+ defaultValue_(defaultValue)
{
+ // nothing.
}
/*!
- The standard copy constructor copies the strings from \a p.
+ Standard copy constructor copies \p.
*/
Parameter::Parameter(const Parameter& p)
- : lef(p.lef), rig(p.rig), nam(p.nam), def(p.def)
+ : dataType_(p.dataType_),
+ rightType_(p.rightType_),
+ name_(p.name_),
+ defaultValue_(p.defaultValue_)
{
+ // nothing.
}
/*!
- Assigning Parameter \a p to this Parameter copies the
- strings across.
+ standard assignment operator assigns \p.
*/
Parameter& Parameter::operator=(const Parameter& p)
{
- lef = p.lef;
- rig = p.rig;
- nam = p.nam;
- def = p.def;
+ dataType_ = p.dataType_;
+ rightType_ = p.rightType_;
+ name_ = p.name_;
+ defaultValue_ = p.defaultValue_;
return *this;
}
@@ -1777,12 +1897,12 @@ Parameter& Parameter::operator=(const Parameter& p)
*/
QString Parameter::reconstruct(bool value) const
{
- QString p = lef + rig;
+ QString p = dataType_ + rightType_;
if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' ')))
p += QLatin1Char(' ');
- p += nam;
- if (value && !def.isEmpty())
- p += " = " + def;
+ p += name_;
+ if (value && !defaultValue_.isEmpty())
+ p += " = " + defaultValue_;
return p;
}
@@ -1794,19 +1914,21 @@ QString Parameter::reconstruct(bool value) const
/*!
Construct a function node for a C++ function. It's parent
is \a parent, and it's name is \a name.
+
+ Do not set overloadNumber_ in the initializer list because it
+ is set by addChild() in the Node base class.
*/
-FunctionNode::FunctionNode(InnerNode *parent, const QString& name)
+FunctionNode::FunctionNode(Aggregate *parent, const QString& name)
: LeafNode(Function, parent, name),
- met(Plain),
- vir(NonVirtual),
- con(false),
- sta(false),
- ove(false),
- reimp(false),
+ metaness_(Plain),
+ virtualness_(NonVirtual),
+ const_(false),
+ static_(false),
+ reimplemented_(false),
attached_(false),
privateSignal_(false),
- rf(0),
- ap(0)
+ overload_(false),
+ reimplementedFrom_(0)
{
setGenus(Node::CPP);
}
@@ -1815,19 +1937,21 @@ FunctionNode::FunctionNode(InnerNode *parent, const QString& name)
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.
+
+ Do not set overloadNumber_ in the initializer list because it
+ is set by addChild() in the Node base class.
*/
-FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bool attached)
+FunctionNode::FunctionNode(NodeType type, Aggregate *parent, const QString& name, bool attached)
: LeafNode(type, parent, name),
- met(Plain),
- vir(NonVirtual),
- con(false),
- sta(false),
- ove(false),
- reimp(false),
+ metaness_(Plain),
+ virtualness_(NonVirtual),
+ const_(false),
+ static_(false),
+ reimplemented_(false),
attached_(attached),
privateSignal_(false),
- rf(0),
- ap(0)
+ overload_(false),
+ reimplementedFrom_(0)
{
setGenus(Node::QML);
if (type == QmlMethod || type == QmlSignal) {
@@ -1843,32 +1967,33 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo
is PureVirtual, and if the parent() is a ClassNode, set the parent's
\e abstract flag to true.
*/
-void FunctionNode::setVirtualness(Virtualness virtualness)
+void FunctionNode::setVirtualness(Virtualness v)
{
- vir = virtualness;
- if ((virtualness == PureVirtual) && parent() &&
- (parent()->type() == Node::Class))
+ virtualness_ = v;
+ if ((v == PureVirtual) && parent() && (parent()->type() == Node::Class))
parent()->setAbstract(true);
}
-/*!
+/*! \fn void FunctionNode::setOverloadFlag(bool b)
+ Sets this function node's overload flag to \a b.
+ It does not set the overload number.
+ */
+
+/*! \fn void FunctionNode::setOverloadNumber(unsigned char n)
+ Sets this function node's overload number to \a n.
+ It does not set the overload flag.
*/
-void FunctionNode::setOverload(bool overlode)
-{
- parent()->setOverload(this, overlode);
- ove = overlode;
-}
/*!
- Sets the function node's reimplementation flag to \a r.
- When \a r is true, it is supposed to mean that this function
+ Sets the function node's reimplementation flag to \a b.
+ When \a b 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.
+ but it really just means the \e {\\reimp} command was seen in
+ the qdoc comment.
*/
-void FunctionNode::setReimp(bool r)
+void FunctionNode::setReimplemented(bool b)
{
- reimp = r;
+ reimplemented_ = b;
}
/*!
@@ -1876,16 +2001,16 @@ void FunctionNode::setReimp(bool r)
*/
void FunctionNode::addParameter(const Parameter& parameter)
{
- params.append(parameter);
+ parameters_.append(parameter);
}
/*!
*/
void FunctionNode::borrowParameterNames(const FunctionNode *source)
{
- QList<Parameter>::Iterator t = params.begin();
- QList<Parameter>::ConstIterator s = source->params.constBegin();
- while (s != source->params.constEnd() && t != params.end()) {
+ QVector<Parameter>::Iterator t = parameters_.begin();
+ QVector<Parameter>::ConstIterator s = source->parameters_.constBegin();
+ while (s != source->parameters_.constEnd() && t != parameters_.end()) {
if (!(*s).name().isEmpty())
(*t).setName((*s).name());
++s;
@@ -1897,37 +2022,49 @@ void FunctionNode::borrowParameterNames(const FunctionNode *source)
If this function is a reimplementation, \a from points
to the FunctionNode of the function being reimplemented.
*/
-void FunctionNode::setReimplementedFrom(FunctionNode *from)
+void FunctionNode::setReimplementedFrom(FunctionNode *f)
{
- rf = from;
- from->rb.append(this);
+ reimplementedFrom_ = f;
+ f->reimplementedBy_.append(this);
}
/*!
- Sets the "associated" property to \a property. The function
- might be the setter or getter for a property, for example.
+ Adds the "associated" property \a p to this function node.
+ The function might be the setter or getter for a property,
+ for example.
*/
-void FunctionNode::setAssociatedProperty(PropertyNode *property)
+void FunctionNode::addAssociatedProperty(PropertyNode *p)
{
- ap = property;
+ associatedProperties_.append(p);
}
/*!
- Returns the overload number for this function obtained
- from the parent.
+ Returns true if this function has at least one property
+ that is active, i.e. at least one property that is not
+ obsolete.
*/
-int FunctionNode::overloadNumber() const
+bool FunctionNode::hasActiveAssociatedProperty() const
{
- return parent()->overloadNumber(this);
+ if (associatedProperties_.isEmpty())
+ return false;
+ foreach (const PropertyNode* p, associatedProperties_) {
+ if (!p->isObsolete())
+ return true;
+ }
+ return false;
}
+/*! \fn unsigned char FunctionNode::overloadNumber() const
+ Returns the overload number for this function.
+ */
+
/*!
Returns the list of parameter names.
*/
QStringList FunctionNode::parameterNames() const
{
QStringList names;
- QList<Parameter>::ConstIterator p = parameters().constBegin();
+ QVector<Parameter>::ConstIterator p = parameters().constBegin();
while (p != parameters().constEnd()) {
names << (*p).name();
++p;
@@ -1944,7 +2081,7 @@ QString FunctionNode::rawParameters(bool names, bool values) const
{
QString raw;
foreach (const Parameter &parameter, parameters()) {
- raw += parameter.leftType() + parameter.rightType();
+ raw += parameter.dataType() + parameter.rightType();
if (names)
raw += parameter.name();
if (values)
@@ -1957,15 +2094,15 @@ QString FunctionNode::rawParameters(bool names, bool values) const
Returns the list of reconstructed parameters. If \a values
is true, the default values are included, if any are present.
*/
-QStringList FunctionNode::reconstructParams(bool values) const
+QStringList FunctionNode::reconstructParameters(bool values) const
{
- QStringList params;
- QList<Parameter>::ConstIterator p = parameters().constBegin();
+ QStringList reconstructedParameters;
+ QVector<Parameter>::ConstIterator p = parameters().constBegin();
while (p != parameters().constEnd()) {
- params << (*p).reconstruct(values);
+ reconstructedParameters << (*p).reconstruct(values);
++p;
}
- return params;
+ return reconstructedParameters;
}
/*!
@@ -1979,11 +2116,11 @@ QString FunctionNode::signature(bool values) const
if (!returnType().isEmpty())
s = returnType() + QLatin1Char(' ');
s += name() + QLatin1Char('(');
- QStringList params = reconstructParams(values);
- int p = params.size();
+ QStringList reconstructedParameters = reconstructParameters(values);
+ int p = reconstructedParameters.size();
if (p > 0) {
for (int i=0; i<p; i++) {
- s += params[i];
+ s += reconstructedParameters[i];
if (i < (p-1))
s += ", ";
}
@@ -1993,12 +2130,25 @@ QString FunctionNode::signature(bool values) const
}
/*!
+ Returns true if function \a fn has role \a r for this
+ property.
+ */
+PropertyNode::FunctionRole PropertyNode::role(const FunctionNode* fn) const
+{
+ for (int i=0; i<4; i++) {
+ if (functions_[i].contains(const_cast<FunctionNode*>(fn)))
+ return (FunctionRole) i;
+ }
+ return Notifier;
+}
+
+/*!
Print some debugging stuff.
*/
void FunctionNode::debug() const
{
- qDebug("QML METHOD %s rt %s pp %s",
- qPrintable(name()), qPrintable(rt), qPrintable(pp.join(' ')));
+ qDebug("QML METHOD %s returnType_ %s parentPath_ %s",
+ qPrintable(name()), qPrintable(returnType_), qPrintable(parentPath_.join(' ')));
}
/*!
@@ -2011,17 +2161,17 @@ void FunctionNode::debug() const
The constructor sets the \a parent and the \a name, but
everything else is set to default values.
*/
-PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
+PropertyNode::PropertyNode(Aggregate *parent, const QString& name)
: LeafNode(Property, parent, name),
stored_(FlagValueDefault),
designable_(FlagValueDefault),
scriptable_(FlagValueDefault),
writable_(FlagValueDefault),
user_(FlagValueDefault),
- cst(false),
- fnl(false),
- rev(-1),
- overrides(0)
+ const_(false),
+ final_(false),
+ revision_(-1),
+ overrides_(0)
{
setGenus(Node::CPP);
}
@@ -2039,8 +2189,8 @@ PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
{
for (int i = 0; i < NumFunctionRoles; ++i) {
- if (funcs[i].isEmpty())
- funcs[i] = baseProperty->funcs[i];
+ if (functions_[i].isEmpty())
+ functions_[i] = baseProperty->functions_[i];
}
if (stored_ == FlagValueDefault)
stored_ = baseProperty->stored_;
@@ -2052,7 +2202,7 @@ void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
writable_ = baseProperty->writable_;
if (user_ == FlagValueDefault)
user_ = baseProperty->user_;
- overrides = baseProperty;
+ overrides_ = baseProperty;
}
/*!
@@ -2084,8 +2234,8 @@ QMultiMap<QString,Node*> QmlTypeNode::inheritedBy;
Constructs a Qml class node. The new node has the given
\a parent and \a name.
*/
-QmlTypeNode::QmlTypeNode(InnerNode *parent, const QString& name)
- : InnerNode(QmlType, parent, name),
+QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString& name)
+ : Aggregate(QmlType, parent, name),
abstract_(false),
cnodeRequired_(false),
wrapper_(false),
@@ -2199,9 +2349,9 @@ QString QmlTypeNode::logicalModuleIdentifier() const
Constructs a Qml basic type node. The new node has the given
\a parent and \a name.
*/
-QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
+QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent,
const QString& name)
- : InnerNode(QmlBasicType, parent, name)
+ : Aggregate(QmlBasicType, parent, name)
{
setTitle(name);
setGenus(Node::QML);
@@ -2212,7 +2362,7 @@ QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
always a QmlTypeNode.
*/
QmlPropertyGroupNode::QmlPropertyGroupNode(QmlTypeNode* parent, const QString& name)
- : InnerNode(QmlPropertyGroup, parent, name)
+ : Aggregate(QmlPropertyGroup, parent, name)
{
idNumber_ = -1;
setGenus(Node::QML);
@@ -2235,7 +2385,7 @@ QString QmlPropertyGroupNode::idNumber()
/*!
Constructor for the QML property node.
*/
-QmlPropertyNode::QmlPropertyNode(InnerNode* parent,
+QmlPropertyNode::QmlPropertyNode(Aggregate* parent,
const QString& name,
const QString& type,
bool attached)
@@ -2281,16 +2431,16 @@ bool QmlPropertyNode::isWritable()
if (pn)
return pn->isWritable();
else
- location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(property not found in the C++ class or its base classes)")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
+ defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(property not found in the C++ class or its base classes)")
+ .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
}
else
- location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(C++ class not specified or not found).")
- .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
+ defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(C++ class not specified or not found).")
+ .arg(logicalModuleName()).arg(qmlTypeName()).arg(name()));
}
}
return true;
@@ -2477,6 +2627,7 @@ QString Node::cleanId(const QString &str)
return clean;
}
+#if 0
/*!
Creates a string that can be used as a UUID for the node,
depending on the type and subtype of the node. Uniquenss
@@ -2574,14 +2725,14 @@ QString Node::idForNode() const
str = "js-method-" + parent_->name().toLower() + "-" + func->name();
else if (parent_->type() == Document) {
qDebug() << "qdoc internal error: Node subtype not handled:"
- << parent_->subType() << func->name();
+ << parent_->docSubtype() << func->name();
}
else
qDebug() << "qdoc internal error: Node type not handled:"
<< parent_->type() << func->name();
}
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
str += QLatin1Char('-') + QString::number(func->overloadNumber());
}
break;
@@ -2599,7 +2750,7 @@ QString Node::idForNode() const
break;
case Node::Document:
{
- switch (subType()) {
+ switch (docSubtype()) {
case Node::Page:
case Node::HeaderFile:
str = title();
@@ -2620,7 +2771,7 @@ QString Node::idForNode() const
break;
default:
qDebug() << "ERROR: A case was not handled in Node::idForNode():"
- << "subType():" << subType() << "type():" << type();
+ << "docSubtype():" << docSubtype() << "type():" << type();
break;
}
}
@@ -2682,7 +2833,7 @@ QString Node::idForNode() const
else
str = "js-method-";
str += parent_->name().toLower() + "-" + func->name();
- if (func->overloadNumber() != 1)
+ if (func->overloadNumber() != 0)
str += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
@@ -2690,12 +2841,12 @@ QString Node::idForNode() const
break;
default:
qDebug() << "ERROR: A case was not handled in Node::idForNode():"
- << "type():" << type() << "subType():" << subType();
+ << "type():" << type() << "docSubtype():" << docSubtype();
break;
}
if (str.isEmpty()) {
qDebug() << "ERROR: A link text was empty in Node::idForNode():"
- << "type():" << type() << "subType():" << subType()
+ << "type():" << type() << "docSubtype():" << docSubtype()
<< "name():" << name()
<< "title():" << title();
}
@@ -2704,12 +2855,13 @@ QString Node::idForNode() const
}
return str;
}
+#endif
/*!
Prints the inner node's list of children.
For debugging only.
*/
-void InnerNode::printChildren(const QString& title)
+void Aggregate::printChildren(const QString& title)
{
qDebug() << title << name() << children_.size();
if (children_.size() > 0) {
@@ -2792,7 +2944,7 @@ void CollectionNode::getMemberNamespaces(NodeMap& out)
Loads \a out with all this collection node's members that
are class nodes.
*/
-void CollectionNode::getMemberClasses(NodeMap& out)
+void CollectionNode::getMemberClasses(NodeMap& out) const
{
out.clear();
NodeList::const_iterator i = members_.cbegin();