@@ -46,6 +46,11 @@ QString getSectionKindAttr(const AbstractMetaFunction* func)
46
46
47
47
}
48
48
49
+ Documentation DoxygenParser::retrieveModuleDocumentation ()
50
+ {
51
+ return retrieveModuleDocumentation (packageName ());
52
+ }
53
+
49
54
void DoxygenParser::fillDocumentation (AbstractMetaClass* metaClass)
50
55
{
51
56
if (!metaClass)
@@ -60,11 +65,12 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
60
65
doxyFileSuffix += " .xml" ;
61
66
62
67
const char * prefixes[] = { " class" , " struct" , " namespace" };
63
- const int numPrefixes = sizeof (prefixes);
68
+ const int numPrefixes = sizeof (prefixes) / sizeof (const char *);
69
+ bool isProperty = false ;
64
70
65
71
QString doxyFilePath;
66
72
for (int i = 0 ; i < numPrefixes; ++i) {
67
- doxyFilePath = documentationDataDirectory () + " . /" + prefixes[i] + doxyFileSuffix;
73
+ doxyFilePath = documentationDataDirectory () + " /" + prefixes[i] + doxyFileSuffix;
68
74
if (QFile::exists (doxyFilePath))
69
75
break ;
70
76
doxyFilePath.clear ();
@@ -101,6 +107,7 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
101
107
|| func->isPropertyResetter ()) {
102
108
query += " [@kind=\" property\" ]/memberdef/name[text()=\" "
103
109
+ func->propertySpec ()->name () + " \" ]" ;
110
+ isProperty = true ;
104
111
} else { // normal methods
105
112
QString kind = getSectionKindAttr (func);
106
113
query += " [@kind=\" " + kind + " -func\" ]/memberdef/name[text()=\" "
@@ -124,9 +131,15 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
124
131
}
125
132
}
126
133
}
127
- query += " /../detaileddescription" ;
134
+ if (!isProperty) {
135
+ query += " /../detaileddescription" ;
136
+ } else {
137
+ query = " (" + query;
138
+ query += " /../detaileddescription)[1]" ;
139
+ }
128
140
QString doc = getDocumentation (xquery, query, DocModificationList ());
129
141
func->setDocumentation (doc);
142
+ isProperty = false ;
130
143
}
131
144
132
145
// Fields
@@ -144,8 +157,29 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
144
157
// Enums
145
158
AbstractMetaEnumList enums = metaClass->enums ();
146
159
foreach (AbstractMetaEnum *meta_enum, enums) {
147
- QString query = " /doxygen/compounddef/sectiondef/memberdef[@kind=\" enum\" ]/name[text()=\" " + meta_enum->name () + " \" ]/../detaileddescription " ;
160
+ QString query = " /doxygen/compounddef/sectiondef/memberdef[@kind=\" enum\" ]/name[text()=\" " + meta_enum->name () + " \" ]/.." ;
148
161
QString doc = getDocumentation (xquery, query, DocModificationList ());
149
162
meta_enum->setDocumentation (doc);
150
163
}
164
+
165
+ }
166
+
167
+ Documentation DoxygenParser::retrieveModuleDocumentation (const QString& name){
168
+
169
+ QString sourceFile = documentationDataDirectory () + ' /' + " indexpage.xml" ;
170
+
171
+ if (!QFile::exists (sourceFile)) {
172
+ ReportHandler::warning (" Can't find doxygen XML file for module "
173
+ + name + " , tried: "
174
+ + sourceFile);
175
+ return Documentation ();
176
+ }
177
+
178
+ QXmlQuery xquery;
179
+ xquery.setFocus (QUrl (sourceFile));
180
+
181
+ // Module documentation
182
+ QString query = " /doxygen/compounddef/detaileddescription" ;
183
+ return Documentation (getDocumentation (xquery, query, DocModificationList ()));
151
184
}
185
+
0 commit comments