summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2016-02-18 22:06:17 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2016-02-18 22:06:17 (GMT)
commit022375809ae8e69ab9f1c8d3048c54a271b7e066 (patch)
tree2841a30786057ed85ab579ddf11ec3508cc8f273 /bindings
parent74e8705b57b6fd5972f28c646d84087c8011bb54 (diff)
downloadlasso-022375809ae8e69ab9f1c8d3048c54a271b7e066.zip
lasso-022375809ae8e69ab9f1c8d3048c54a271b7e066.tar.gz
lasso-022375809ae8e69ab9f1c8d3048c54a271b7e066.tar.bz2
bindings/php5: fix enum getters and setters (fixes #10032)
enumeration type were being wrongly interpreted as objects types because is_object() was used instead of the local specialisation done in PhpCode.is_object(). Also fix docstring of getters/setters.
Diffstat (limited to 'bindings')
-rw-r--r--bindings/php5/php_code.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/bindings/php5/php_code.py b/bindings/php5/php_code.py
index 84190d9..35bdf02 100644
--- a/bindings/php5/php_code.py
+++ b/bindings/php5/php_code.py
@@ -197,17 +197,22 @@ function lassoRegisterIdWsf2DstService($prefix, $href) {
def generate_getter(self, c, m):
- d = { 'type': arg_type(m), 'name': format_as_camelcase(arg_name(m)),
- 'docstring': self.get_docstring_return_type(arg_type(m)), 'class': c.name }
+ d = {
+ 'type': arg_type(m),
+ 'name': format_as_camelcase(arg_name(m)),
+ 'docstring': self.get_docstring_return_type(arg_type(m)),
+ 'class': c.name
+ }
- six.print_(''' /**', file=self.fd)
- * @return %(docstring)s
+ six.print_('''\
+ /**
+ * @return %(docstring)s
*/
protected function get_%(name)s() {''' % d, file=self.fd)
six.print_(' $t = %(class)s_%(name)s_get($this->_cptr);' % d, file=self.fd)
- if is_object(m):
+ if self.is_object(m):
six.print_(' $t = cptrToPhp($t);', file=self.fd)
- elif (is_glist(m) or is_hashtable(m)) and is_object(element_type(m)):
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
six.print_(' foreach ($t as $key => $item) {', file=self.fd)
six.print_(' $t[$key] = cptrToPhp($item);', file=self.fd)
six.print_(' }', file=self.fd)
@@ -224,9 +229,9 @@ function lassoRegisterIdWsf2DstService($prefix, $href) {
d = { 'type': arg_type(m), 'name': format_as_camelcase(arg_name(m)),
'docstring': self.get_docstring_return_type(arg_type(m)), 'class': c.name }
six.print_(' protected function set_%(name)s($value) {' % d, file=self.fd)
- if is_object(m):
+ if self.is_object(m):
six.print_(' $value = $value->_cptr;', file=self.fd)
- elif (is_glist(m) or is_hashtable(m)) and is_object(element_type(m)):
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
six.print_(' $array = array();', file=self.fd)
six.print_(' if (!is_null($value)) {', file=self.fd)
six.print_(' foreach ($value as $key => $item) {', file=self.fd)
@@ -335,7 +340,7 @@ function lassoRegisterIdWsf2DstService($prefix, $href) {
is_int(arg, self.binding_data) or is_glist(arg) or \
is_hashtable(arg) or is_time_t_pointer(arg):
c_args.append(arg_name)
- elif is_object(arg):
+ elif self.is_object(arg):
c_args.append('%s->_cptr' % arg_name)
else:
raise Exception('Does not handle argument of type: %s' % ((m, arg),))