aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/docparser.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-20 12:30:47 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-21 10:03:20 +0000
commitb461e45a8e3b6f80f9e6a3b4505867ece6799355 (patch)
tree39989795d1d6d8474a444648258cddb3fe839d08 /sources/shiboken2/ApiExtractor/docparser.cpp
parent5e4e428210742d252fe73e46e4c3393375173e0c (diff)
DocParser: Add helper function to create list of documentable functions
Move code from shouldSkip() helper of the doc generator into the doc parser and use that for the qdoc/doxygen parsers. The additional checks (most importantly the check for declaringClass != ownerClass excluding the virtual functions added by AbstractMetaClass::fixFunctions() to derived classes) avoid running unneeded XPATH queries. Task-number: PYSIDE-363 Change-Id: Ib1141a348c96b269a50c63dd94fe93931c12d1ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/docparser.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/docparser.cpp b/sources/shiboken2/ApiExtractor/docparser.cpp
index bae438f18..50a08d7c9 100644
--- a/sources/shiboken2/ApiExtractor/docparser.cpp
+++ b/sources/shiboken2/ApiExtractor/docparser.cpp
@@ -69,6 +69,36 @@ QString DocParser::execXQuery(QXmlQuery& xquery, const QString& query) const
return result;
}
+bool DocParser::skipForQuery(const AbstractMetaFunction *func)
+{
+ // Skip private functions and copies created by AbstractMetaClass::fixFunctions()
+ if (!func || func->isPrivate()
+ || func->isModifiedRemoved()
+ || func->declaringClass() != func->ownerClass()
+ || func->isCastOperator()) {
+ return true;
+ }
+ switch (func->functionType()) {
+ case AbstractMetaFunction::MoveConstructorFunction:
+ case AbstractMetaFunction::AssignmentOperatorFunction:
+ case AbstractMetaFunction::MoveAssignmentOperatorFunction:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+AbstractMetaFunctionList DocParser::documentableFunctions(const AbstractMetaClass *metaClass)
+{
+ AbstractMetaFunctionList result = metaClass->functionsInTargetLang();
+ for (int i = result.size() - 1; i >= 0; --i) {
+ if (DocParser::skipForQuery(result.at(i)) || result.at(i)->isUserAdded())
+ result.removeAt(i);
+ }
+ return result;
+}
+
namespace
{