summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/qdoc/main.cpp')
-rw-r--r--src/tools/qdoc/main.cpp51
1 files changed, 19 insertions, 32 deletions
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index 0d668203e3..f7a4796292 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
- main.cpp
-*/
-
#include <qglobal.h>
#include <stdlib.h>
#include "codemarker.h"
@@ -57,14 +53,12 @@
#include "puredocparser.h"
#include "tokenizer.h"
#include "tree.h"
-
+#include "qdocdatabase.h"
#include "jscodemarker.h"
#include "qmlcodemarker.h"
#include "qmlcodeparser.h"
-
#include <qdatetime.h>
#include <qdebug.h>
-
#include "qtranslator.h"
#ifndef QT_BOOTSTRAPPED
# include "qcoreapplication.h"
@@ -105,7 +99,6 @@ static bool obsoleteLinks = false;
static QStringList defines;
static QStringList dependModules;
static QStringList indexDirs;
-static QHash<QString, Tree *> trees;
/*!
Print the help message to \c stdout.
@@ -240,12 +233,13 @@ static void processQdocconfFile(const QString &fileName)
Location langLocation = config.lastLocation();
/*
- Initialize the tree where all the parsed sources will be stored.
- The tree gets built as the source files are parsed, and then the
- documentation output is generated by traversing the tree.
+ Initialize the qdoc database, where all the parsed source files
+ will be stored. The database includes a tree of nodes, which gets
+ built as the source files are parsed. The documentation output is
+ generated by traversing that tree.
*/
- Tree *tree = new Tree;
- tree->setVersion(config.getString(CONFIG_VERSION));
+ QDocDatabase* qdb = QDocDatabase::qdocDB();
+ qdb->setVersion(config.getString(CONFIG_VERSION));
/*
By default, the only output format is HTML.
@@ -327,7 +321,7 @@ static void processQdocconfFile(const QString &fileName)
<< "There will probably be errors for missing links.";
}
}
- tree->readIndexes(indexFiles);
+ qdb->readIndexes(indexFiles);
QSet<QString> excludedDirs;
QSet<QString> excludedFiles;
@@ -390,14 +384,14 @@ static void processQdocconfFile(const QString &fileName)
CodeParser *codeParser = CodeParser::parserForHeaderFile(h.key());
if (codeParser) {
++parsed;
- codeParser->parseHeaderFile(config.location(), h.key(), tree);
+ codeParser->parseHeaderFile(config.location(), h.key());
usedParsers.insert(codeParser);
}
++h;
}
foreach (CodeParser *codeParser, usedParsers)
- codeParser->doneParsingHeaderFiles(tree);
+ codeParser->doneParsingHeaderFiles();
usedParsers.clear();
/*
@@ -410,24 +404,21 @@ static void processQdocconfFile(const QString &fileName)
CodeParser *codeParser = CodeParser::parserForSourceFile(s.key());
if (codeParser) {
++parsed;
- codeParser->parseSourceFile(config.location(), s.key(), tree);
+ codeParser->parseSourceFile(config.location(), s.key());
usedParsers.insert(codeParser);
}
++s;
}
foreach (CodeParser *codeParser, usedParsers)
- codeParser->doneParsingSourceFiles(tree);
+ codeParser->doneParsingSourceFiles();
/*
Now the big tree has been built from all the header and
source files. Resolve all the class names, function names,
targets, URLs, links, and other stuff that needs resolving.
*/
- tree->resolveGroups();
- tree->resolveTargets(tree->root());
- tree->resolveCppToQmlLinks();
- tree->resolveQmlInheritance();
+ qdb->resolveIssues();
/*
The tree is built and all the stuff that needed resolving
@@ -440,21 +431,18 @@ static void processQdocconfFile(const QString &fileName)
Generator* generator = Generator::generatorForFormat(*of);
if (generator == 0)
outputFormatsLocation.fatal(tr("Unknown output format '%1'").arg(*of));
- generator->generateTree(tree);
+ generator->generateTree();
++of;
}
/*
Generate the XML tag file, if it was requested.
*/
- QString tagFile = config.getString(CONFIG_TAGFILE);
- if (!tagFile.isEmpty()) {
- tree->generateTagFile(tagFile);
- }
+ qdb->generateTagFile(config.getString(CONFIG_TAGFILE));
//Generator::writeOutFileNames();
- tree->setVersion(QString());
+ QDocDatabase::qdocDB()->setVersion(QString());
Generator::terminate();
CodeParser::terminate();
CodeMarker::terminate();
@@ -467,11 +455,11 @@ static void processQdocconfFile(const QString &fileName)
qDeleteAll(translators);
#endif
#ifdef DEBUG_SHUTDOWN_CRASH
- qDebug() << "main(): Delete tree";
+ qDebug() << "main(): Delete qdoc database";
#endif
- delete tree;
+ QDocDatabase::destroyQdocDB();
#ifdef DEBUG_SHUTDOWN_CRASH
- qDebug() << "main(): Tree deleted";
+ qDebug() << "main(): qdoc database deleted";
#endif
}
@@ -584,7 +572,6 @@ int main(int argc, char **argv)
processQdocconfFile(qf);
}
- qDeleteAll(trees);
return EXIT_SUCCESS;
}