diff options
author | Martin Smith <martin.smith@theqtcompany.com> | 2016-02-22 15:39:02 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@theqtcompany.com> | 2016-02-26 12:06:03 +0000 |
commit | 184c8f82a0b2e7ed8d307c796a5ba92b66723abe (patch) | |
tree | fbecd7a0baf44b2b0b3b9e29a7418870170a9910 /src | |
parent | 8237d6d1171d7d7d677eada7d49ab7b5d85b09e7 (diff) | |
download | qttools-184c8f82a0b2e7ed8d307c796a5ba92b66723abe.tar.gz |
qdoc: Avoid more unnecessary qdoc warnings
Now avoids qdoc warnings for undocumented copy-assignment
operators and move-assignment operators. This update also
improves the text output by surrounding it with <p> and </p>.
There was also a bit of refactoring.
Change-Id: I922c7083d17b9b911d81f818f51fe7623a78eb22
Task-number: QTBUG-50630
Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qdoc/codemarker.cpp | 3 | ||||
-rw-r--r-- | src/qdoc/cppcodemarker.cpp | 18 | ||||
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 69 | ||||
-rw-r--r-- | src/qdoc/cppcodeparser.h | 2 | ||||
-rw-r--r-- | src/qdoc/generator.cpp | 26 | ||||
-rw-r--r-- | src/qdoc/node.cpp | 130 | ||||
-rw-r--r-- | src/qdoc/node.h | 52 | ||||
-rw-r--r-- | src/qdoc/qdocindexfiles.cpp | 89 | ||||
-rw-r--r-- | src/qdoc/qdoctagfiles.cpp | 19 | ||||
-rw-r--r-- | src/qdoc/tree.cpp | 8 |
10 files changed, 230 insertions, 186 deletions
diff --git a/src/qdoc/codemarker.cpp b/src/qdoc/codemarker.cpp index 99b9a47c3..366d2d8d2 100644 --- a/src/qdoc/codemarker.cpp +++ b/src/qdoc/codemarker.cpp @@ -597,8 +597,7 @@ QStringList CodeMarker::macRefsForNode(Node *node) if (func->isOverload()) return QStringList(); - if (func->metaness() == FunctionNode::MacroWithParams - || func->metaness() == FunctionNode::MacroWithoutParams) { + if (func->isMacro()) { result += QLatin1String("macro/"); } else if (func->isStatic()) { diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index 23ac9df93..eb88346dc 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -154,7 +154,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, if (style != Subpage && !func->returnType().isEmpty()) synopsis = typified(func->returnType(), true); synopsis += name; - if (func->metaness() != FunctionNode::MacroWithoutParams) { + if (!func->isMacroWithoutParams()) { synopsis += QLatin1Char('('); if (!func->parameters().isEmpty()) { QVector<Parameter>::ConstIterator p = func->parameters().constBegin(); @@ -177,11 +177,11 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis += " const"; if (style == Summary || style == Accessors) { - if (func->virtualness() != FunctionNode::NonVirtual) + if (!func->isNonvirtual()) synopsis.prepend("virtual "); if (func->isFinal()) synopsis.append(" final"); - if (func->virtualness() == FunctionNode::PureVirtual) + if (func->isPureVirtual()) synopsis.append(" = 0"); else if (func->isDeleted()) synopsis.append(" = delete"); @@ -200,10 +200,10 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, bracketed += "delete"; } else if (func->isDefaulted()) { bracketed += "default"; - } else if (func->virtualness() != FunctionNode::NonVirtual) { + } else if (!func->isNonvirtual()) { if (func->isFinal()) bracketed += "final"; - if (func->virtualness() == FunctionNode::PureVirtual) + if (func->isPureVirtual()) bracketed += "pure"; bracketed += "virtual"; } @@ -215,10 +215,10 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, bracketed += "private"; } - if (func->metaness() == FunctionNode::Signal) { + if (func->isSignal()) { bracketed += "signal"; } - else if (func->metaness() == FunctionNode::Slot) { + else if (func->isSlot()) { bracketed += "slot"; } if (!bracketed.isEmpty()) @@ -541,8 +541,8 @@ QList<Section> CppCodeMarker::sections(const Aggregate *inner, bool isStatic = false; if ((*c)->type() == Node::Function) { const FunctionNode *func = (const FunctionNode *) *c; - isSlot = (func->metaness() == FunctionNode::Slot); - isSignal = (func->metaness() == FunctionNode::Signal); + isSlot = (func->isSlot()); + isSignal = (func->isSignal()); isStatic = func->isStatic(); if (func->hasAssociatedProperties() && !func->hasActiveAssociatedProperty()) { ++c; diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 8e5d279e1..0ea135cce 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -375,7 +375,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, func = 0; } else { - func->setMetaness(Node::MacroWithParams); + func->setMetaness(FunctionNode::MacroWithParams); QVector<Parameter> params = func->parameters(); for (int i = 0; i < params.size(); ++i) { Parameter ¶m = params[i]; @@ -391,7 +391,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, func = new FunctionNode(qdb_->primaryTreeRoot(), arg.first); func->setAccess(Node::Public); func->setLocation(doc.startLocation()); - func->setMetaness(Node::MacroWithoutParams); + func->setMetaness(FunctionNode::MacroWithoutParams); } else { doc.location().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_MACRO)); @@ -1050,7 +1050,7 @@ void CppCodeParser::reset() tokenizer = 0; tok = 0; access = Node::Public; - metaness_ = Node::Plain; + metaness_ = FunctionNode::Plain; lastPath_.clear(); physicalModuleName.clear(); } @@ -1651,20 +1651,41 @@ bool CppCodeParser::matchFunctionDecl(Aggregate *parent, func->setParameters(pvect); } func->setMetaness(metaness_); - if (parent) { - if (name == parent->name()) { - Node::Metaness m = Node::Ctor; - if (!pvect.isEmpty()) { - for (int i=0; i<pvect.size(); i++) { - m = pvect.at(i).metaness(name); - if (m != Node::Ctor) + if (parent && (name == parent->name())) { + FunctionNode::Metaness m = FunctionNode::Ctor; + if (!pvect.isEmpty()) { + for (int i=0; i<pvect.size(); i++) { + const Parameter& p = pvect.at(i); + if (p.dataType().contains(name)) { + if (p.dataType().endsWith(QLatin1String("&&"))) { + m = FunctionNode::MCtor; break; + } + if (p.dataType().endsWith(QLatin1String("&"))) { + m = FunctionNode::CCtor; + break; + } + } + } + } + func->setMetaness(m); + } + else if (name.startsWith(QLatin1Char('~'))) + func->setMetaness(FunctionNode::Dtor); + else if (name == QLatin1String("operator=")) { + FunctionNode::Metaness m = FunctionNode::Plain; + if (parent && pvect.size() == 1) { + const Parameter& p = pvect.at(0); + if (p.dataType().contains(parent->name())) { + if (p.dataType().endsWith(QLatin1String("&&"))) { + m = FunctionNode::MAssign; + } + else if (p.dataType().endsWith(QLatin1String("&"))) { + m = FunctionNode::CAssign; } } - func->setMetaness(m); } - else if (name.startsWith(QLatin1Char('~'))) - func->setMetaness(Node::Dtor); + func->setMetaness(m); } func->setStatic(matched_static); func->setConst(matchedConst); @@ -1783,8 +1804,8 @@ bool CppCodeParser::matchClassDecl(Aggregate *parent, Node::Access outerAccess = access; access = isClass ? Node::Private : Node::Public; - Node::Metaness outerMetaness = metaness_; - metaness_ = Node::Plain; + FunctionNode::Metaness outerMetaness = metaness_; + metaness_ = FunctionNode::Plain; bool matches = (matchDeclList(classe) && match(Tok_RightBrace) && match(Tok_Semicolon)); @@ -2165,28 +2186,28 @@ bool CppCodeParser::matchDeclList(Aggregate *parent) case Tok_private: readToken(); access = Node::Private; - metaness_ = Node::Plain; + metaness_ = FunctionNode::Plain; break; case Tok_protected: readToken(); access = Node::Protected; - metaness_ = Node::Plain; + metaness_ = FunctionNode::Plain; break; case Tok_public: readToken(); access = Node::Public; - metaness_ = Node::Plain; + metaness_ = FunctionNode::Plain; break; case Tok_signals: case Tok_Q_SIGNALS: readToken(); access = Node::Public; - metaness_ = Node::Signal; + metaness_ = FunctionNode::Signal; break; case Tok_slots: case Tok_Q_SLOTS: readToken(); - metaness_ = Node::Slot; + metaness_ = FunctionNode::Slot; break; case Tok_Q_OBJECT: readToken(); @@ -2407,7 +2428,7 @@ bool CppCodeParser::matchDocsAndStuff() else { QStringList parentPath; FunctionNode *clone; - FunctionNode *node = 0; + FunctionNode *fnode = 0; if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { /* @@ -2419,9 +2440,9 @@ bool CppCodeParser::matchDocsAndStuff() Signals are implemented in uninteresting files generated by moc. */ - node = qdb_->findFunctionNode(parentPath, clone); - if (node != 0 && node->metaness() != Node::Signal) - node->setLocation(clone->location()); + fnode = qdb_->findFunctionNode(parentPath, clone); + if (fnode != 0 && !fnode->isSignal()) + fnode->setLocation(clone->location()); delete clone; } else { diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h index 4ef8f9e50..7c110d2bb 100644 --- a/src/qdoc/cppcodeparser.h +++ b/src/qdoc/cppcodeparser.h @@ -158,7 +158,7 @@ protected: Tokenizer *tokenizer; int tok; Node::Access access; - Node::Metaness metaness_; + FunctionNode::Metaness metaness_; QString physicalModuleName; QStringList lastPath_; QRegExp varComment; diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 460be6454..0765e8ab7 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -564,7 +564,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir) { const FunctionNode *fn = static_cast<const FunctionNode *>(node); - if (fn->metaness() == FunctionNode::Dtor) + if (fn->isDtor()) anchorRef = "#dtor." + fn->name().mid(1); else if (fn->hasOneAssociatedProperty() && fn->doc().isEmpty()) @@ -764,23 +764,45 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) text << func->parent()->name() << "."; if (func->isVirtual()) text << " The destructor is virtual."; + out() << "<p>"; generateText(text, node, marker); + out() << "</p>"; } else if (func->isCtor()) { Text text; text << "Default constructs an instance of "; text << func->parent()->name() << "."; + out() << "<p>"; generateText(text, node, marker); + out() << "</p>"; } else if (func->isCCtor()) { Text text; text << "Copy constructor."; + out() << "<p>"; generateText(text, node, marker); + out() << "</p>"; } else if (func->isMCtor()) { Text text; text << "Move-copy constructor."; + out() << "<p>"; generateText(text, node, marker); + out() << "</p>"; + } + else if (func->isCAssign()) { + Text text; + text << "Copy-assignment operator."; + out() << "<p>"; + generateText(text, node, marker); + out() << "</p>"; + } + else if (func->isMAssign()) { + Text text; + text << "Move-assignment operator."; + out() << "<p>"; + generateText(text, node, marker); + out() << "</p>"; } else if (!node->isWrapper() && !quiet && !node->isReimplemented()) { node->location().warning(tr("No documentation for '%1'").arg(node->plainSignature())); @@ -1518,7 +1540,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) if (node->type() != Node::Function) return; const FunctionNode *func = static_cast<const FunctionNode *>(node); - if (func->metaness() != FunctionNode::Signal) + if (!func->isSignal()) return; if (node->parent()->overloads(node->name()).count() <= 1) return; diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp index e8b293011..fe9d3527f 100644 --- a/src/qdoc/node.cpp +++ b/src/qdoc/node.cpp @@ -1953,22 +1953,6 @@ QString Parameter::reconstruct(bool value) const } /*! - Returns the appropriate metaness value based on the parameter - type. The parameter type must contain the \a name and must end - with either \c{&&} or \c{&}. - */ -Node::Metaness Parameter::metaness(const QString& name) const -{ - if (dataType_.contains(name)) { - if (dataType_.endsWith(QLatin1String("&&"))) - return FunctionNode::MCtor; - if (dataType_.endsWith(QLatin1String("&"))) - return FunctionNode::CCtor; - } - return FunctionNode::Ctor; -} - -/*! \class FunctionNode */ @@ -2030,15 +2014,78 @@ FunctionNode::FunctionNode(NodeType type, Aggregate *parent, const QString& name } /*! - Sets the \a virtualness of this function. If the \a virtualness - is PureVirtual, and if the parent() is a ClassNode, set the parent's - \e abstract flag to true. + Returns this function's virtualness value as a string + for use as an attribute value in index files. */ -void FunctionNode::setVirtualness(Virtualness v) +QString FunctionNode::virtualness() const { - virtualness_ = v; - if ((v == PureVirtual) && parent() && (parent()->type() == Node::Class)) - parent()->setAbstract(true); + switch (virtualness_) { + case FunctionNode::NormalVirtual: + return "virtual"; + case FunctionNode::PureVirtual: + return "pure"; + case FunctionNode::NonVirtual: + default: + break; + } + return "non"; +} + +/*! + Sets the function node's virtualness value based on the value + of string \a t, which is the value of the function's \e{virtual} + attribute in an index file. If \a t is \e{pure}, and if the + parent() is a C++ class, set the parent's \e abstract flag to + \c {true}. + */ +void FunctionNode::setVirtualness(const QString& t) +{ + if (t == QLatin1String("non")) + virtualness_ = NonVirtual; + else if (t == QLatin1String("virtual")) + virtualness_ = NormalVirtual; + else if (t == QLatin1String("pure")) { + virtualness_ = PureVirtual; + if (parent() && parent()->isClass()) + parent()->setAbstract(true); + } +} + +/*! + Sets the function node's Metaness value based on the value + of string \a t, which is the value of the function's "meta" + attribute in an index file. + */ +void FunctionNode::setMetaness(const QString& t) +{ + if (t == QLatin1String("plain")) + metaness_ = Plain; + else if (t == QLatin1String("signal")) + metaness_ = Signal; + else if (t == QLatin1String("slot")) + metaness_ = Slot; + else if (t == QLatin1String("constructor")) + metaness_ = Ctor; + else if (t == QLatin1String("copy-constructor")) + metaness_ = CCtor; + else if (t == QLatin1String("move-constructor")) + metaness_ = MCtor; + else if (t == QLatin1String("destructor")) + metaness_ = Dtor; + else if (t == QLatin1String("macro")) + metaness_ = MacroWithParams; + else if (t == QLatin1String("macrowithparams")) + metaness_ = MacroWithParams; + else if (t == QLatin1String("macrowithoutparams")) + metaness_ = MacroWithoutParams; + else if (t == QLatin1String("copy-assign")) + metaness_ = CAssign; + else if (t == QLatin1String("move-assign")) + metaness_ = MAssign; + else if (t == QLatin1String("native")) + metaness_ = Native; + else + metaness_ = Plain; } /*! \fn void FunctionNode::setOverloadFlag(bool b) @@ -2064,6 +2111,43 @@ void FunctionNode::setReimplemented(bool b) } /*! + Returns a string representing the Metaness enum value for + this function. It is used in index files. + */ +QString FunctionNode::metaness() const +{ + switch (metaness_) { + case FunctionNode::Plain: + return "plain"; + case FunctionNode::Signal: + return "signal"; + case FunctionNode::Slot: + return "slot"; + case FunctionNode::Ctor: + return "constructor"; + case FunctionNode::CCtor: + return "copy-constructor"; + case FunctionNode::MCtor: + return "move-constructor"; + case FunctionNode::Dtor: + return "destructor"; + case FunctionNode::MacroWithParams: + return "macrowithparams"; + case FunctionNode::MacroWithoutParams: + return "macrowithoutparams"; + case FunctionNode::Native: + return "native"; + case FunctionNode::CAssign: + return "copy-assign"; + case FunctionNode::MAssign: + return "move-assign"; + default: + return "plain"; + } + return QString(); +} + +/*! Append \a parameter to the parameter list. */ void FunctionNode::addParameter(const Parameter& parameter) diff --git a/src/qdoc/node.h b/src/qdoc/node.h index 481383157..2b208d48f 100644 --- a/src/qdoc/node.h +++ b/src/qdoc/node.h @@ -155,19 +155,6 @@ public: FlagValueTrue = 1 }; - enum Metaness { - Plain, - Signal, - Slot, - Ctor, - Dtor, - CCtor, - MCtor, - MacroWithParams, - MacroWithoutParams, - Native - }; - virtual ~Node(); QString plainName() const; @@ -851,7 +838,6 @@ public: void setName(const QString& name) { name_ = name; } bool hasType() const { return dataType_.length() + rightType_.length() > 0; } - Node::Metaness metaness(const QString& name) const; const QString& dataType() const { return dataType_; } const QString& rightType() const { return rightType_; } const QString& name() const { return name_; } @@ -874,6 +860,21 @@ class FunctionNode : public LeafNode public: enum Virtualness { NonVirtual, NormalVirtual, PureVirtual }; + enum Metaness { + Plain, + Signal, + Slot, + Ctor, + Dtor, + CCtor, // copy constructor + MCtor, // move-copy constructor + MacroWithParams, + MacroWithoutParams, + Native, + CAssign, // copy-assignment operator + MAssign // move-assignment operator + }; + FunctionNode(Aggregate* parent, const QString &name); FunctionNode(NodeType type, Aggregate* parent, const QString &name, bool attached); virtual ~FunctionNode() { } @@ -881,7 +882,10 @@ public: void setReturnType(const QString& t) { returnType_ = t; } void setParentPath(const QStringList& p) { parentPath_ = p; } void setMetaness(Metaness t) { metaness_ = t; } - void setVirtualness(Virtualness v); + void setMetaness(const QString& t); + void setVirtualness(const QString& t); + void setVirtualness(Virtualness v) { virtualness_ = v; } + void setVirtual() { virtualness_ = NormalVirtual; } void setConst(bool b) { const_ = b; } void setStatic(bool b) { static_ = b; } unsigned char overloadNumber() const { return overloadNumber_; } @@ -894,22 +898,28 @@ public: void setReimplementedFrom(FunctionNode* from); const QString& returnType() const { return returnType_; } - Metaness metaness() const { return metaness_; } - bool isMacro() const { - return metaness_ == MacroWithParams || metaness_ == MacroWithoutParams; - } - Virtualness virtualness() const { return virtualness_; } + QString metaness() const; + QString virtualness() const; bool isConst() const { return const_; } bool isStatic() const { return static_; } bool isOverload() const { return overload_; } bool isReimplemented() const Q_DECL_OVERRIDE { return reimplemented_; } bool isFunction() const Q_DECL_OVERRIDE { return true; } bool isSomeCtor() const { return isCtor() || isCCtor() || isMCtor(); } + bool isMacroWithParams() const { return (metaness_ == MacroWithParams); } + bool isMacroWithoutParams() const { return (metaness_ == MacroWithoutParams); } + bool isMacro() const { return (isMacroWithParams() || isMacroWithoutParams()); } + bool isSignal() const { return (metaness_ == Signal); } + bool isSlot() const { return (metaness_ == Slot); } bool isCtor() const { return (metaness_ == Ctor); } - bool isCCtor() const { return (metaness_ == CCtor); } bool isDtor() const { return (metaness_ == Dtor); } + bool isCCtor() const { return (metaness_ == CCtor); } bool isMCtor() const { return (metaness_ == MCtor); } + bool isCAssign() const { return (metaness_ == CAssign); } + bool isMAssign() const { return (metaness_ == MAssign); } + bool isNonvirtual() const { return (virtualness_ == NonVirtual); } bool isVirtual() const { return (virtualness_ == NormalVirtual); } + bool isPureVirtual() const { return (virtualness_ == PureVirtual); } virtual bool isQmlSignal() const Q_DECL_OVERRIDE { return (type() == Node::QmlSignal) && (genus() == Node::QML); } diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp index ef2c014e9..c8439d39d 100644 --- a/src/qdoc/qdocindexfiles.cpp +++ b/src/qdoc/qdocindexfiles.cpp @@ -485,46 +485,10 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, } else if (elementName == QLatin1String("function")) { - FunctionNode::Virtualness virt; - QString t = attributes.value(QLatin1String("virtual")).toString(); - if (t == QLatin1String("non")) - virt = FunctionNode::NonVirtual; - else if (t == QLatin1String("virtual")) - virt = FunctionNode::NormalVirtual; - else if (t == QLatin1String("pure")) - virt = FunctionNode::PureVirtual; - else - goto done; - - t = attributes.value(QLatin1String("meta")).toString(); - Node::Metaness meta; - if (t == QLatin1String("plain")) - meta = Node::Plain; - else if (t == QLatin1String("signal")) - meta = Node::Signal; - else if (t == QLatin1String("slot")) - meta = Node::Slot; - else if (t == QLatin1String("constructor")) - meta = Node::Ctor; - else if (t == QLatin1String("copy-constructor")) - meta = Node::CCtor; - else if (t == QLatin1String("move-constructor")) - meta = Node::MCtor; - else if (t == QLatin1String("destructor")) - meta = Node::Dtor; - else if (t == QLatin1String("macro")) - meta = Node::MacroWithParams; - else if (t == QLatin1String("macrowithparams")) - meta = Node::MacroWithParams; - else if (t == QLatin1String("macrowithoutparams")) - meta = Node::MacroWithoutParams; - else - goto done; - FunctionNode* functionNode = new FunctionNode(parent, name); functionNode->setReturnType(attributes.value(QLatin1String("return")).toString()); - functionNode->setVirtualness(virt); - functionNode->setMetaness(meta); + functionNode->setVirtualness(attributes.value(QLatin1String("virtual")).toString()); + functionNode->setMetaness(attributes.value(QLatin1String("meta")).toString()); functionNode->setConst(attributes.value(QLatin1String("const")) == QLatin1String("true")); functionNode->setStatic(attributes.value(QLatin1String("static")) == QLatin1String("true")); functionNode->setIsDeleted(attributes.value(QLatin1String("delete")) == QLatin1String("true")); @@ -1210,51 +1174,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, function being described. */ const FunctionNode* functionNode = static_cast<const FunctionNode*>(node); - switch (functionNode->virtualness()) { - case FunctionNode::NonVirtual: - writer.writeAttribute("virtual", "non"); - break; - case FunctionNode::NormalVirtual: - writer.writeAttribute("virtual", "virtual"); - break; - case FunctionNode::PureVirtual: - writer.writeAttribute("virtual", "pure"); - break; - default: - break; - } - - switch (functionNode->metaness()) { - case Node::Plain: - writer.writeAttribute("meta", "plain"); - break; - case Node::Signal: - writer.writeAttribute("meta", "signal"); - break; - case Node::Slot: - writer.writeAttribute("meta", "slot"); - break; - case Node::Ctor: - writer.writeAttribute("meta", "constructor"); - break; - case Node::CCtor: - writer.writeAttribute("meta", "copy-constructor"); - break; - case Node::MCtor: - writer.writeAttribute("meta", "move-constructor"); - break; - case Node::Dtor: - writer.writeAttribute("meta", "destructor"); - break; - case Node::MacroWithParams: - writer.writeAttribute("meta", "macrowithparams"); - break; - case Node::MacroWithoutParams: - writer.writeAttribute("meta", "macrowithoutparams"); - break; - default: - break; - } + writer.writeAttribute("virtual", functionNode->virtualness()); + writer.writeAttribute("meta", functionNode->metaness()); writer.writeAttribute("const", functionNode->isConst()?"true":"false"); writer.writeAttribute("static", functionNode->isStatic()?"true":"false"); writer.writeAttribute("overload", functionNode->isOverload()?"true":"false"); @@ -1288,7 +1209,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, signature += " const"; if (functionNode->isFinal()) signature += " final"; - if (functionNode->virtualness() == FunctionNode::PureVirtual) + if (functionNode->isPureVirtual()) signature += " = 0"; else if (functionNode->isDeleted()) signature += " = delete"; diff --git a/src/qdoc/qdoctagfiles.cpp b/src/qdoc/qdoctagfiles.cpp index cc5b30c8e..115fcb63d 100644 --- a/src/qdoc/qdoctagfiles.cpp +++ b/src/qdoc/qdoctagfiles.cpp @@ -262,23 +262,10 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const Aggreg const FunctionNode* functionNode = static_cast<const FunctionNode*>(node); writer.writeAttribute("protection", access); - - switch (functionNode->virtualness()) { - case FunctionNode::NonVirtual: - writer.writeAttribute("virtualness", "non"); - break; - case FunctionNode::NormalVirtual: - writer.writeAttribute("virtualness", "virtual"); - break; - case FunctionNode::PureVirtual: - writer.writeAttribute("virtualness", "pure"); - break; - default: - break; - } + writer.writeAttribute("virtualness", functionNode->virtualness()); writer.writeAttribute("static", functionNode->isStatic() ? "yes" : "no"); - if (functionNode->virtualness() == FunctionNode::NonVirtual) + if (functionNode->isNonvirtual()) writer.writeTextElement("type", functionNode->returnType()); else writer.writeTextElement("type", "virtual " + functionNode->returnType()); @@ -293,7 +280,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter& writer, const Aggreg signature += " const"; if (functionNode->isFinal()) signature += " final"; - if (functionNode->virtualness() == FunctionNode::PureVirtual) + if (functionNode->isPureVirtual()) signature += " = 0"; else if (functionNode->isDeleted()) signature += " = delete"; diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp index f8f88e6b9..c3360e379 100644 --- a/src/qdoc/tree.cpp +++ b/src/qdoc/tree.cpp @@ -424,8 +424,8 @@ void Tree::resolveInheritanceHelper(int pass, ClassNode* cn) FunctionNode* func = (FunctionNode*)* c; FunctionNode* from = findVirtualFunctionInBaseClasses(cn, func); if (from != 0) { - if (func->virtualness() == FunctionNode::NonVirtual) - func->setVirtualness(FunctionNode::NormalVirtual); + if (func->isNonvirtual()) + func->setVirtual(); func->setReimplementedFrom(from); } } @@ -560,7 +560,7 @@ FunctionNode* Tree::findVirtualFunctionInBaseClasses(ClassNode* cn, FunctionNode if ((*r).node_) { if (((func = findVirtualFunctionInBaseClasses((*r).node_, clone)) != 0 || (func = (*r).node_->findFunctionNode(clone)) != 0)) { - if (func->virtualness() != FunctionNode::NonVirtual) + if (!func->isNonvirtual()) return func; } } @@ -1461,7 +1461,7 @@ const Node* Tree::findFunctionNode(const QString& target, } QStringList path = t.split("::"); const FunctionNode* fn = findFunctionNode(path, params, relative, SearchBaseClasses, genus); - if (fn && fn->metaness() != FunctionNode::MacroWithoutParams) + if (fn && !fn->isMacroWithoutParams()) return fn; return 0; } |