aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-06-15 16:08:00 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:26 -0300
commit45a008604122af4e4ff4e7db440d9e65be3093fc (patch)
treed408e2a099208eff155b46e833cfbd8ba07078e2 /generator
parent76c2be48edf50c573d1da94879d02c1b97f8c501 (diff)
Added two new type system variables: %ISCONVERTIBLE and %CHECKTYPE.
Currently the variables are replaced as follows: * %ISCONVERTIBLE[CPPTYPE] -> Shiboken::Converter<CPPTYPE>::isConvertible * %CHECKTYPE[CPPTYPE] -> Shiboken::Converter<CPPTYPE>::checkType Future improvements may change that, so having these variables is a good thing. The documentation was updated. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Araujo <renato.filho@openbossa.org>
Diffstat (limited to 'generator')
-rw-r--r--generator/shibokengenerator.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/generator/shibokengenerator.cpp b/generator/shibokengenerator.cpp
index 73383335c..1f405bbc1 100644
--- a/generator/shibokengenerator.cpp
+++ b/generator/shibokengenerator.cpp
@@ -1140,6 +1140,8 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
{
static QRegExp toPythonRegex("%CONVERTTOPYTHON\\[([^\\[]*)\\]");
static QRegExp toCppRegex("%CONVERTTOCPP\\[([^\\[]*)\\]");
+ static QRegExp isConvertibleRegex("%ISCONVERTIBLE\\[([^\\[]*)\\]");
+ static QRegExp checkTypeRegex("%CHECKTYPE\\[([^\\[]*)\\]");
static QRegExp pyArgsRegex("%PYARG_(\\d+)");
// detect is we should use pyargs instead of args as variable name for python arguments
@@ -1170,12 +1172,18 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
code.replace("%CPPTYPE", context->name());
}
- // replace "toPython "converters
+ // replace "toPython" converters
code.replace(toPythonRegex, "Shiboken::Converter<\\1 >::toPython");
- // replace "toCpp "converters
+ // replace "toCpp" converters
code.replace(toCppRegex, "Shiboken::Converter<\\1 >::toCpp");
+ // replace "isConvertible" check
+ code.replace(isConvertibleRegex, "Shiboken::Converter<\\1 >::isConvertible");
+
+ // replace "checkType" check
+ code.replace(checkTypeRegex, "Shiboken::Converter<\\1 >::checkType");
+
if (func) {
// replace %PYARG_# variables
code.replace("%PYARG_0", PYTHON_RETURN_VAR);