diff options
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 1 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.cpp | 4 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 16 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 198 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 4 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 39 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 13 |
9 files changed, 152 insertions, 127 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7065e85..38416a7 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -596,7 +596,6 @@ void QWidget::setAutoFillBackground(bool enabled) \ingroup basicwidgets - The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 58642ef..84a09ce 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -491,7 +491,7 @@ static QString encode(const QString &string) #endif } -QStringList CodeMarker::macRefsForNode(const Node *node) +QStringList CodeMarker::macRefsForNode(Node *node) { QString result = QLatin1String("cpp/"); switch (node->type()) { @@ -583,7 +583,7 @@ QStringList CodeMarker::macRefsForNode(const Node *node) { NodeList list = static_cast<const PropertyNode*>(node)->functions(); QStringList stringList; - foreach (const Node *node, list) { + foreach (Node* node, list) { stringList += macRefsForNode(node); } return stringList; diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 65fcdd4..21bc31f 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -155,7 +155,7 @@ class CodeMarker const Tree* tree, const Node* relative, const Node* self = 0); - virtual QStringList macRefsForNode(const Node* node); + virtual QStringList macRefsForNode(Node* node); static void initialize(const Config& config); static void terminate(); diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 595756a..8becdd5 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -97,6 +97,22 @@ QT_BEGIN_NAMESPACE #define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype") #endif +#define COMMAND_AUDIENCE Doc::alias("audience") +#define COMMAND_CATEGORY Doc::alias("category") +#define COMMAND_PRODNAME Doc::alias("prodname") +#define COMMAND_COMPONENT Doc::alias("component") +#define COMMAND_AUTHOR Doc::alias("author") +#define COMMAND_PUBLISHER Doc::alias("publisher") +#define COMMAND_COPYRYEAR Doc::alias("copyryear") +#define COMMAND_COPYRHOLDER Doc::alias("copyrholder") +#define COMMAND_PERMISSIONS Doc::alias("permissions") +#define COMMAND_LIFECYCLEVERSION Doc::alias("lifecycleversion") +#define COMMAND_LIFECYCLEWSTATUS Doc::alias("lifecyclestatus") +#define COMMAND_LICENSEYEAR Doc::alias("licenseyear") +#define COMMAND_LICENSENAME Doc::alias("licensename") +#define COMMAND_LICENSEDESCRIPTION Doc::alias("licensedescription") +#define COMMAND_RELEASEDATE Doc::alias("releasedate") + QStringList CppCodeParser::exampleFiles; QStringList CppCodeParser::exampleDirs; diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 5d3e34a..fed3af3 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5551,6 +5551,67 @@ void DitaXmlGenerator::writeDitaMap() } /*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If a value + for the tag is found, the element is written with the + found value. Otherwise if \a force is set, an empty + element is written using the tag. + + Returns true or false depending on whether it writes + an element using the tag \a t. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + + At the moment, it doesn't chaeck to see if there is a + default value for the tag. But it will eventually. + */ +bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, + DitaXmlGenerator::DitaTag t, + bool force) +{ + QString s; + QStringMap& metaTagMap = const_cast<QStringMap&>(inner->doc().metaTagMap()); + QStringMap::iterator i = metaTagMap.find(ditaTags[t]); + if (i == metaTagMap.end()) { + // get the default author, if there is one. + } + else { + s = i.value(); + metaTagMap.erase(i); + } + if (s.isEmpty() && !force) + return false; + writeStartTag(t); + if (!s.isEmpty()) + xmlWriter().writeCharacters(s); + writeEndTag(); + return true; +} + +/*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If a value + for the tag is found, the value is returned. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + */ +QString DitaXmlGenerator::getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t) +{ + QString s; + QStringMap& metaTagMap = const_cast<QStringMap&>(inner->doc().metaTagMap()); + QStringMap::iterator i = metaTagMap.find(ditaTags[t]); + if (i != metaTagMap.end()) { + s = i.value(); + metaTagMap.erase(i); + } + return s; +} + +/*! Writes the <prolog> element for the \a inner node using the \a marker. The <prolog> element contains the <metadata> element, plus some others. This @@ -5595,64 +5656,60 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) if (!inner) return; writeStartTag(DT_prolog); - - QString author = inner->author(); - writeStartTag(DT_author); - if (author.isEmpty()) - author = "Qt Development Frameworks"; - xmlWriter().writeCharacters(author); - writeEndTag(); // <author> - - QString publisher = inner->publisher(); - writeStartTag(DT_publisher); - if (publisher.isEmpty()) - publisher = "Nokia"; - xmlWriter().writeCharacters(publisher); - writeEndTag(); // <publisher> - - QString permissions = inner->permissions(); + writeMetadataElement(inner,DT_author); + writeMetadataElement(inner,DT_publisher); + QString s = getMetadataElement(inner,DT_permissions); + if (s.isEmpty()) + s = "all"; writeStartTag(DT_permissions); - if (permissions.isEmpty()) - permissions = "all"; - xmlWriter().writeAttribute("view",permissions); - writeEndTag(); // <permissions> - + xmlWriter().writeAttribute("view",s); + writeEndTag(); // </permissions> writeStartTag(DT_metadata); - writeStartTag(DT_category); - QString category = "Page"; - if (inner->type() == Node::Class) - category = "C++ Class"; - else if (inner->type() == Node::Namespace) - category = "C++ Namespace"; - else if (inner->type() == Node::Fake) { - if (inner->subType() == Node::QmlBasicType) - category = "QML Class"; - else if (inner->subType() == Node::QmlClass) - category = "QML Basic Type"; - else if (inner->subType() == Node::HeaderFile) - category = "Header File"; - else if (inner->subType() == Node::Module) - category = "Module"; - else if (inner->subType() == Node::File) - category = "Example Source File"; - else if (inner->subType() == Node::Example) - category = "Example"; - else if (inner->subType() == Node::Image) - category = "Image"; - else if (inner->subType() == Node::Group) - category = "Group"; - else if (inner->subType() == Node::Page) - category = "Page"; - else if (inner->subType() == Node::ExternalPage) - category = "External Page"; // Is this necessary? + s = getMetadataElement(inner,DT_audience); + if (!s.isEmpty()) { + writeStartTag(DT_audience); + xmlWriter().writeAttribute("type",s); + writeEndTag(); // </audience> + } + if (!writeMetadataElement(inner,DT_category,false)) { + writeStartTag(DT_category); + QString category = "Page"; + if (inner->type() == Node::Class) + category = "Class reference"; + else if (inner->type() == Node::Namespace) + category = "C++ Namespace"; + else if (inner->type() == Node::Fake) { + if (inner->subType() == Node::QmlClass) + category = "QML Element Reference"; + else if (inner->subType() == Node::QmlBasicType) + category = "QML Basic Type"; + else if (inner->subType() == Node::HeaderFile) + category = "Header File"; + else if (inner->subType() == Node::Module) + category = "Module"; + else if (inner->subType() == Node::File) + category = "Example Source File"; + else if (inner->subType() == Node::Example) + category = "Example"; + else if (inner->subType() == Node::Image) + category = "Image"; + else if (inner->subType() == Node::Group) + category = "Group"; + else if (inner->subType() == Node::Page) + category = "Page"; + else if (inner->subType() == Node::ExternalPage) + category = "External Page"; // Is this necessary? + } + xmlWriter().writeCharacters(category); + writeEndTag(); // </category> } - xmlWriter().writeCharacters(category); - writeEndTag(); // <category> if (vrm.size() > 0) { writeStartTag(DT_prodinfo); - writeStartTag(DT_prodname); - xmlWriter().writeCharacters(projectDescription); - writeEndTag(); // <prodname> + if (!writeMetadataElement(inner,DT_prodname,false)) { + writeStartTag(DT_prodname); + xmlWriter().writeCharacters(projectDescription); + writeEndTag(); // </prodname> + } writeStartTag(DT_vrmlist); writeStartTag(DT_vrm); if (vrm.size() > 0) @@ -5663,26 +5720,27 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) xmlWriter().writeAttribute("modification",vrm[2]); writeEndTag(); // <vrm> writeEndTag(); // <vrmlist> - QString component = inner->moduleName(); - if (!component.isEmpty()) { - writeStartTag(DT_component); - xmlWriter().writeCharacters(component); - writeEndTag(); // <component> - } - writeEndTag(); // <prodinfo> - if (inner->hasOtherMetadata()) { - const QMap<QString, QString>& omd = inner->otherMetadata(); - QMapIterator<QString, QString> i(omd); - while (i.hasNext()) { - i.next(); - writeStartTag(DT_othermeta); - xmlWriter().writeAttribute("name",i.key()); - xmlWriter().writeAttribute("content",i.value()); + if (!writeMetadataElement(inner,DT_component,false)) { + QString component = inner->moduleName(); + if (!component.isEmpty()) { + writeStartTag(DT_component); + xmlWriter().writeCharacters(component); + writeEndTag(); // </component> } } + writeEndTag(); // </prodinfo> + } + const QStringMap& metaTagMap = inner->doc().metaTagMap(); + QMapIterator<QString, QString> i(metaTagMap); + while (i.hasNext()) { + i.next(); + writeStartTag(DT_othermeta); + xmlWriter().writeAttribute("name",i.key()); + xmlWriter().writeAttribute("content",i.value()); + writeEndTag(); // </othermeta> } - writeEndTag(); // <metadata> - writeEndTag(); // <prolog> + writeEndTag(); // </metadata> + writeEndTag(); // </prolog> } QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 7793db0..972688a 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -316,6 +316,10 @@ class DitaXmlGenerator : public PageGenerator void writeRelatedLinks(const FakeNode* fake, CodeMarker* marker); void writeLink(const Node* node, const QString& tex, const QString& role); void writeProlog(const InnerNode* inner, CodeMarker* marker); + bool writeMetadataElement(const InnerNode* inner, + DitaXmlGenerator::DitaTag t, + bool force=true); + QString getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 5f563be..945b765 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -877,7 +877,7 @@ void DocParser::parse(const QString& source, case CMD_META: priv->constructExtra(); p1 = getArgument(); - priv->extra->metaMap.insert(p1, getRestOfLine()); + priv->extra->metaMap.insert(p1, getArgument()); break; case CMD_NEWCODE: location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_NEWCODE))); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 0f85d37..ee050f5 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -771,30 +771,6 @@ void InnerNode::removeChild(Node *child) } } -/*! \fn QString InnerNode::author() const - Returns the author. - */ - -/*! \fn void InnerNode::setAuthor(const QString& author) - Sets the \a author. - */ - -/*! \fn QString InnerNode::publisher() const - Returns the publisher. - */ - -/*! \fn void InnerNode::setPublisher(const QString& publisher) - Sets the \a publisher. - */ - -/*! \fn QString InnerNode::permissions() const - Returns the permissions. - */ - -/*! \fn void InnerNode::setPermissions(const QString& permissions) - Sets the \a permissions. - */ - /*! Find the module (QtCore, QtGui, etc.) to which the class belongs. We do this by obtaining the full path to the header file's location @@ -858,21 +834,6 @@ void InnerNode::removeRelated(Node *pseudoChild) related.removeAll(pseudoChild); } -/*! \fn bool InnerNode::hasOtherMetadata() const - Returns tru if the other metadata map is not empty. - */ - -/*! - Insert the pair \a name and \a content into the other metadata map. - */ -void insertOtherMetadata(const QString& name, const QString& content) -{ -} - -/*! \fn const QMap<QString, QString>& InnerNode::otherMetadata() cont - Returns the map containing pairs for output as \c {<othermetadata>}. - */ - /*! \class LeafNode */ diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 2de2b5a..d1123dc 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -262,21 +262,12 @@ class InnerNode : public Node NodeList overloads(const QString &funcName) const; const QStringList& includes() const { return inc; } - QString author() const { return author_; } - void setAuthor(const QString& author) { author_ = author; } - QString publisher() const { return publisher_; } - void setPublisher(const QString& publisher) { publisher_ = publisher; } - QString permissions() const { return permissions_; } - void setPermissions(const QString& permissions) { permissions_ = permissions; } QStringList primaryKeys(); QStringList secondaryKeys(); const QStringList& pageKeywords() const { return pageKeywds; } virtual void addPageKeywords(const QString& t) { pageKeywds << t; } virtual bool isAbstract() const { return false; } virtual void setAbstract(bool ) { } - bool hasOtherMetadata() const { return !otherMetadataMap.isEmpty(); } - void insertOtherMetadata(const QString& name, const QString& content); - const QMap<QString, QString>& otherMetadata() const { return otherMetadataMap; } protected: InnerNode(Type type, InnerNode* parent, const QString& name); @@ -289,9 +280,6 @@ class InnerNode : public Node void removeChild(Node* child); void removeRelated(Node* pseudoChild); - QString author_; - QString publisher_; - QString permissions_; QStringList pageKeywds; QStringList inc; NodeList children; @@ -300,7 +288,6 @@ class InnerNode : public Node QMap<QString, Node*> childMap; QMap<QString, Node*> primaryFunctionMap; QMap<QString, NodeList> secondaryFunctionMap; - QMap<QString, QString> otherMetadataMap; }; class LeafNode : public Node |