aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-10-05 23:05:04 -0500
committerDan Williams <dcbw@redhat.com>2016-10-06 10:12:04 -0500
commite2f9d3d5917953ad4d0a7450dfe28aaa57141288 (patch)
treeac0d585f2f455c68d14b971477d848f6ff822fff
parent4c678418f398fc5f9dcdb216c0ffdffc8524bea2 (diff)
qmi-codegen: allow fields to be hidden with 'visible':'no'
We want to mark some TLV fields as reserved and not exposed through the public API due to alignment or other issues.
-rw-r--r--build-aux/qmi-codegen/Variable.py5
-rw-r--r--build-aux/qmi-codegen/VariableArray.py18
-rw-r--r--build-aux/qmi-codegen/VariableInteger.py18
-rw-r--r--build-aux/qmi-codegen/VariableSequence.py18
-rw-r--r--build-aux/qmi-codegen/VariableString.py18
-rw-r--r--build-aux/qmi-codegen/VariableStruct.py18
6 files changed, 95 insertions, 0 deletions
diff --git a/build-aux/qmi-codegen/Variable.py b/build-aux/qmi-codegen/Variable.py
index 6b534d7..2a8d2e7 100644
--- a/build-aux/qmi-codegen/Variable.py
+++ b/build-aux/qmi-codegen/Variable.py
@@ -41,6 +41,11 @@ class Variable:
self.private_format = None
"""
+ Whether the variable is visible in public API or is reserved
+ """
+ self.visible = False if ('visible' in dictionary and dictionary['visible'] == 'no') else True
+
+ """
Variables that get allocated in heap need to get properly disposed.
"""
self.needs_dispose = False
diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py
index a00fae5..7f677f8 100644
--- a/build-aux/qmi-codegen/VariableArray.py
+++ b/build-aux/qmi-codegen/VariableArray.py
@@ -344,6 +344,9 @@ class VariableArray(Variable):
Getter for the array type
"""
def build_getter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -362,6 +365,9 @@ class VariableArray(Variable):
Documentation for the getter
"""
def build_getter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_array_element_format' : self.array_element.public_format,
'name' : variable_name }
@@ -380,6 +386,9 @@ class VariableArray(Variable):
Builds the array getter implementation
"""
def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to, to_is_reference):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
'to' : variable_name_to }
@@ -405,6 +414,9 @@ class VariableArray(Variable):
Setter for the array type
"""
def build_setter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -423,6 +435,9 @@ class VariableArray(Variable):
Documentation for the setter
"""
def build_setter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_array_element_format' : self.array_element.public_format,
'name' : variable_name }
@@ -441,6 +456,9 @@ class VariableArray(Variable):
Builds the array setter implementation
"""
def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
'to' : variable_name_to }
diff --git a/build-aux/qmi-codegen/VariableInteger.py b/build-aux/qmi-codegen/VariableInteger.py
index 060548d..5372b3a 100644
--- a/build-aux/qmi-codegen/VariableInteger.py
+++ b/build-aux/qmi-codegen/VariableInteger.py
@@ -264,6 +264,9 @@ class VariableInteger(Variable):
Getter for the integer type
"""
def build_getter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_format' : self.public_format,
'name' : variable_name }
@@ -277,6 +280,9 @@ class VariableInteger(Variable):
Documentation for the getter
"""
def build_getter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_format' : self.public_format,
'name' : variable_name }
@@ -289,6 +295,9 @@ class VariableInteger(Variable):
Builds the Integer getter implementation
"""
def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to, to_is_reference):
+ if not self.visible:
+ return ""
+
needs_cast = True if self.public_format != self.private_format else False
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
@@ -311,6 +320,9 @@ class VariableInteger(Variable):
Setter for the integer type
"""
def build_setter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_format' : self.public_format,
'name' : variable_name }
@@ -324,6 +336,9 @@ class VariableInteger(Variable):
Documentation for the setter
"""
def build_setter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'public_format' : self.public_format,
'name' : variable_name }
@@ -337,6 +352,9 @@ class VariableInteger(Variable):
Implementation of the setter
"""
def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to):
+ if not self.visible:
+ return ""
+
needs_cast = True if self.public_format != self.private_format else False
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
diff --git a/build-aux/qmi-codegen/VariableSequence.py b/build-aux/qmi-codegen/VariableSequence.py
index e0d2e00..b762133 100644
--- a/build-aux/qmi-codegen/VariableSequence.py
+++ b/build-aux/qmi-codegen/VariableSequence.py
@@ -132,6 +132,9 @@ class VariableSequence(Variable):
of the variables in the sequence.
"""
def build_getter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_getter_declaration(line_prefix, variable_name + '_' + member['name'])
@@ -142,6 +145,9 @@ class VariableSequence(Variable):
Documentation for the getter
"""
def build_getter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_getter_documentation(line_prefix, variable_name + '_' + member['name'])
@@ -152,6 +158,9 @@ class VariableSequence(Variable):
Builds the Struct getter implementation
"""
def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to, to_is_reference):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_getter_implementation(line_prefix,
@@ -166,6 +175,9 @@ class VariableSequence(Variable):
of the variables in the sequence.
"""
def build_setter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_setter_declaration(line_prefix, variable_name + '_' + member['name'])
@@ -176,6 +188,9 @@ class VariableSequence(Variable):
Documentation for the setter
"""
def build_setter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_setter_documentation(line_prefix, variable_name + '_' + member['name'])
@@ -186,6 +201,9 @@ class VariableSequence(Variable):
Builds the Sequence setter implementation
"""
def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_setter_implementation(line_prefix,
diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py
index 01452f5..d588ca6 100644
--- a/build-aux/qmi-codegen/VariableString.py
+++ b/build-aux/qmi-codegen/VariableString.py
@@ -193,6 +193,9 @@ class VariableString(Variable):
Getter for the string type
"""
def build_getter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -205,6 +208,9 @@ class VariableString(Variable):
Documentation for the getter
"""
def build_getter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -217,6 +223,9 @@ class VariableString(Variable):
Builds the String getter implementation
"""
def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to, to_is_reference):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
'to' : variable_name_to }
@@ -236,6 +245,9 @@ class VariableString(Variable):
Setter for the string type
"""
def build_setter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -248,6 +260,9 @@ class VariableString(Variable):
Documentation for the setter
"""
def build_setter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'name' : variable_name }
@@ -269,6 +284,9 @@ class VariableString(Variable):
Builds the String setter implementation
"""
def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
'to' : variable_name_to }
diff --git a/build-aux/qmi-codegen/VariableStruct.py b/build-aux/qmi-codegen/VariableStruct.py
index 78e6752..996c279 100644
--- a/build-aux/qmi-codegen/VariableStruct.py
+++ b/build-aux/qmi-codegen/VariableStruct.py
@@ -163,6 +163,9 @@ class VariableStruct(Variable):
of the variables in the struct.
"""
def build_getter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'format' : self.public_format,
'name' : variable_name }
@@ -176,6 +179,9 @@ class VariableStruct(Variable):
Documentation for the getter
"""
def build_getter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'format' : self.public_format,
'name' : variable_name }
@@ -189,6 +195,9 @@ class VariableStruct(Variable):
Builds the Struct getter implementation
"""
def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to, to_is_reference):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'from' : variable_name_from,
'to' : variable_name_to }
@@ -209,6 +218,9 @@ class VariableStruct(Variable):
of the variables in the struct.
"""
def build_setter_declaration(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'format' : self.public_format,
'name' : variable_name }
@@ -222,6 +234,9 @@ class VariableStruct(Variable):
Documentation for the setter
"""
def build_setter_documentation(self, line_prefix, variable_name):
+ if not self.visible:
+ return ""
+
translations = { 'lp' : line_prefix,
'format' : self.public_format,
'name' : variable_name }
@@ -234,6 +249,9 @@ class VariableStruct(Variable):
Builds the Struct setter implementation
"""
def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to):
+ if not self.visible:
+ return ""
+
built = ''
for member in self.members:
built += member['object'].build_setter_implementation(line_prefix,