qdoc: Add index of obsolete members to obsolete page
qdoc has been modified to emit a compact list of the classes that have one or more obsolete members. The command is: \generatelist obsoletecppmembers This generates an index of all such classes, where each class name is a link to the class's subpage of obsolete members. A class's subpage of obsolete members is also accessible from the class's reference page, but now it is also accessible from this index. Also, The command shown has been added to the page obsoleteclasses.html in the generated output. This page already contains the index of obsolete classes. Currently, no such output is generated for QML types and QML types with obsolete members. But qdoc does accept commands for those: \generatelist obsoleteqmltypes and \generatelist obsoleteqmlmembers ...but qdoc doesn't know what to do with those commands yet. Task-number: QTBUG-30270 Change-Id: If19a3b977f64c948e4bd6f14a9e0a287419baa8a Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
parent
3ae271523f
commit
c77f7229d5
@ -455,39 +455,6 @@ void CodeMarker::insert(FastSection &fastSection,
|
||||
}
|
||||
}
|
||||
|
||||
void CodeMarker::insert(FastSection& fastSection,
|
||||
Node* node,
|
||||
SynopsisStyle style,
|
||||
bool /* includeClassName */)
|
||||
{
|
||||
if (node->status() == Node::Compat || node->status() == Node::Obsolete)
|
||||
return;
|
||||
|
||||
bool inheritedMember = false;
|
||||
InnerNode* parent = node->parent();
|
||||
if (parent && (parent->type() == Node::Document) &&
|
||||
(parent->subType() == Node::QmlPropertyGroup)) {
|
||||
parent = parent->parent();
|
||||
}
|
||||
inheritedMember = (parent != fastSection.parent_);
|
||||
|
||||
if (!inheritedMember || style == Subpage) {
|
||||
QString key = sortName(node);
|
||||
if (!fastSection.memberMap.contains(key))
|
||||
fastSection.memberMap.insert(key, node);
|
||||
}
|
||||
else {
|
||||
if ((parent->type() == Node::Document) && (parent->subType() == Node::QmlClass)) {
|
||||
if (fastSection.inherited.isEmpty()
|
||||
|| fastSection.inherited.last().first != parent) {
|
||||
QPair<InnerNode*, int> p(parent, 0);
|
||||
fastSection.inherited.append(p);
|
||||
}
|
||||
fastSection.inherited.last().second++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if \a node represents a reimplemented member
|
||||
function in the class of the FastSection \a fs. If it is
|
||||
|
@ -178,10 +178,6 @@ protected:
|
||||
Node *node,
|
||||
SynopsisStyle style,
|
||||
Status status);
|
||||
void insert(FastSection& fastSection,
|
||||
Node* node,
|
||||
SynopsisStyle style,
|
||||
bool includeClassName = false);
|
||||
bool insertReimpFunc(FastSection& fs, Node* node, Status status);
|
||||
void append(QList<Section>& sectionList, const FastSection& fastSection, bool includeKeys = false);
|
||||
|
||||
|
@ -237,7 +237,7 @@ void CodeParser::processCommonMetaCommand(const Location& location,
|
||||
node->setStatus(Node::Compat);
|
||||
}
|
||||
else if (command == COMMAND_DEPRECATED) {
|
||||
node->setStatus(Node::Deprecated);
|
||||
node->setStatus(Node::Obsolete);
|
||||
}
|
||||
else if ((command == COMMAND_INGROUP) || (command == COMMAND_INPUBLICGROUP)) {
|
||||
// Note: \ingroup and \inpublicgroup are now the same.
|
||||
|
@ -473,8 +473,6 @@ DitaXmlGenerator::DitaXmlGenerator()
|
||||
inTableBody(false),
|
||||
noLinks(false),
|
||||
obsoleteLinks(false),
|
||||
offlineDocs(true),
|
||||
codeIndent(0),
|
||||
divNestingLevel(0),
|
||||
sectionNestingLevel(0),
|
||||
tableColumnCount(0),
|
||||
@ -573,8 +571,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config)
|
||||
customHeadElements = config.getStringList(DitaXmlGenerator::format() +
|
||||
Config::dot +
|
||||
DITAXMLGENERATOR_CUSTOMHEADELEMENTS);
|
||||
// The following line was changed to fix QTBUG-27798
|
||||
//codeIndent = config.getInt(CONFIG_CODEINDENT);
|
||||
version = config.getString(CONFIG_VERSION);
|
||||
vrm = version.split(QLatin1Char('.'));
|
||||
}
|
||||
@ -1024,10 +1020,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
|
||||
generateAnnotatedList(relative, marker, qdb_->getCppClasses());
|
||||
}
|
||||
else if (atom->string() == "classes") {
|
||||
generateCompactList(relative, qdb_->getCppClasses(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getCppClasses(), true);
|
||||
}
|
||||
else if (atom->string() == "qmlclasses") {
|
||||
generateCompactList(relative, qdb_->getQmlTypes(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getQmlTypes(), true);
|
||||
}
|
||||
else if (atom->string().contains("classesbymodule")) {
|
||||
QString arg = atom->string().trimmed();
|
||||
@ -1046,10 +1042,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
|
||||
generateClassHierarchy(relative, qdb_->getCppClasses());
|
||||
}
|
||||
else if (atom->string() == "compatclasses") {
|
||||
generateCompactList(relative, qdb_->getCompatibilityClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getCompatibilityClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteclasses") {
|
||||
generateCompactList(relative, qdb_->getObsoleteClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteqmltypes") {
|
||||
generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoletecppmembers") {
|
||||
generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteqmlmembers") {
|
||||
generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false);
|
||||
}
|
||||
else if (atom->string() == "functionindex") {
|
||||
generateFunctionIndex(relative);
|
||||
@ -1058,10 +1063,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
|
||||
generateLegaleseList(relative, marker);
|
||||
}
|
||||
else if (atom->string() == "mainclasses") {
|
||||
generateCompactList(relative, qdb_->getMainClasses(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getMainClasses(), true);
|
||||
}
|
||||
else if (atom->string() == "services") {
|
||||
generateCompactList(relative, qdb_->getServiceClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getServiceClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "overviews") {
|
||||
generateOverviewList(relative);
|
||||
@ -1176,9 +1181,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
|
||||
writeCharacters(protectEnc((*s).name));
|
||||
writeEndTag(); // </p>
|
||||
if (idx == Class)
|
||||
generateCompactList(0, ncmap, false, QString("Q"));
|
||||
generateCompactList(Generic, 0, ncmap, false, QString("Q"));
|
||||
else if (idx == QmlClass)
|
||||
generateCompactList(0, nqcmap, false, QString("Q"));
|
||||
generateCompactList(Generic, 0, nqcmap, false, QString("Q"));
|
||||
else if (idx == MemberFunction) {
|
||||
ParentMaps parentmaps;
|
||||
ParentMaps::iterator pmap;
|
||||
@ -2599,7 +2604,7 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node,
|
||||
inLink_ = false;
|
||||
}
|
||||
|
||||
void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner,
|
||||
void DitaXmlGenerator::generateLowStatusMembers(InnerNode* inner,
|
||||
CodeMarker* marker,
|
||||
CodeMarker::Status status)
|
||||
{
|
||||
@ -2620,6 +2625,9 @@ void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner,
|
||||
if (sections.isEmpty())
|
||||
return;
|
||||
|
||||
if (status == CodeMarker::Obsolete)
|
||||
inner->setObsoleteLink(fileBase(inner) + "-obsolete." + fileExtension());
|
||||
|
||||
QList<Section>::ConstIterator s = sections.constBegin();
|
||||
while (s != sections.constEnd()) {
|
||||
if ((*s).name == "Member Function Documentation") {
|
||||
@ -2779,7 +2787,8 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative,
|
||||
normally you let it figure it out itself by looking at
|
||||
the name of the first and last classes in \a classMap.
|
||||
*/
|
||||
void DitaXmlGenerator::generateCompactList(const Node* relative,
|
||||
void DitaXmlGenerator::generateCompactList(ListType , // currently not needed for DITA
|
||||
const Node* relative,
|
||||
const NodeMap& classMap,
|
||||
bool includeAlphabet,
|
||||
QString commonPrefix)
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <qregexp.h>
|
||||
#include <qxmlstream.h>
|
||||
#include "codemarker.h"
|
||||
#include "config.h"
|
||||
#include "generator.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -374,16 +373,12 @@ private:
|
||||
Doc::Sections sectioningUnit,
|
||||
int numColumns,
|
||||
const Node* relative = 0);
|
||||
void generateLowStatusMembers(const InnerNode* inner,
|
||||
CodeMarker* marker,
|
||||
CodeMarker::Status status);
|
||||
QString generateLowStatusMemberFile(const InnerNode* inner,
|
||||
CodeMarker* marker,
|
||||
CodeMarker::Status status);
|
||||
void generateLowStatusMembers(InnerNode* inner, CodeMarker* marker, CodeMarker::Status status);
|
||||
void generateClassHierarchy(const Node* relative, NodeMap& classMap);
|
||||
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap);
|
||||
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes);
|
||||
void generateCompactList(const Node* relative,
|
||||
void generateCompactList(ListType listType,
|
||||
const Node* relative,
|
||||
const NodeMap& classMap,
|
||||
bool includeAlphabet,
|
||||
QString commonPrefix = QString());
|
||||
@ -484,9 +479,7 @@ private:
|
||||
|
||||
bool noLinks;
|
||||
bool obsoleteLinks;
|
||||
bool offlineDocs;
|
||||
|
||||
int codeIndent;
|
||||
int divNestingLevel;
|
||||
int sectionNestingLevel;
|
||||
int tableColumnCount;
|
||||
|
@ -68,6 +68,7 @@ QStringList Generator::imageDirs;
|
||||
QStringList Generator::imageFiles;
|
||||
QMap<QString, QStringList> Generator::imgFileExts;
|
||||
QString Generator::outDir_;
|
||||
QString Generator::outSubdir_;
|
||||
QSet<QString> Generator::outputFormats;
|
||||
QHash<QString, QString> Generator::outputPrefixes;
|
||||
QString Generator::project;
|
||||
@ -1474,10 +1475,13 @@ void Generator::initialize(const Config &config)
|
||||
outputFormats = config.getOutputFormats();
|
||||
if (!outputFormats.isEmpty()) {
|
||||
outDir_ = config.getOutputDir();
|
||||
|
||||
if (outDir_.isEmpty())
|
||||
if (outDir_.isEmpty()) {
|
||||
config.lastLocation().fatal(tr("No output directory specified in "
|
||||
"configuration file or on the command line"));
|
||||
}
|
||||
else {
|
||||
outSubdir_ = outDir_.mid(outDir_.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
QDir dirInfo;
|
||||
if (dirInfo.exists(outDir_)) {
|
||||
@ -1622,8 +1626,12 @@ void Generator::augmentImageDirs(QSet<QString>& moreImageDirs)
|
||||
}
|
||||
}
|
||||
|
||||
void Generator::initializeGenerator(const Config & /* config */)
|
||||
/*!
|
||||
Sets the generator's pointer to the Config instance.
|
||||
*/
|
||||
void Generator::initializeGenerator(const Config& config)
|
||||
{
|
||||
config_ = &config;
|
||||
}
|
||||
|
||||
bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType)
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtextstream.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "node.h"
|
||||
#include "text.h"
|
||||
|
||||
@ -70,6 +70,7 @@ class Generator
|
||||
|
||||
public:
|
||||
enum Passes { Both, Prepare, Generate };
|
||||
enum ListType { Generic, Obsolete };
|
||||
|
||||
Generator();
|
||||
virtual ~Generator();
|
||||
@ -81,11 +82,13 @@ public:
|
||||
virtual void terminateGenerator();
|
||||
|
||||
QString fullDocumentLocation(const Node *node, bool subdir = false);
|
||||
const Config* config() { return config_; }
|
||||
|
||||
static Generator *currentGenerator() { return currentGenerator_; }
|
||||
static Generator *generatorForFormat(const QString& format);
|
||||
static void initialize(const Config& config);
|
||||
static const QString& outputDir() { return outDir_; }
|
||||
static const QString& outputSubdir() { return outSubdir_; }
|
||||
static void terminate();
|
||||
static void writeOutFileNames();
|
||||
static void augmentImageDirs(QSet<QString>& moreImageDirs);
|
||||
@ -192,6 +195,7 @@ private:
|
||||
static QMap<QString, QStringList> imgFileExts;
|
||||
static QString project;
|
||||
static QString outDir_;
|
||||
static QString outSubdir_;
|
||||
static QSet<QString> outputFormats;
|
||||
static QHash<QString, QString> outputPrefixes;
|
||||
static QStringList scriptDirs;
|
||||
@ -221,6 +225,7 @@ private:
|
||||
QRegExp tag;
|
||||
|
||||
protected:
|
||||
const Config* config_;
|
||||
QDocDatabase* qdb_;
|
||||
bool inLink_;
|
||||
bool inContents_;
|
||||
|
@ -470,10 +470,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
|
||||
generateAnnotatedList(relative, marker, qdb_->getCppClasses());
|
||||
}
|
||||
else if (atom->string() == "classes") {
|
||||
generateCompactList(relative, qdb_->getCppClasses(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getCppClasses(), true);
|
||||
}
|
||||
else if (atom->string() == "qmlclasses") {
|
||||
generateCompactList(relative, qdb_->getQmlTypes(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getQmlTypes(), true);
|
||||
}
|
||||
else if (atom->string().contains("classesbymodule")) {
|
||||
QString arg = atom->string().trimmed();
|
||||
@ -492,10 +492,19 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
|
||||
generateClassHierarchy(relative, qdb_->getCppClasses());
|
||||
}
|
||||
else if (atom->string() == "compatclasses") {
|
||||
generateCompactList(relative, qdb_->getCompatibilityClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getCompatibilityClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteclasses") {
|
||||
generateCompactList(relative, qdb_->getObsoleteClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteqmltypes") {
|
||||
generateCompactList(Generic, relative, qdb_->getObsoleteQmlTypes(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoletecppmembers") {
|
||||
generateCompactList(Obsolete, relative, qdb_->getClassesWithObsoleteMembers(), false);
|
||||
}
|
||||
else if (atom->string() == "obsoleteqmlmembers") {
|
||||
generateCompactList(Obsolete, relative, qdb_->getQmlTypesWithObsoleteMembers(), false);
|
||||
}
|
||||
else if (atom->string() == "functionindex") {
|
||||
generateFunctionIndex(relative);
|
||||
@ -504,10 +513,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
|
||||
generateLegaleseList(relative, marker);
|
||||
}
|
||||
else if (atom->string() == "mainclasses") {
|
||||
generateCompactList(relative, qdb_->getMainClasses(), true);
|
||||
generateCompactList(Generic, relative, qdb_->getMainClasses(), true);
|
||||
}
|
||||
else if (atom->string() == "services") {
|
||||
generateCompactList(relative, qdb_->getServiceClasses(), false);
|
||||
generateCompactList(Generic, relative, qdb_->getServiceClasses(), false);
|
||||
}
|
||||
else if (atom->string() == "overviews") {
|
||||
generateOverviewList(relative);
|
||||
@ -640,9 +649,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
|
||||
<< "\"></a>\n";
|
||||
out() << "<h3>" << protectEnc((*s).name) << "</h3>\n";
|
||||
if (idx == Class)
|
||||
generateCompactList(0, ncmap, false, QString("Q"));
|
||||
generateCompactList(Generic, 0, ncmap, false, QString("Q"));
|
||||
else if (idx == QmlClass)
|
||||
generateCompactList(0, nqcmap, false, QString("Q"));
|
||||
generateCompactList(Generic, 0, nqcmap, false, QString("Q"));
|
||||
else if (idx == MemberFunction) {
|
||||
ParentMaps parentmaps;
|
||||
ParentMaps::iterator pmap;
|
||||
@ -1131,9 +1140,10 @@ void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
|
||||
QString obsoleteLink = generateLowStatusMemberFile(inner,
|
||||
marker,
|
||||
CodeMarker::Obsolete);
|
||||
if (!obsoleteLink.isEmpty())
|
||||
if (!obsoleteLink.isEmpty()) {
|
||||
out() << "<li><a href=\"" << obsoleteLink << "\">"
|
||||
<< "Obsolete members</a></li>\n";
|
||||
}
|
||||
|
||||
QString compatLink = generateLowStatusMemberFile(inner,
|
||||
marker,
|
||||
@ -1481,9 +1491,10 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
|
||||
QString obsoleteLink = generateLowStatusMemberFile(dn,
|
||||
marker,
|
||||
CodeMarker::Obsolete);
|
||||
if (!obsoleteLink.isEmpty())
|
||||
if (!obsoleteLink.isEmpty()) {
|
||||
out() << "<li><a href=\"" << obsoleteLink << "\">"
|
||||
<< "Obsolete members</a></li>\n";
|
||||
}
|
||||
|
||||
QString compatLink = generateLowStatusMemberFile(dn,
|
||||
marker,
|
||||
@ -2105,7 +2116,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn,
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner,
|
||||
QString HtmlGenerator::generateLowStatusMemberFile(InnerNode *inner,
|
||||
CodeMarker *marker,
|
||||
CodeMarker::Status status)
|
||||
{
|
||||
@ -2133,6 +2144,10 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner,
|
||||
title = "Obsolete Members for " + inner->name();
|
||||
fileName = fileBase(inner) + "-obsolete." + fileExtension();
|
||||
}
|
||||
if (status == CodeMarker::Obsolete) {
|
||||
QString link = QString("../" + Generator::outputSubdir() + QLatin1Char('/')) + fileName;
|
||||
inner->setObsoleteLink(link);
|
||||
}
|
||||
|
||||
beginSubPage(inner, fileName);
|
||||
generateHeader(title, inner, marker);
|
||||
@ -2292,7 +2307,8 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
|
||||
normally you let it figure it out itself by looking at
|
||||
the name of the first and last classes in \a classMap.
|
||||
*/
|
||||
void HtmlGenerator::generateCompactList(const Node *relative,
|
||||
void HtmlGenerator::generateCompactList(ListType listType,
|
||||
const Node *relative,
|
||||
const NodeMap &classMap,
|
||||
bool includeAlphabet,
|
||||
QString commonPrefix)
|
||||
@ -2452,11 +2468,19 @@ void HtmlGenerator::generateCompactList(const Node *relative,
|
||||
for (int i=0; i<curParOffset; i++)
|
||||
++it;
|
||||
|
||||
if (listType == Generic) {
|
||||
/*
|
||||
Previously, we used generateFullName() for this, but we
|
||||
require some special formatting.
|
||||
*/
|
||||
out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">";
|
||||
}
|
||||
else if (listType == Obsolete) {
|
||||
QString fileName = fileBase(it.value()) + "-obsolete." + fileExtension();
|
||||
QString link = QString("../" + it.value()->outputSubdirectory() +
|
||||
QLatin1Char('/')) + fileName;
|
||||
out() << "<a href=\"" << link << "\">";
|
||||
}
|
||||
|
||||
QStringList pieces;
|
||||
if (it.value()->subType() == Node::QmlClass)
|
||||
|
@ -150,13 +150,14 @@ private:
|
||||
CodeMarker *marker);
|
||||
QString generateAllQmlMembersFile(const QmlClassNode* qml_cn,
|
||||
CodeMarker* marker);
|
||||
QString generateLowStatusMemberFile(const InnerNode *inner,
|
||||
QString generateLowStatusMemberFile(InnerNode *inner,
|
||||
CodeMarker *marker,
|
||||
CodeMarker::Status status);
|
||||
void generateClassHierarchy(const Node *relative, NodeMap &classMap);
|
||||
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap);
|
||||
void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes);
|
||||
void generateCompactList(const Node *relative,
|
||||
void generateCompactList(ListType listType,
|
||||
const Node *relative,
|
||||
const NodeMap &classMap,
|
||||
bool includeAlphabet,
|
||||
QString commonPrefix = QString());
|
||||
|
@ -167,7 +167,11 @@ public:
|
||||
void setAccess(Access access) { access_ = access; }
|
||||
void setLocation(const Location& location) { loc = location; }
|
||||
void setDoc(const Doc& doc, bool replace = false);
|
||||
void setStatus(Status status) { status_ = status; }
|
||||
void setStatus(Status status) {
|
||||
if (status_ == Obsolete && status == Deprecated)
|
||||
return;
|
||||
status_ = status;
|
||||
}
|
||||
void setThreadSafeness(ThreadSafeness safeness) { safeness_ = safeness; }
|
||||
void setSince(const QString &since);
|
||||
void setRelates(InnerNode* pseudoParent);
|
||||
@ -218,6 +222,8 @@ public:
|
||||
QString url() const;
|
||||
virtual QString nameForLists() const { return name_; }
|
||||
virtual QString outputFileName() const { return QString(); }
|
||||
virtual QString obsoleteLink() const { return QString(); }
|
||||
virtual void setObsoleteLink(const QString& ) { };
|
||||
|
||||
Access access() const { return access_; }
|
||||
QString accessString() const;
|
||||
@ -253,6 +259,7 @@ public:
|
||||
QmlClassNode* qmlClassNode();
|
||||
ClassNode* declarativeCppNode();
|
||||
const QString& outputSubdirectory() const { return outSubDir_; }
|
||||
void setOutputSubdirectory(const QString& t) { outSubDir_ = t; }
|
||||
QString fullDocumentName() const;
|
||||
static QString cleanId(QString str);
|
||||
QString idForNode() const;
|
||||
@ -430,6 +437,8 @@ public:
|
||||
ClassNode(InnerNode* parent, const QString& name);
|
||||
virtual ~ClassNode() { }
|
||||
virtual bool isClass() const { return true; }
|
||||
virtual QString obsoleteLink() const { return obsoleteLink_; }
|
||||
virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; };
|
||||
|
||||
void addBaseClass(Access access,
|
||||
ClassNode* node,
|
||||
@ -455,6 +464,7 @@ private:
|
||||
QList<RelatedClass> ignoredBases;
|
||||
bool abstract_;
|
||||
QString sname;
|
||||
QString obsoleteLink_;
|
||||
QmlClassNode* qmlelement;
|
||||
};
|
||||
|
||||
@ -561,6 +571,8 @@ public:
|
||||
virtual void setAbstract(bool b) { abstract_ = b; }
|
||||
virtual bool isInternal() const { return (status() == Internal); }
|
||||
virtual QString qmlFullBaseName() const;
|
||||
virtual QString obsoleteLink() const { return obsoleteLink_; }
|
||||
virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; };
|
||||
const ImportList& importList() const { return importList_; }
|
||||
void setImportList(const ImportList& il) { importList_ = il; }
|
||||
const QString& qmlBaseName() const { return baseName_; }
|
||||
@ -582,6 +594,7 @@ private:
|
||||
bool cnodeRequired_;
|
||||
ClassNode* cnode_;
|
||||
QString baseName_;
|
||||
QString obsoleteLink_;
|
||||
QmlClassNode* baseNode_;
|
||||
ImportList importList_;
|
||||
};
|
||||
|
@ -430,6 +430,7 @@ void QDocDatabase::buildCollections()
|
||||
findAllLegaleseTexts(treeRoot());
|
||||
findAllNamespaces(treeRoot());
|
||||
findAllSince(treeRoot());
|
||||
findAllObsoleteThings(treeRoot());
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -451,9 +452,6 @@ void QDocDatabase::findAllClasses(const InnerNode* node)
|
||||
if ((*c)->status() == Node::Compat) {
|
||||
compatClasses_.insert(className, *c);
|
||||
}
|
||||
else if ((*c)->status() == Node::Obsolete) {
|
||||
obsoleteClasses_.insert(className, *c);
|
||||
}
|
||||
else {
|
||||
nonCompatClasses_.insert(className, *c);
|
||||
if ((*c)->status() == Node::Main)
|
||||
@ -547,6 +545,98 @@ void QDocDatabase::findAllNamespaces(const InnerNode* node)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Finds all nodes with status = Obsolete and sorts them into
|
||||
maps. They can be C++ classes, QML types, or they can be
|
||||
functions, enum types, typedefs, methods, etc.
|
||||
*/
|
||||
void QDocDatabase::findAllObsoleteThings(const InnerNode* node)
|
||||
{
|
||||
NodeList::const_iterator c = node->childNodes().constBegin();
|
||||
while (c != node->childNodes().constEnd()) {
|
||||
if ((*c)->access() != Node::Private) {
|
||||
QString name = (*c)->name();
|
||||
if ((*c)->status() == Node::Obsolete) {
|
||||
if ((*c)->type() == Node::Class) {
|
||||
if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace &&
|
||||
!(*c)->parent()->name().isEmpty())
|
||||
name = (*c)->parent()->name() + "::" + name;
|
||||
obsoleteClasses_.insert(name, *c);
|
||||
}
|
||||
else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) {
|
||||
if (name.startsWith(QLatin1String("QML:")))
|
||||
name = name.mid(4);
|
||||
name = (*c)->qmlModuleIdentifier() + "::" + name;
|
||||
obsoleteQmlTypes_.insert(name,*c);
|
||||
}
|
||||
}
|
||||
else if ((*c)->type() == Node::Class) {
|
||||
InnerNode* n = static_cast<InnerNode*>(*c);
|
||||
bool inserted = false;
|
||||
NodeList::const_iterator p = n->childNodes().constBegin();
|
||||
while (p != n->childNodes().constEnd()) {
|
||||
if ((*p)->access() != Node::Private) {
|
||||
switch ((*p)->type()) {
|
||||
case Node::Enum:
|
||||
case Node::Typedef:
|
||||
case Node::Function:
|
||||
case Node::Property:
|
||||
case Node::Variable:
|
||||
if ((*p)->status() == Node::Obsolete) {
|
||||
if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace &&
|
||||
!(*c)->parent()->name().isEmpty())
|
||||
name = (*c)->parent()->name() + "::" + name;
|
||||
classesWithObsoleteMembers_.insert(name, *c);
|
||||
inserted = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inserted)
|
||||
break;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) {
|
||||
InnerNode* n = static_cast<InnerNode*>(*c);
|
||||
bool inserted = false;
|
||||
NodeList::const_iterator p = n->childNodes().constBegin();
|
||||
while (p != n->childNodes().constEnd()) {
|
||||
if ((*p)->access() != Node::Private) {
|
||||
switch ((*c)->type()) {
|
||||
case Node::QmlProperty:
|
||||
case Node::QmlSignal:
|
||||
case Node::QmlSignalHandler:
|
||||
case Node::QmlMethod:
|
||||
if ((*c)->parent()) {
|
||||
Node* parent = (*c)->parent();
|
||||
if (parent->subType() == Node::QmlPropertyGroup && parent->parent())
|
||||
parent = parent->parent();
|
||||
if (parent && parent->subType() == Node::QmlClass && !parent->name().isEmpty())
|
||||
name = parent->name() + "::" + name;
|
||||
}
|
||||
qmlTypesWithObsoleteMembers_.insert(name,*c);
|
||||
inserted = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inserted)
|
||||
break;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
else if ((*c)->isInnerNode()) {
|
||||
findAllObsoleteThings(static_cast<InnerNode*>(*c));
|
||||
}
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Finds all the nodes where a \e{since} command appeared in the
|
||||
qdoc comment and sorts them into maps according to the kind of
|
||||
|
@ -113,6 +113,7 @@ class QDocDatabase
|
||||
void findAllFunctions(const InnerNode *node);
|
||||
void findAllLegaleseTexts(const InnerNode *node);
|
||||
void findAllNamespaces(const InnerNode *node);
|
||||
void findAllObsoleteThings(const InnerNode* node);
|
||||
void findAllSince(const InnerNode *node);
|
||||
void buildCollections();
|
||||
|
||||
@ -121,6 +122,9 @@ class QDocDatabase
|
||||
NodeMap& getMainClasses() { return mainClasses_; }
|
||||
NodeMap& getCompatibilityClasses() { return compatClasses_; }
|
||||
NodeMap& getObsoleteClasses() { return obsoleteClasses_; }
|
||||
NodeMap& getClassesWithObsoleteMembers() { return classesWithObsoleteMembers_; }
|
||||
NodeMap& getObsoleteQmlTypes() { return obsoleteQmlTypes_; }
|
||||
NodeMap& getQmlTypesWithObsoleteMembers() { return qmlTypesWithObsoleteMembers_; }
|
||||
NodeMap& getNamespaces() { return namespaceIndex_; }
|
||||
NodeMap& getServiceClasses() { return serviceClasses_; }
|
||||
NodeMap& getQmlTypes() { return qmlClasses_; }
|
||||
@ -223,6 +227,9 @@ class QDocDatabase
|
||||
NodeMap mainClasses_;
|
||||
NodeMap compatClasses_;
|
||||
NodeMap obsoleteClasses_;
|
||||
NodeMap classesWithObsoleteMembers_;
|
||||
NodeMap obsoleteQmlTypes_;
|
||||
NodeMap qmlTypesWithObsoleteMembers_;
|
||||
NodeMap namespaceIndex_;
|
||||
NodeMap serviceClasses_;
|
||||
NodeMap qmlClasses_;
|
||||
|
@ -136,6 +136,7 @@ void QDocIndexFiles::readIndexFile(const QString& path)
|
||||
QDir installDir(path.section('/', 0, -3) + "/outputdir");
|
||||
indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
|
||||
}
|
||||
project_ = indexElement.attribute("project", QString());
|
||||
|
||||
basesList_.clear();
|
||||
relatedList_.clear();
|
||||
@ -459,7 +460,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
|
||||
else if (status == "obsolete")
|
||||
node->setStatus(Node::Obsolete);
|
||||
else if (status == "deprecated")
|
||||
node->setStatus(Node::Deprecated);
|
||||
node->setStatus(Node::Obsolete);
|
||||
else if (status == "preliminary")
|
||||
node->setStatus(Node::Preliminary);
|
||||
else if (status == "commendable")
|
||||
@ -503,6 +504,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
|
||||
Doc doc(location, location, " ", emptySet); // placeholder
|
||||
node->setDoc(doc);
|
||||
node->setIndexNodeFlag();
|
||||
node->setOutputSubdirectory(project_.toLower());
|
||||
|
||||
if (node->isInnerNode()) {
|
||||
InnerNode* inner = static_cast<InnerNode*>(node);
|
||||
@ -712,7 +714,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
|
||||
status = "obsolete";
|
||||
break;
|
||||
case Node::Deprecated:
|
||||
status = "deprecated";
|
||||
status = "obsolete";
|
||||
break;
|
||||
case Node::Preliminary:
|
||||
status = "preliminary";
|
||||
@ -1203,6 +1205,7 @@ void QDocIndexFiles::generateIndex(const QString& fileName,
|
||||
writer.writeAttribute("url", url);
|
||||
writer.writeAttribute("title", title);
|
||||
writer.writeAttribute("version", qdb_->version());
|
||||
writer.writeAttribute("project", g->config()->getString(CONFIG_PROJECT));
|
||||
|
||||
generateIndexSections(writer, qdb_->treeRoot(), generateInternalNodes);
|
||||
|
||||
|
@ -86,6 +86,7 @@ class QDocIndexFiles
|
||||
static QDocIndexFiles* qdocIndexFiles_;
|
||||
QDocDatabase* qdb_;
|
||||
Generator* gen_;
|
||||
QString project_;
|
||||
QList<QPair<ClassNode*,QString> > basesList_;
|
||||
QList<QPair<FunctionNode*,QString> > relatedList_;
|
||||
|
||||
|
@ -316,7 +316,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
|
||||
}
|
||||
}
|
||||
else if (command == COMMAND_DEPRECATED) {
|
||||
node->setStatus(Node::Deprecated);
|
||||
node->setStatus(Node::Obsolete);
|
||||
}
|
||||
else if (command == COMMAND_INQMLMODULE) {
|
||||
qdb->addToQmlModule(args[0].first,node);
|
||||
|
Loading…
Reference in New Issue
Block a user