From f0ef28beec5531d2cd0c2829b272710dbc3991af Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 18 Jun 2010 14:47:55 +0200 Subject: doc: Added more DITA output to the XML generator More cxxFunction stuff for member functions. Task-number: QTBUG-11391 --- tools/qdoc3/ditaxmlgenerator.cpp | 13 ++++++++----- tools/qdoc3/node.cpp | 35 +++++++++++++++++++++++++++++++++++ tools/qdoc3/node.h | 4 ++++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 5f10885..e80f948 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1423,7 +1423,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateHeader(inner); writer.writeStartElement(CXXCLASS); - writeGuidAttribute(fullTitle); + writer.writeAttribute("id",cn->guid()); writer.writeStartElement(APINAME); writer.writeCharacters(fullTitle); writer.writeEndElement(); // @@ -4540,10 +4540,8 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) writer.writeAttribute("value",(*r).accessString()); writer.writeEndElement(); // writer.writeStartElement(CXXCLASSBASECLASS); - QString fullTitle = marker->plainFullName((*r).node); - QString guid = lookupGuid(fullTitle); - writer.writeAttribute("href",guid); - writer.writeCharacters(fullTitle); + writer.writeAttribute("href",(*r).node->ditaXmlHref()); + writer.writeCharacters(marker->plainFullName((*r).node)); writer.writeEndElement(); // writer.writeEndElement(); // ++r; @@ -4663,6 +4661,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeStartElement(CXXFUNCTIONNAMELOOKUP); writer.writeCharacters(fnl); writer.writeEndElement(); // + + //writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); + //writer.writeAttribute("href", zzz); + //writer.writeCharacters(); + //writer.writeEndElement(); // writeLocation(fn, marker); writer.writeEndElement(); // diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index b71a43e..2a03fd2 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -101,6 +101,7 @@ Node::Node(Type type, InnerNode *parent, const QString& name) { if (par) par->addChild(this); + uuid = QUuid::createUuid(); } /*! @@ -199,6 +200,11 @@ Node::Status Node::inheritedStatus() const } /*! + Returns the thread safeness value for whatever this node + represents. But if this node has a parent and the thread + safeness value of the parent is the same as the thread + safeness value of this node, what is returned is the + value \c{UnspecifiedSafeness}. Why? */ Node::ThreadSafeness Node::threadSafeness() const { @@ -208,6 +214,9 @@ Node::ThreadSafeness Node::threadSafeness() const } /*! + If this node has a parent, the parent's thread safeness + value is returned. Otherwise, this node's thread safeness + value is returned. Why? */ Node::ThreadSafeness Node::inheritedThreadSafeness() const { @@ -217,6 +226,9 @@ Node::ThreadSafeness Node::inheritedThreadSafeness() const } /*! + Returns the sanitized file name without the path. + If the the file is an html file, the html suffix + is removed. Why? */ QString Node::fileBase() const { @@ -229,11 +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. + */ + +/*! + 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 '#' + */ +QString Node::ditaXmlHref() +{ + QString href = fileBase(); + if (!href.endsWith(".xml")) + href += ".xml"; + return href + "#" + guid(); +} + /*! \class InnerNode */ /*! + The inner node destructor deletes the children and removes + this node from its related nodes. */ InnerNode::~InnerNode() { @@ -577,6 +610,7 @@ InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name) } /*! + Appends an \a include file to the list of include files. */ void InnerNode::addInclude(const QString& include) { @@ -584,6 +618,7 @@ void InnerNode::addInclude(const QString& include) } /*! + Sets the list of include files to \a includes. */ void InnerNode::setIncludes(const QStringList& includes) { diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index ccfd9b6..44cdac2 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -55,6 +55,7 @@ #include "doc.h" #include "location.h" #include "text.h" +#include QT_BEGIN_NAMESPACE @@ -190,6 +191,8 @@ class Node void clearRelated() { rel = 0; } virtual QString fileBase() const; + QUuid guid() const { return uuid; } + QString ditaXmlHref(); protected: Node(Type type, InnerNode *parent, const QString& name); @@ -219,6 +222,7 @@ class Node QString u; QString sinc; QString tpl; + QUuid uuid; }; class FunctionNode; -- cgit v0.12