summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/puredocparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <[email protected]>2012-09-13 11:38:45 +0200
committerQt by Nokia <[email protected]>2012-09-14 15:23:15 +0200
commit14f7eb86ca2275d91f284279af5f77205d4ae3c0 (patch)
treeed4e91d6422dd814ac3e81739ad4a3b55bf050c7 /src/tools/qdoc/puredocparser.cpp
parent817a4474676b30a964de476d26bd70ddba3d379a (diff)
qdoc: Refactoring of qdoc data structures
This commit is the beginning of a significant overhaul of qdoc. A new class, QDocDatabase, is added, which will eventually encapsulate all the data structures used by qdoc. In this commit, the Tree class is made private and only accessible from QDocDatabase. Several maps structures are also moved into QDocDatabase from other classes. Much dead code and unused parameters were removed. Further simplification will follow. Change-Id: I237411c50f3ced0d2fc8d3b0fbfdf4e55880f8e9 Reviewed-by: Qt Doc Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jerome Pasion <[email protected]>
Diffstat (limited to 'src/tools/qdoc/puredocparser.cpp')
-rw-r--r--src/tools/qdoc/puredocparser.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp
index 0b6c7baa5be..6eee838a2ae 100644
--- a/src/tools/qdoc/puredocparser.cpp
+++ b/src/tools/qdoc/puredocparser.cpp
@@ -49,33 +49,42 @@
#include "codechunk.h"
#include "config.h"
#include "tokenizer.h"
-#include "tree.h"
#include <qdebug.h>
+#include "qdocdatabase.h"
#include "puredocparser.h"
QT_BEGIN_NAMESPACE
+/*!
+ Constructs the pure doc parser.
+*/
PureDocParser::PureDocParser()
{
}
+/*!
+ Destroys the pure doc parser.
+ */
PureDocParser::~PureDocParser()
{
}
+/*!
+ Returns a list of the kinds of files that the pure doc
+ parser is meant to parse. The elements of the list are
+ file suffixes.
+ */
QStringList PureDocParser::sourceFileNameFilter()
{
return QStringList() << "*.qdoc" << "*.qtx" << "*.qtt" << "*.js";
}
/*!
- Parse the source file identified by \a filePath and add its
- parsed contents to the big \a tree. \a location is used for
+ Parses the source file identified by \a filePath and adds its
+ parsed contents to the database. The \a location is used for
reporting errors.
*/
-void PureDocParser::parseSourceFile(const Location& location,
- const QString& filePath,
- Tree *tree)
+void PureDocParser::parseSourceFile(const Location& location, const QString& filePath)
{
QFile in(filePath);
currentFile_ = filePath;
@@ -86,7 +95,7 @@ void PureDocParser::parseSourceFile(const Location& location,
}
createOutputSubdirectory(location, filePath);
- reset(tree);
+ reset();
Location fileLocation(filePath);
Tokenizer fileTokenizer(fileLocation, in);
tokenizer = &fileTokenizer;
@@ -181,6 +190,7 @@ bool PureDocParser::processQdocComments()
}
}
+ Node* treeRoot = QDocDatabase::qdocDB()->treeRoot();
NodeList::Iterator n = nodes.begin();
QList<Doc>::Iterator d = docs.begin();
while (n != nodes.end()) {
@@ -188,7 +198,7 @@ bool PureDocParser::processQdocComments()
(*n)->setDoc(*d);
if ((*n)->isInnerNode() && ((InnerNode *)*n)->includes().isEmpty()) {
InnerNode *m = static_cast<InnerNode *>(*n);
- while (m->parent() != tree_->root())
+ while (m->parent() && m->parent() != treeRoot)
m = m->parent();
if (m == *n)
((InnerNode *)*n)->addInclude((*n)->name());