diff options
author | Hugo Parente Lima <hugo.lima@openbossa.org> | 2010-04-14 19:32:37 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-09 19:09:59 -0300 |
commit | 74d3c1bb12280ffb2b810ee4bd1272ba6fb8127f (patch) | |
tree | c87daaa1939b537b50ea94c824f620d236717003 /abstractmetabuilder.cpp | |
parent | 46cd570358601d83be0e23a378fc688d8ed706b6 (diff) |
Added the "function" tag to ApiExtractor.
This change the behaviour of ApiExtractor regarding to global functions.
All global function you want to be exported to python *need* to be especified
in the type system with the function tag, otherwise they wont be exported at all.
The syntax for this new tag is:
<function signature="..." />
This is just the initial work for this tag, it is missign support for:
- Function modifications.
- Add a function overload with add-function tag.
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r-- | abstractmetabuilder.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp index 182f4456d..4d8a4f1d8 100644 --- a/abstractmetabuilder.cpp +++ b/abstractmetabuilder.cpp @@ -503,16 +503,27 @@ bool AbstractMetaBuilder::build(QIODevice* input) m_currentClass = 0; + // Global functions foreach (FunctionModelItem func, m_dom->functions()) { if (func->accessPolicy() != CodeModel::Public || func->name().startsWith("operator")) continue; + FunctionTypeEntry* funcEntry = types->findFunctionType(func->name()); + if (!funcEntry) + continue; + AbstractMetaFunction* metaFunc = traverseFunction(func); - if (metaFunc) { - QFileInfo info(func->fileName()); - metaFunc->setIncludeFile(Include(Include::IncludePath, info.fileName())); - m_globalFunctions << metaFunc; + if (!metaFunc) + continue; + + if (!funcEntry->hasSignature(metaFunc->minimalSignature())) { + delete metaFunc; + continue; } + + QFileInfo info(func->fileName()); + funcEntry->setInclude(Include(Include::IncludePath, info.fileName())); + m_globalFunctions << metaFunc; } // Functions added to the module on the type system. |