diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-02 11:23:29 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-03-02 14:44:59 -0300 |
commit | caa2fdfe7fa7c9450bb06dc1e6c017a04e6fa403 (patch) | |
tree | 0894ce552ffda28464fe8ce411029342e144aed0 /shibokengenerator.cpp | |
parent | 42154013b5ecd075288c7ccc9fe341875ad3431b (diff) |
Adds ShibokenGenerator::getExtendedConverters() method.
It returns all types from a previous module that could be generated
by a conversion operator defined in the current module, as well as
all the possible arguments for the conversion.
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index 9500f5641..8ee643fba 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -819,6 +819,27 @@ AbstractMetaFunctionList ShibokenGenerator::filterFunctions(const AbstractMetaCl return result; } +ShibokenGenerator::ExtendedConverterData ShibokenGenerator::getExtendedConverters() const +{ + ExtendedConverterData extConvs; + foreach (const AbstractMetaClass* metaClass, classes()) { + // Use only the classes for the current module. + if (!shouldGenerate(metaClass)) + continue; + foreach (AbstractMetaFunction* convOp, metaClass->operatorOverloads(AbstractMetaClass::ConversionOp)) { + // Get only the conversion operators that return a type from another module, + // that are value-types and were not removed in the type system. + const TypeEntry* convType = convOp->type()->typeEntry(); + if ((convType->codeGeneration() & TypeEntry::GenerateTargetLang) + || !convType->isValue() + || convOp->isModifiedRemoved()) + continue; + extConvs[convType].append(convOp->ownerClass()); + } + } + return extConvs; +} + void ShibokenGenerator::writeCodeSnips(QTextStream& s, const CodeSnipList& codeSnips, CodeSnip::Position position, |