diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-06-28 12:03:59 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-06-28 12:03:59 (GMT) |
commit | 3aa8ae52ebb7a3395328f52fe2cbae0a44ae7198 (patch) | |
tree | 7b7184f9f27afa010a1065c1ca687a89764359f3 /tools | |
parent | ace98f68883acde733e79ca849d379f5ee67a87b (diff) | |
download | Qt-3aa8ae52ebb7a3395328f52fe2cbae0a44ae7198.zip Qt-3aa8ae52ebb7a3395328f52fe2cbae0a44ae7198.tar.gz Qt-3aa8ae52ebb7a3395328f52fe2cbae0a44ae7198.tar.bz2 |
doc: Added more DITA output to the XML generator
Added cxxDefine for macros.
Task-number: QTBUG-11391
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 105 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 8 |
2 files changed, 97 insertions, 16 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d48a578..d7a9c9e 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1466,7 +1466,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeFunctions((*s),cn,marker); } else if ((*s).name == "Member Type Documentation") { - writeNestedClasses((*s),cn,marker); writeEnumerations((*s),cn,marker); writeTypedefs((*s),cn,marker); } @@ -1476,6 +1475,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark else if ((*s).name == "Property Documentation") { writeProperties((*s),cn,marker); } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),cn,marker); + } ++s; } writer.writeEndElement(); // </cxxClass> @@ -4736,12 +4738,6 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke } } -void DitaXmlGenerator::writeNestedClasses(const Section& s, - const ClassNode* cn, - CodeMarker* marker) -{ -} - void DitaXmlGenerator::writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4929,10 +4925,10 @@ void DitaXmlGenerator::writeProperties(const Section& s, writer.writeCharacters(pn->qualifiedDataType()); writer.writeCharacters(" "); writer.writeCharacters(pn->name()); - writerFunctions("READ",pn->getters()); - writerFunctions("WRITE",pn->setters()); - writerFunctions("RESET",pn->resetters()); - writerFunctions("NOTIFY",pn->notifiers()); + writePropParams("READ",pn->getters()); + writePropParams("WRITE",pn->setters()); + writePropParams("RESET",pn->resetters()); + writePropParams("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { writer.writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) @@ -5058,7 +5054,92 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, } } -void DitaXmlGenerator::writerFunctions(const QString& tag, const NodeList& nlist) +void DitaXmlGenerator::writeMacros(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Function) { + const FunctionNode* fn = static_cast<const FunctionNode*>(*m); + if (fn->isMacro()) { + writer.writeStartElement(CXXDEFINE); + writer.writeAttribute("id",fn->guid()); + writer.writeStartElement(APINAME); + writer.writeCharacters(fn->name()); + writer.writeEndElement(); // </apiName> + generateBrief(fn,marker); + writer.writeStartElement(CXXDEFINEDETAIL); + writer.writeStartElement(CXXDEFINEDEFINITION); + writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); + writer.writeAttribute("value",fn->accessString()); + writer.writeEndElement(); // <cxxDefineAccessSpecifier> + + writer.writeStartElement(CXXDEFINEPROTOTYPE); + writer.writeCharacters("#define "); + writer.writeCharacters(fn->name()); + if (fn->metaness() == FunctionNode::MacroWithParams) { + QStringList params = fn->parameterNames(); + if (!params.isEmpty()) { + writer.writeCharacters("("); + for (int i = 0; i < params.size(); ++i) { + if (params[i].isEmpty()) + writer.writeCharacters("..."); + else + writer.writeCharacters(params[i]); + if ((i+1) < params.size()) + writer.writeCharacters(", "); + } + writer.writeCharacters(")"); + } + } + writer.writeEndElement(); // <cxxDefinePrototype> + + writer.writeStartElement(CXXDEFINENAMELOOKUP); + writer.writeCharacters(fn->name()); + writer.writeEndElement(); // <cxxDefineNameLookup> + + if (fn->reimplementedFrom() != 0) { + FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); + writer.writeStartElement(CXXDEFINEREIMPLEMENTED); + writer.writeAttribute("href",rfn->ditaXmlHref()); + writer.writeCharacters(marker->plainFullName(rfn)); + writer.writeEndElement(); // </cxxDefineReimplemented> + } + + if (fn->metaness() == FunctionNode::MacroWithParams) { + QStringList params = fn->parameterNames(); + if (!params.isEmpty()) { + writer.writeStartElement(CXXDEFINEPARAMETERS); + for (int i = 0; i < params.size(); ++i) { + writer.writeStartElement(CXXDEFINEPARAMETER); + writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); + writer.writeCharacters(params[i]); + writer.writeEndElement(); // <cxxDefineParameterDeclarationName> + writer.writeEndElement(); // <cxxDefineParameter> + } + writer.writeEndElement(); // <cxxDefineParameters> + } + } + + writeLocation(fn); + writer.writeEndElement(); // <cxxDefineDefinition> + writer.writeStartElement(APIDESC); + + if (!fn->doc().isEmpty()) { + generateBody(fn, marker); + } + + writer.writeEndElement(); // </apiDesc> + writer.writeEndElement(); // </cxxDefineDetail> + writer.writeEndElement(); // </cxxDefine> + } + } + ++m; + } +} + +void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist) { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 26788d7..446f735 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -118,9 +118,6 @@ class DitaXmlGenerator : public PageGenerator const ClassNode* cn, CodeMarker* marker); void writeParameters(const FunctionNode* fn, CodeMarker* marker); - void writeNestedClasses(const Section& s, - const ClassNode* cn, - CodeMarker* marker); void writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker); @@ -133,7 +130,10 @@ class DitaXmlGenerator : public PageGenerator void writeProperties(const Section& s, const ClassNode* cn, CodeMarker* marker); - void writerFunctions(const QString& tag, const NodeList& nlist); + void writeMacros(const Section& s, + const ClassNode* cn, + CodeMarker* marker); + void writePropParams(const QString& tag, const NodeList& nlist); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; |