diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 83 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 11 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 142 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 12 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 103 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 11 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 13 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 2 |
10 files changed, 205 insertions, 176 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 585d6ce..b3dc31a 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -955,7 +955,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, ident += ch; finish = i; readChar(); - } while (ch >= 0 && isalnum(ch) || ch == '_'); + } while (isalnum(ch) || ch == '_'); if (classRegExp.exactMatch(ident)) { tag = QLatin1String("type"); diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9f512d3..fc66923 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -62,6 +62,25 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int DitaXmlGenerator::id = 0; +QString DitaXmlGenerator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New QML Elements", + " New Qml Properties", + " New Qml Signals", + " New Qml Methods", + "" + }; + /* The strings in this array must appear in the same order as the values in enum DitaXmlGenerator::DitaTag. @@ -3934,6 +3953,70 @@ void DitaXmlGenerator::findAllClasses(const InnerNode* node) } } +/*! + For generating the "New Classes... in 4.x" section on the + What's New in 4.x" page. + */ +void DitaXmlGenerator::findAllSince(const InnerNode* node) +{ + NodeList::const_iterator child = node->childNodes().constBegin(); + while (child != node->childNodes().constEnd()) { + QString sinceVersion = (*child)->since(); + if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) { + NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion); + if (nsmap == newSinceMaps.end()) + nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap()); + NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); + if (ncmap == newClassMaps.end()) + ncmap = newClassMaps.insert(sinceVersion,NodeMap()); + NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); + if (nqcmap == newQmlClassMaps.end()) + nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); + + if ((*child)->type() == Node::Function) { + FunctionNode *func = static_cast<FunctionNode *>(*child); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + nsmap.value().insert(func->name(),(*child)); + } + } + else if ((*child)->url().isEmpty()) { + if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + ncmap.value().insert(className,(*child)); + } + else if ((*child)->subType() == Node::QmlClass) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + nqcmap.value().insert(className,(*child)); + } + } + else { + QString name = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + name = (*child)->parent()->name()+"::"+name; + nsmap.value().insert(name,(*child)); + } + if ((*child)->isInnerNode()) { + findAllSince(static_cast<InnerNode *>(*child)); + } + } + ++child; + } +} + void DitaXmlGenerator::findAllFunctions(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index d8d3563..408f46c 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -51,6 +51,12 @@ QT_BEGIN_NAMESPACE +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, NodeMultiMap> NewSinceMaps; +typedef QMap<Node*, NodeMultiMap> ParentMaps; +typedef QMap<QString, const Node*> NodeMap; +typedef QMap<QString, NodeMap> NewClassMaps; + typedef QMap<QString, QString> GuidMap; typedef QMap<QString, GuidMap*> GuidMaps; @@ -412,6 +418,7 @@ class DitaXmlGenerator : public PageGenerator void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); + void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); virtual QString getLink(const Atom *atom, @@ -508,6 +515,10 @@ class DitaXmlGenerator : public PageGenerator #endif QMap<QString, NodeMap > funcIndex; QMap<Text, const Node*> legaleseTexts; + NewSinceMaps newSinceMaps; + static QString sinceTitles[]; + NewClassMaps newClassMaps; + NewClassMaps newQmlClassMaps; static int id; static QString ditaTags[]; QStack<QXmlStreamWriter*> xmlWriterStack; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 37f68f8..479931d 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -828,7 +828,7 @@ void DocParser::parse(const QString& source, append(Atom::AnnotatedList, getArgument()); break; case CMD_SINCELIST: - append(Atom::SinceList, getRestOfLine().simplified()); + append(Atom::SinceList, getArgument()); break; case CMD_GENERATELIST: append(Atom::GeneratedList, getArgument()); diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index c20d2b4..3367301 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -77,25 +77,6 @@ QString Generator::outDir; QString Generator::project; QHash<QString, QString> Generator::outputPrefixes; -QString Generator::sinceTitles[] = - { - " New Namespaces", - " New Classes", - " New Member Functions", - " New Functions in Namespaces", - " New Global Functions", - " New Macros", - " New Enum Types", - " New Typedefs", - " New Properties", - " New Variables", - " New QML Elements", - " New QML Properties", - " New QML Signals", - " New QML Methods", - "" - }; - static void singularPlural(Text& text, const NodeList& nodes) { if (nodes.count() == 1) @@ -779,18 +760,8 @@ QString Generator::typeString(const Node *node) case Node::Class: return "class"; case Node::Fake: - { - switch (node->subType()) { - case Node::QmlClass: - return "element"; - case Node::QmlPropertyGroup: - return "property group"; - case Node::QmlBasicType: - return "type"; - default: - return "documentation"; - } - } + default: + return "documentation"; case Node::Enum: return "enum"; case Node::Typedef: @@ -799,8 +770,6 @@ QString Generator::typeString(const Node *node) return "function"; case Node::Property: return "property"; - default: - return "documentation"; } } @@ -1122,21 +1091,11 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) text << " was introduced or modified in "; else text << " was introduced in "; - - QStringList since = node->since().split(" "); - if (since.count() == 1) { - // Handle legacy use of \since <version>. - if (project.isEmpty()) - text << "version"; - else - text << project; - text << " " << since[0]; - } else { - // Reconstruct the <project> <version> string. - text << " " << since.join(" "); - } - - text << "." << Atom::ParaRight; + if (project.isEmpty()) + text << "version"; + else + text << project; + text << " " << node->since() << "." << Atom::ParaRight; generateText(text, node, marker); } } @@ -1387,91 +1346,4 @@ QStringList Generator::getMetadataElements(const InnerNode* inner, const QString return s; } -/*! - For generating the "New Classes... in 4.6" section on the - What's New in 4.6" page. - */ -void Generator::findAllSince(const InnerNode *node) -{ - NodeList::const_iterator child = node->childNodes().constBegin(); - - // Traverse the tree, starting at the node supplied. - - while (child != node->childNodes().constEnd()) { - - QString sinceString = (*child)->since(); - - if (((*child)->access() != Node::Private) && !sinceString.isEmpty()) { - - // Insert a new entry into each map for each new since string found. - NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceString); - if (nsmap == newSinceMaps.end()) - nsmap = newSinceMaps.insert(sinceString,NodeMultiMap()); - - NewClassMaps::iterator ncmap = newClassMaps.find(sinceString); - if (ncmap == newClassMaps.end()) - ncmap = newClassMaps.insert(sinceString,NodeMap()); - - NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceString); - if (nqcmap == newQmlClassMaps.end()) - nqcmap = newQmlClassMaps.insert(sinceString,NodeMap()); - - if ((*child)->type() == Node::Function) { - // Insert functions into the general since map. - FunctionNode *func = static_cast<FunctionNode *>(*child); - if ((func->status() > Node::Obsolete) && - (func->metaness() != FunctionNode::Ctor) && - (func->metaness() != FunctionNode::Dtor)) { - nsmap.value().insert(func->name(),(*child)); - } - } - else if ((*child)->url().isEmpty()) { - if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { - // Insert classes into the since and class maps. - QString className = (*child)->name(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - className = (*child)->parent()->name()+"::"+className; - - nsmap.value().insert(className,(*child)); - ncmap.value().insert(className,(*child)); - } - else if ((*child)->subType() == Node::QmlClass) { - // Insert QML elements into the since and element maps. - QString className = (*child)->name(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - className = (*child)->parent()->name()+"::"+className; - - nsmap.value().insert(className,(*child)); - nqcmap.value().insert(className,(*child)); - } - else if ((*child)->type() == Node::QmlProperty) { - // Insert QML properties into the since map. - QString propertyName = (*child)->name(); - nsmap.value().insert(propertyName,(*child)); - } - } - else { - // Insert external documents into the general since map. - QString name = (*child)->name(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - name = (*child)->parent()->name()+"::"+name; - - nsmap.value().insert(name,(*child)); - } - - // Find child nodes with since commands. - if ((*child)->isInnerNode()) { - findAllSince(static_cast<InnerNode *>(*child)); - } - } - ++child; - } -} - QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index e66915b..e5e9747 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -57,12 +57,6 @@ QT_BEGIN_NAMESPACE -typedef QMap<QString, const Node*> NodeMap; -typedef QMultiMap<QString, Node*> NodeMultiMap; -typedef QMap<QString, NodeMultiMap> NewSinceMaps; -typedef QMap<Node*, NodeMultiMap> ParentMaps; -typedef QMap<QString, NodeMap> NewClassMaps; - class ClassNode; class Config; class CodeMarker; @@ -158,7 +152,6 @@ class Generator QString getMetadataElement(const InnerNode* inner, const QString& t); QStringList getMetadataElements(const InnerNode* inner, const QString& t); - void findAllSince(const InnerNode *node); private: void generateReimplementedFrom(const FunctionNode *func, @@ -187,11 +180,6 @@ class Generator const NodeList& subs, CodeMarker *marker); - static QString sinceTitles[]; - NewSinceMaps newSinceMaps; - NewClassMaps newClassMaps; - NewClassMaps newQmlClassMaps; - private: QString amp; QString lt; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 655c3b4..52da178 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -66,6 +66,25 @@ bool HtmlGenerator::debugging_on = false; QString HtmlGenerator::divNavTop = ""; +QString HtmlGenerator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New QML Elements", + " New QML Properties", + " New QML Signals", + " New QML Methods", + "" + }; + static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); @@ -587,18 +606,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, ncmap = newClassMaps.find(atom->string()); NewClassMaps::const_iterator nqcmap; nqcmap = newQmlClassMaps.find(atom->string()); - if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) { QList<Section> sections; QList<Section>::ConstIterator s; - for (int i=0; i<LastSinceType; ++i) sections.append(Section(sinceTitle(i),QString(),QString(),QString())); NodeMultiMap::const_iterator n = nsmap.value().constBegin(); - while (n != nsmap.value().constEnd()) { - const Node* node = n.value(); switch (node->type()) { case Node::Fake: @@ -1331,7 +1346,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) // Generate brief text and status for modules. generateBrief(fake, marker); generateStatus(fake, marker); - generateSince(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { out() << "<a name=\"" << registerRef("namespaces") << "\"></a>" << divNavTop << "\n"; @@ -1348,7 +1362,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) // Generate brief text and status for modules. generateBrief(fake, marker); generateStatus(fake, marker); - generateSince(fake, marker); out() << "<ul>\n"; @@ -1380,7 +1393,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); generateQmlInstantiates(qml_cn, marker); - generateSince(qml_cn, marker); QString allQmlMembersLink = generateAllQmlMembersFile(qml_cn, marker); if (!allQmlMembersLink.isEmpty()) { @@ -2230,6 +2242,9 @@ void HtmlGenerator::generateCompactList(const Node *relative, for (int i=0; i<NumParagraphs; i++) // i = 0..36 paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count(); + int curParNr = 0; + int curParOffset = 0; + /* Output the alphabet as a row of links. */ @@ -2247,12 +2262,8 @@ void HtmlGenerator::generateCompactList(const Node *relative, Output a <div> element to contain all the <dl> elements. */ out() << "<div class=\"flowListDiv\">\n"; - numTableRows = 0; - - int curParNr = 0; - int curParOffset = 0; - for (int i=0; i<classMap.count(); i++) { + for (int i=0; i<classMap.count()-1; i++) { while ((curParNr < NumParagraphs) && (curParOffset == paragraph[curParNr].count())) { ++curParNr; @@ -2313,9 +2324,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "</dd>\n"; curParOffset++; } - if (classMap.count() > 0) - out() << "</dl>\n"; - + out() << "</dl>\n"; out() << "</div>\n"; } @@ -3348,6 +3357,70 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) } } +/*! + For generating the "New Classes... in 4.6" section on the + What's New in 4.6" page. + */ +void HtmlGenerator::findAllSince(const InnerNode *node) +{ + NodeList::const_iterator child = node->childNodes().constBegin(); + while (child != node->childNodes().constEnd()) { + QString sinceVersion = (*child)->since(); + if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) { + NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion); + if (nsmap == newSinceMaps.end()) + nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap()); + NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); + if (ncmap == newClassMaps.end()) + ncmap = newClassMaps.insert(sinceVersion,NodeMap()); + NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); + if (nqcmap == newQmlClassMaps.end()) + nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); + + if ((*child)->type() == Node::Function) { + FunctionNode *func = static_cast<FunctionNode *>(*child); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + nsmap.value().insert(func->name(),(*child)); + } + } + else if ((*child)->url().isEmpty()) { + if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + ncmap.value().insert(className,(*child)); + } + else if ((*child)->subType() == Node::QmlClass) { + QString className = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + className = (*child)->parent()->name()+"::"+className; + nsmap.value().insert(className,(*child)); + nqcmap.value().insert(className,(*child)); + } + } + else { + QString name = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + name = (*child)->parent()->name()+"::"+name; + nsmap.value().insert(name,(*child)); + } + if ((*child)->isInnerNode()) { + findAllSince(static_cast<InnerNode *>(*child)); + } + } + ++child; + } +} + void HtmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index e36c562..70ec0b7 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -56,6 +56,12 @@ QT_BEGIN_NAMESPACE +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, NodeMultiMap> NewSinceMaps; +typedef QMap<Node*, NodeMultiMap> ParentMaps; +typedef QMap<QString, const Node*> NodeMap; +typedef QMap<QString, NodeMap> NewClassMaps; + class HelpProjectWriter; class HtmlGenerator : public PageGenerator @@ -218,6 +224,7 @@ class HtmlGenerator : public PageGenerator void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); + void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); virtual QString getLink(const Atom *atom, @@ -285,6 +292,10 @@ class HtmlGenerator : public PageGenerator NodeMap qmlClasses; QMap<QString, NodeMap > funcIndex; QMap<Text, const Node *> legaleseTexts; + NewSinceMaps newSinceMaps; + static QString sinceTitles[]; + NewClassMaps newClassMaps; + NewClassMaps newQmlClassMaps; static int id; public: static bool debugging_on; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 87bbd93..56d76d3 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -157,16 +157,6 @@ void Node::setLink(LinkType linkType, const QString &link, const QString &desc) } /*! - Sets the information about the project and version a node was introduced - in. The string is simplified, removing excess whitespace before being - stored. -*/ -void Node::setSince(const QString &since) -{ - sinc = since.simplified(); -} - -/*! Returns a string representing the access specifier. */ QString Node::accessString() const @@ -555,7 +545,8 @@ void InnerNode::removeFromRelated() */ void InnerNode::deleteChildren() { - qDeleteAll(children); + NodeList childrenCopy = children; // `children` will be changed in ~Node() + qDeleteAll(childrenCopy); } /*! diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index cb16bea..e1e9440 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -151,7 +151,7 @@ class Node void setDoc(const Doc& doc, bool replace = false); void setStatus(Status status) { sta = status; } void setThreadSafeness(ThreadSafeness safeness) { saf = safeness; } - void setSince(const QString &since); + void setSince(const QString &since) { sinc = since; } void setRelates(InnerNode* pseudoParent); void setModuleName(const QString &module) { mod = module; } void setLink(LinkType linkType, const QString &link, const QString &desc); |