diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-06-21 13:22:31 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-06-21 13:22:31 (GMT) |
commit | f321a3f2b1e0d5bc7ab0ec9be1af59981c3a9679 (patch) | |
tree | 2b8f5d2b57ab58c02dc63a2cc8eb511a23c1c060 /tools | |
parent | bbaa64882618e565510ef7ae959062073d4d2ae1 (diff) | |
download | Qt-f321a3f2b1e0d5bc7ab0ec9be1af59981c3a9679.zip Qt-f321a3f2b1e0d5bc7ab0ec9be1af59981c3a9679.tar.gz Qt-f321a3f2b1e0d5bc7ab0ec9be1af59981c3a9679.tar.bz2 |
doc: Added more DITA output to the XML generator
cxxEnumeration stuff for enum types.
Task-number: QTBUG-11391
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 66 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 13 |
2 files changed, 74 insertions, 5 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 96eb772..e5481a0 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4563,6 +4563,11 @@ void DitaXmlGenerator::writeLocation(const Node* n, CodeMarker* marker) s2 = CXXFUNCTIONDECLARATIONFILE; s3 = CXXFUNCTIONDECLARATIONFILELINE; } + else if (n->type() == Node::Enum) { + s1 = CXXENUMERATIONAPIITEMLOCATION; + s2 = CXXENUMERATIONDECLARATIONFILE; + s3 = CXXENUMERATIONDECLARATIONFILELINE; + } writer.writeStartElement(s1); writer.writeStartElement(s2); writer.writeAttribute("name","filePath"); @@ -4727,6 +4732,67 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker) { + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Enum) { + EnumNode* en = static_cast<const EnumNode*>(*m); + writer.writeStartElement(CXXENUMERATION); + writer.writeAttribute("id",en->guid()); + writer.writeStartElement(APINAME); + writer.writeCharacters(en->name()); + writer.writeEndElement(); // </apiName> + generateBrief(en,marker); + writer.writeStartElement(CXXENUMERATIONDETAIL); + writer.writeStartElement(CXXENUMERATIONDEFINITION); + writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); + writer.writeAttribute("value",en->accessString()); + writer.writeEndElement(); // <cxxEnumerationAccessSpecifier> + + QString fq = fullQualification(en); + if (!fq.isEmpty()) { + writer.writeStartElement(CXXENUMERATIONSCOPEDNAME); + writer.writeCharacters(fq); + writer.writeEndElement(); // <cxxEnumerationScopedName> + } + const QList<EnumItem>& items = en->items(); + if (!items.isEmpty()) { + writer.writeStartElement(CXXENUMERATIONPROTOTYPE); + writer.writeCharacters(en->name()); + writer.writeCharacters(" = { "); + QList<EnumItem>::ConstIterator i = items.begin(); + while (i != items.end()) { + writer.writeCharacters((*i).name()); + if (!(*i).value().isEmpty()) { + writer.writeCharacters(" = "); + writer.writeCharacters((*i).value()); + } + ++i; + if (i != items.end()) + writer.writeCharacters(", "); + } + writer.writeCharacters(" }"); + writer.writeEndElement(); // <cxxEnumerationPrototype> + } + + writer.writeStartElement(CXXENUMERATIONNAMELOOKUP); + writer.writeCharacters(en->parent()->name() + "::" + en->name()); + writer.writeEndElement(); // <cxxEnumerationNameLookup> + + writeLocation(en, marker); + writer.writeEndElement(); // <cxxEnumerationDefinition> + writer.writeStartElement(APIDESC); + + if (!en->doc().isEmpty()) { + generateBody(en, marker); + // generateAlsoList(inner, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxEnumerationDetail> + writer.writeEndElement(); // </cxxEnumeration> + } + ++m; + } } void DitaXmlGenerator::writeTypedefs(const Section& s, diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 06681cb..12dee87 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -968,6 +968,8 @@ QString FakeNode::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) @@ -975,6 +977,7 @@ EnumNode::EnumNode(InnerNode *parent, const QString& name) } /*! + Add \a item to the enum type's item list. */ void EnumNode::addItem(const EnumItem& item) { @@ -983,15 +986,15 @@ void EnumNode::addItem(const EnumItem& item) } /*! + Returns the access level of the enumeration item named \a name. + Apparently it is private if it has been omitted by qdoc's + omitvalue command. Otherwise it is public. */ Node::Access EnumNode::itemAccess(const QString &name) const { - if (doc().omitEnumItemNames().contains(name)) { + if (doc().omitEnumItemNames().contains(name)) return Private; - } - else { - return Public; - } + return Public; } /*! |