aboutsummaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-22 19:48:28 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-12-22 20:17:18 -0300
commitff6ac013b7be3b4900a0abfe57e1467fcf908635 (patch)
treeebba81e98b86fbd1f018fda3f6c06f13c2cf1e38 /headergenerator.cpp
parentb06e2adc558688f0788f998ab51e6afb08895150 (diff)
Replaces SbkCopyCppObject template function with the CppObjectCopier template struct
In addition to the mere use of SbkCopyCppObject to copy C++ objects, it is needed to know if a C++ type has a C++ wrapped produced by the generator. To solve this SbkCopyCppObject was transformed in the template struct CppObjectCopier with the methods copy and the constant member isCppWrapper. The Converter[Base]<>::createWrapper methods were replaced by template function SbkCreateWrapper. Also some refactoring was made on the Converters code to improve legibility. Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 5d6b55cce..fd47a3bf4 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -367,7 +367,12 @@ void HeaderGenerator::writeSbkCopyCppObjectFunction(QTextStream& s, const Abstra
{
if (!metaClass->typeEntry()->isValue() || !shouldGenerateCppWrapper(metaClass))
return;
- s << "template<> " << metaClass->qualifiedCppName();
- s << "* SbkCopyCppObject<" << metaClass->qualifiedCppName() << ">(const ";
- s << metaClass->qualifiedCppName() << "& cppobj);" << endl;
+ QString className = metaClass->qualifiedCppName();
+ s << "template <>" << endl;
+ s << "struct CppObjectCopier<" << className << " >" << endl;
+ s << '{' << endl;
+ s << INDENT << "static const bool isCppWrapper = true;" << endl;
+ s << INDENT << "static inline " << className << "* copy(const " << className << "& cppobj);" << endl;
+ s << "};" << endl;
}
+