diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-09-24 14:28:42 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:10:10 -0300 |
commit | 2bfe59a2b8a588b338da7b9472d4ec6f66c2d10a (patch) | |
tree | af6a5fa06e12204cd3cf1fa1e256d7f4579b4966 /qtdocparser.cpp | |
parent | f3a9cdbeb96ba5346f11ea5ef618b127684cfc72 (diff) |
Add retrieveModuleDocumentation(modName) function to DocParser API.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'qtdocparser.cpp')
-rw-r--r-- | qtdocparser.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/qtdocparser.cpp b/qtdocparser.cpp index 66977c611..e15d438c9 100644 --- a/qtdocparser.cpp +++ b/qtdocparser.cpp @@ -28,24 +28,7 @@ Documentation QtDocParser::retrieveModuleDocumentation() { - // TODO: This method of acquiring the module name supposes that the target language uses - // dots as module separators in package names. Improve this. - QString moduleName = QString(packageName()).remove(0, packageName().lastIndexOf('.') + 1); - QString sourceFile = documentationDataDirectory() + '/' + moduleName.toLower() + ".xml"; - - if (!QFile::exists(sourceFile)) { - ReportHandler::warning("Can't find qdoc3 file for module " - + packageName() + ", tried: " - + sourceFile); - return Documentation(); - } - - QXmlQuery xquery; - xquery.setFocus(QUrl(sourceFile)); - - // Module documentation - QString query = "/WebXML/document/page[@name=\"" + moduleName + "\"]/description"; - return Documentation(getDocumentation(xquery, query, DocModificationList())); + return retrieveModuleDocumentation(packageName()); } void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass) @@ -164,3 +147,25 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass) meta_enum->setDocumentation(doc); } } + +Documentation QtDocParser::retrieveModuleDocumentation(const QString& name) +{ + // TODO: This method of acquiring the module name supposes that the target language uses + // dots as module separators in package names. Improve this. + QString moduleName = QString(name).remove(0, name.lastIndexOf('.') + 1); + QString sourceFile = documentationDataDirectory() + '/' + moduleName.toLower() + ".xml"; + + if (!QFile::exists(sourceFile)) { + ReportHandler::warning("Can't find qdoc3 file for module " + + name + ", tried: " + + sourceFile); + return Documentation(); + } + + QXmlQuery xquery; + xquery.setFocus(QUrl(sourceFile)); + + // Module documentation + QString query = "/WebXML/document/page[@name=\"" + moduleName + "\"]/description"; + return Documentation(getDocumentation(xquery, query, DocModificationList())); +} |