summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2010-06-21 10:15:11 (GMT)
committerMartin Smith <martin.smith@nokia.com>2010-06-21 10:15:11 (GMT)
commite2f0e728e85593b502940c16f1eead4bce673c2e (patch)
treeba9af66308f70efa901af0902eb24a5d4cf695f2 /tools
parent94ac0b1608cd3142096835536ac56f9335094a33 (diff)
downloadQt-e2f0e728e85593b502940c16f1eead4bce673c2e.zip
Qt-e2f0e728e85593b502940c16f1eead4bce673c2e.tar.gz
Qt-e2f0e728e85593b502940c16f1eead4bce673c2e.tar.bz2
doc: Added more DITA output to the XML generator
More cxxFunction stuff for member functions. Function parameters and other stuff. Task-number: QTBUG-11391
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp54
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h1
-rw-r--r--tools/qdoc3/node.cpp20
-rw-r--r--tools/qdoc3/node.h3
4 files changed, 60 insertions, 18 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index e80f948..96eb772 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -1402,20 +1402,20 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
QList<Section> sections;
QList<Section>::ConstIterator s;
- const ClassNode* cn = 0;
- const NamespaceNode *namespasse = 0;
+ ClassNode* cn = 0;
+ NamespaceNode* namespasse = 0;
QString title;
QString rawTitle;
QString fullTitle;
if (inner->type() == Node::Namespace) {
- namespasse = static_cast<const NamespaceNode *>(inner);
+ namespasse = static_cast<const NamespaceNode*>(inner);
rawTitle = marker->plainName(inner);
fullTitle = marker->plainFullName(inner);
title = rawTitle + " Namespace";
}
else if (inner->type() == Node::Class) {
- cn = static_cast<const ClassNode *>(inner);
+ cn = static_cast<const ClassNode*>(inner);
rawTitle = marker->plainName(inner);
fullTitle = marker->plainFullName(inner);
title = rawTitle + " Class Reference";
@@ -4583,12 +4583,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
NodeList::ConstIterator m = s.members.begin();
while (m != s.members.end()) {
if ((*m)->type() == Node::Function) {
- const FunctionNode* fn = reinterpret_cast<const FunctionNode*>(*m);
- QString name = fn->name();
+ FunctionNode* fn = static_cast<const FunctionNode*>(*m);
writer.writeStartElement(CXXFUNCTION);
- writeGuidAttribute(name);
+ writer.writeAttribute("id",fn->guid());
writer.writeStartElement(APINAME);
- writer.writeCharacters(name);
+ writer.writeCharacters(fn->name());
writer.writeEndElement(); // </apiName>
generateBrief(fn,marker);
writer.writeStartElement(CXXFUNCTIONDETAIL);
@@ -4662,11 +4661,14 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
writer.writeCharacters(fnl);
writer.writeEndElement(); // <cxxFunctionNameLookup>
- //writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED);
- //writer.writeAttribute("href", zzz);
- //writer.writeCharacters();
- //writer.writeEndElement(); // </cxxFunctionReimplemented>
-
+ if (fn->isReimp() && fn->reimplementedFrom() != 0) {
+ FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom();
+ writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED);
+ writer.writeAttribute("href",rfn->ditaXmlHref());
+ writer.writeCharacters(marker->plainFullName(rfn));
+ writer.writeEndElement(); // </cxxFunctionReimplemented>
+ }
+ writeParameters(fn,marker);
writeLocation(fn, marker);
writer.writeEndElement(); // <cxxFunctionDefinition>
writer.writeStartElement(APIDESC);
@@ -4689,6 +4691,32 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
}
}
+void DitaXmlGenerator::writeParameters(FunctionNode* fn, CodeMarker* marker)
+{
+ const QList<Parameter>& parameters = fn->parameters();
+ if (!parameters.isEmpty()) {
+ writer.writeStartElement(CXXFUNCTIONPARAMETERS);
+ QList<Parameter>::ConstIterator p = parameters.begin();
+ while (p != parameters.end()) {
+ writer.writeStartElement(CXXFUNCTIONPARAMETER);
+ writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE);
+ writer.writeCharacters((*p).leftType());
+ writer.writeEndElement(); // <cxxFunctionParameterDeclaredType>
+ writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME);
+ writer.writeCharacters((*p).name());
+ writer.writeEndElement(); // <cxxFunctionParameterDeclarationName>
+ if (!(*p).defaultValue().isEmpty()) {
+ writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE);
+ writer.writeCharacters((*p).defaultValue());
+ writer.writeEndElement(); // <cxxFunctionParameterDefaultValue>
+ }
+ writer.writeEndElement(); // <cxxFunctionParameter>
+ ++p;
+ }
+ writer.writeEndElement(); // <cxxFunctionParameters>
+ }
+}
+
void DitaXmlGenerator::writeNestedClasses(const Section& s,
const ClassNode* cn,
CodeMarker* marker)
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 71304b3..e8ad8ba 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -117,6 +117,7 @@ class DitaXmlGenerator : public PageGenerator
void writeFunctions(const Section& s,
const ClassNode* cn,
CodeMarker* marker);
+ void writeParameters(FunctionNode* fn, CodeMarker* marker);
void writeNestedClasses(const Section& s,
const ClassNode* cn,
CodeMarker* marker);
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 2a03fd2..06681cb 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -101,7 +101,7 @@ Node::Node(Type type, InnerNode *parent, const QString& name)
{
if (par)
par->addChild(this);
- uuid = QUuid::createUuid();
+ //uuid = QUuid::createUuid();
}
/*!
@@ -241,20 +241,32 @@ QString Node::fileBase() const
return base.toLower();
}
-/*! \fnQUuid Node::guid() const
+/*!
Returns this node's Universally Unique IDentifier.
If its UUID has not yet been created, it is created
first.
*/
+QUuid Node::guid()
+{
+ if (uuid.isNull())
+ uuid = QUuid::createUuid();
+ return uuid;
+}
/*!
Composes a string to be used as an href attribute in DITA
XML. It is composed of the file name and the UUID separated
- by a '#'
+ by a '#'. If this node is a class node, the file name is
+ taken from this node; if this node is a function node, the
+ file name is taken from the parent node of this node.
*/
QString Node::ditaXmlHref()
{
- QString href = fileBase();
+ QString href;
+ if (type() == Function)
+ href = parent()->fileBase();
+ else
+ href = fileBase();
if (!href.endsWith(".xml"))
href += ".xml";
return href + "#" + guid();
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 44cdac2..4d1e757 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -191,7 +191,8 @@ class Node
void clearRelated() { rel = 0; }
virtual QString fileBase() const;
- QUuid guid() const { return uuid; }
+ //QUuid guid() const { return uuid; }
+ QUuid guid();
QString ditaXmlHref();
protected: