diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-24 06:31:02 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-24 07:45:57 +0200 |
commit | 0331ddf28f81d265bbb31fa58e9de9091d2cd904 (patch) | |
tree | 317f9d67318545400d6cfd1d2f6cc1719c4a2bd9 | |
parent | e853e761db01e0677ebfd165b21cb5af1054e621 (diff) |
qmi-codegen: ensure helper methods get always generated
For those variables which are containers of other variables (struct, sequence
and array), ensure we call `emit_helper_methods()' in order to generate variable
specific dispose() helpers and such.
This fixes the case of nested arrays of structs (arrays of structs with arrays of
structs whithin).
-rw-r--r-- | build-aux/qmi-codegen/VariableArray.py | 2 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableSequence.py | 9 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableStruct.py | 9 |
3 files changed, 20 insertions, 0 deletions
diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py index 9a647bf..47ff6ff 100644 --- a/build-aux/qmi-codegen/VariableArray.py +++ b/build-aux/qmi-codegen/VariableArray.py @@ -91,6 +91,8 @@ class VariableArray(Variable): Emits the code to clear the element of the array """ def emit_helper_methods(self, hfile, cfile): + self.array_element.emit_helper_methods(hfile, cfile) + # No need for the clear func if no need to dispose the contents if self.array_element.needs_dispose == False: return diff --git a/build-aux/qmi-codegen/VariableSequence.py b/build-aux/qmi-codegen/VariableSequence.py index 9436ea0..79fff5c 100644 --- a/build-aux/qmi-codegen/VariableSequence.py +++ b/build-aux/qmi-codegen/VariableSequence.py @@ -61,6 +61,15 @@ class VariableSequence(Variable): """ + Emit helper methods for all types in the struct + """ + def emit_helper_methods(self, hfile, cfile): + # Emit for each member + for member in self.members: + member['object'].emit_helper_methods(hfile, cfile) + + + """ Reading the contents of a sequence is just about reading each of the sequence fields one by one. """ diff --git a/build-aux/qmi-codegen/VariableStruct.py b/build-aux/qmi-codegen/VariableStruct.py index 7fee2cd..b5aed87 100644 --- a/build-aux/qmi-codegen/VariableStruct.py +++ b/build-aux/qmi-codegen/VariableStruct.py @@ -81,6 +81,15 @@ class VariableStruct(Variable): """ + Emit helper methods for all types in the struct + """ + def emit_helper_methods(self, hfile, cfile): + # Emit for each member + for member in self.members: + member['object'].emit_helper_methods(hfile, cfile) + + + """ Reading the contents of a struct is just about reading each of the struct fields one by one. """ |