summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Ara├║jo <bruno.araujo@gmail.com>2011-11-18 10:10:10 -0800
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:20 -0300
commit5b610437268a09ca51f05efd36e270816f38258b (patch)
tree18819dcf505c4ac67861a472014ebad43f5fafba
parent93001f6a1fe8fa1fe7bf4d7d5dcda7fefae888b8 (diff)
parent9ccc24fdac4179c3f533509baed0da2dd4ee21f4 (diff)
Merge pull request #18 from baraujo/mastersb-0.10.9
Doxygen support
-rw-r--r--CMakeLists.txt1
-rw-r--r--doxygenparser.cpp42
-rw-r--r--doxygenparser.h5
3 files changed, 42 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca332704..fc43da6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -162,6 +162,7 @@ docparser.h
qtdocparser.h
include.h
typedatabase.h
+doxygenparser.h
)
if (BUILD_TESTS)
diff --git a/doxygenparser.cpp b/doxygenparser.cpp
index ccf14a91..09cdd386 100644
--- a/doxygenparser.cpp
+++ b/doxygenparser.cpp
@@ -46,6 +46,11 @@ QString getSectionKindAttr(const AbstractMetaFunction* func)
}
+Documentation DoxygenParser::retrieveModuleDocumentation()
+{
+ return retrieveModuleDocumentation(packageName());
+}
+
void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
{
if (!metaClass)
@@ -60,11 +65,12 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
doxyFileSuffix += ".xml";
const char* prefixes[] = { "class", "struct", "namespace" };
- const int numPrefixes = sizeof(prefixes);
+ const int numPrefixes = sizeof(prefixes) / sizeof(const char*);
+ bool isProperty = false;
QString doxyFilePath;
for (int i = 0; i < numPrefixes; ++i) {
- doxyFilePath = documentationDataDirectory() + "./" + prefixes[i] + doxyFileSuffix;
+ doxyFilePath = documentationDataDirectory() + "/" + prefixes[i] + doxyFileSuffix;
if (QFile::exists(doxyFilePath))
break;
doxyFilePath.clear();
@@ -101,6 +107,7 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
|| func->isPropertyResetter()) {
query += "[@kind=\"property\"]/memberdef/name[text()=\""
+ func->propertySpec()->name() + "\"]";
+ isProperty = true;
} else { // normal methods
QString kind = getSectionKindAttr(func);
query += "[@kind=\"" + kind + "-func\"]/memberdef/name[text()=\""
@@ -124,9 +131,15 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
}
}
}
- query += "/../detaileddescription";
+ if (!isProperty) {
+ query += "/../detaileddescription";
+ } else {
+ query = "(" + query;
+ query += "/../detaileddescription)[1]";
+ }
QString doc = getDocumentation(xquery, query, DocModificationList());
func->setDocumentation(doc);
+ isProperty = false;
}
//Fields
@@ -144,8 +157,29 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
//Enums
AbstractMetaEnumList enums = metaClass->enums();
foreach (AbstractMetaEnum *meta_enum, enums) {
- QString query = "/doxygen/compounddef/sectiondef/memberdef[@kind=\"enum\"]/name[text()=\"" + meta_enum->name() + "\"]/../detaileddescription";
+ QString query = "/doxygen/compounddef/sectiondef/memberdef[@kind=\"enum\"]/name[text()=\"" + meta_enum->name() + "\"]/..";
QString doc = getDocumentation(xquery, query, DocModificationList());
meta_enum->setDocumentation(doc);
}
+
+}
+
+Documentation DoxygenParser::retrieveModuleDocumentation(const QString& name){
+
+ QString sourceFile = documentationDataDirectory() + '/' + "indexpage.xml";
+
+ if (!QFile::exists(sourceFile)) {
+ ReportHandler::warning("Can't find doxygen XML file for module "
+ + name + ", tried: "
+ + sourceFile);
+ return Documentation();
+ }
+
+ QXmlQuery xquery;
+ xquery.setFocus(QUrl(sourceFile));
+
+ // Module documentation
+ QString query = "/doxygen/compounddef/detaileddescription";
+ return Documentation(getDocumentation(xquery, query, DocModificationList()));
}
+
diff --git a/doxygenparser.h b/doxygenparser.h
index 16d53bdc..1150f7ff 100644
--- a/doxygenparser.h
+++ b/doxygenparser.h
@@ -26,12 +26,13 @@
#include "docparser.h"
-class DoxygenParser : public DocParser
+class APIEXTRACTOR_API DoxygenParser : public DocParser
{
public:
DoxygenParser() {}
virtual void fillDocumentation(AbstractMetaClass *metaClass);
- virtual Documentation retrieveModuleDocumentation() { return Documentation(); }
+ virtual Documentation retrieveModuleDocumentation();
+ virtual Documentation retrieveModuleDocumentation(const QString& name);
};
#endif // DOXYGENPARSER_H