From 451a017e4d819a53d22b5dd5b562f99bda7ac087 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 25 Jun 2010 13:29:45 +0200 Subject: doc: Added more DITA output to the XML generator Output the \variable stuff as a cxxVariable. Task-number: QTBUG-11391 --- tools/qdoc3/codechunk.h | 2 +- tools/qdoc3/ditaxmlgenerator.cpp | 72 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/tools/qdoc3/codechunk.h b/tools/qdoc3/codechunk.h index e78873c..a0c554e 100644 --- a/tools/qdoc3/codechunk.h +++ b/tools/qdoc3/codechunk.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE /* The CodeChunk class represents a tiny piece of C++ code. - The class provides convertion between a list of lexemes and a string. It adds + The class provides conversion between a list of lexemes and a string. It adds spaces at the right place for consistent style. The tiny pieces of code it represents are data types, enum values, and default parameter values. diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 852d209..0135983 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4573,7 +4573,8 @@ void DitaXmlGenerator::writeLocation(const Node* n) s2 = CXXTYPEDEFDECLARATIONFILE; s3 = CXXTYPEDEFDECLARATIONFILELINE; } - else if (n->type() == Node::Property) { + else if ((n->type() == Node::Property) || + (n->type() == Node::Variable)) { s1 = CXXVARIABLEAPIITEMLOCATION; s2 = CXXVARIABLEDECLARATIONFILE; s3 = CXXVARIABLEDECLARATIONFILELINE; @@ -4716,6 +4717,8 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke writer.writeStartElement(CXXFUNCTIONPARAMETER); writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); writer.writeCharacters((*p).leftType()); + if (!(*p).rightType().isEmpty()) + writer.writeCharacters((*p).rightType()); writer.writeEndElement(); // writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); writer.writeCharacters((*p).name()); @@ -4888,12 +4891,6 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, } } -void DitaXmlGenerator::writeDataMembers(const Section& s, - const ClassNode* cn, - CodeMarker* marker) -{ -} - void DitaXmlGenerator::writeProperties(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4992,6 +4989,67 @@ void DitaXmlGenerator::writeProperties(const Section& s, } } +void DitaXmlGenerator::writeDataMembers(const Section& s, + const ClassNode* cn, + CodeMarker* marker) +{ + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Variable) { + const VariableNode* vn = static_cast(*m); + writer.writeStartElement(CXXVARIABLE); + writer.writeAttribute("id",vn->guid()); + writer.writeStartElement(APINAME); + writer.writeCharacters(vn->name()); + writer.writeEndElement(); // + generateBrief(vn,marker); + writer.writeStartElement(CXXVARIABLEDETAIL); + writer.writeStartElement(CXXVARIABLEDEFINITION); + writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); + writer.writeAttribute("value",vn->accessString()); + writer.writeEndElement(); // + + writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); + writer.writeCharacters(vn->leftType()); + if (!vn->rightType().isEmpty()) + writer.writeCharacters(vn->rightType()); + writer.writeEndElement(); // + + QString fq = fullQualification(vn); + if (!fq.isEmpty()) { + writer.writeStartElement(CXXVARIABLESCOPEDNAME); + writer.writeCharacters(fq); + writer.writeEndElement(); // + } + + writer.writeStartElement(CXXVARIABLEPROTOTYPE); + writer.writeCharacters(vn->leftType() + " "); + //writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); + writer.writeCharacters(vn->name()); + if (!vn->rightType().isEmpty()) + writer.writeCharacters(vn->rightType()); + writer.writeEndElement(); // + + writer.writeStartElement(CXXVARIABLENAMELOOKUP); + writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); + writer.writeEndElement(); // + + writeLocation(vn); + writer.writeEndElement(); // + writer.writeStartElement(APIDESC); + + if (!vn->doc().isEmpty()) { + generateBody(vn, marker); + } + + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + } + ++m; + } +} + void DitaXmlGenerator::writerFunctions(const QString& tag, const NodeList& nlist) { NodeList::const_iterator n = nlist.begin(); -- cgit v0.12