diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2022-02-26 23:52:31 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-02-27 00:25:30 +0100 |
commit | ed0959ea69e3789713437318438e6531bfdeead8 (patch) | |
tree | a783ff3c0aa1a16b160ca66c07566a8187c0d575 | |
parent | 6d4a24b79a265e8b6f3a71c7ddf782d5ea1c6135 (diff) | |
download | libqmi-ed0959ea69e3789713437318438e6531bfdeead8.tar.gz |
build-aux,codegen: remove doc fields from methods in variables
Let's improve the main variable object documentation in one single
place.
-rw-r--r-- | build-aux/qmi-codegen/VariableArray.py | 48 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableInteger.py | 42 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableSequence.py | 48 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableString.py | 42 | ||||
-rw-r--r-- | build-aux/qmi-codegen/VariableStruct.py | 26 |
5 files changed, 3 insertions, 203 deletions
diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py index 5d9f4b3c..cae020f2 100644 --- a/build-aux/qmi-codegen/VariableArray.py +++ b/build-aux/qmi-codegen/VariableArray.py @@ -28,9 +28,6 @@ Variable type for Arrays ('array' format) """ class VariableArray(Variable): - """ - Constructor - """ def __init__(self, service, dictionary, array_element_type, container_type): # Call the parent constructor @@ -97,17 +94,10 @@ class VariableArray(Variable): raise ValueError('Missing \'size-prefix-format\' or \'fixed-size\' in %s array' % self.name) - """ - Emit the type for the array element - """ def emit_types(self, hfile, cfile, since, static): self.array_element.emit_types(hfile, cfile, since, static) - """ - Reading an array from the raw byte buffer is just about providing a loop to - read every array element one by one. - """ def emit_buffer_read(self, f, line_prefix, tlv_out, error, variable_name): common_var_prefix = utils.build_underscore_name(self.name) translations = { 'lp' : line_prefix, @@ -186,10 +176,6 @@ class VariableArray(Variable): f.write(string.Template(template).substitute(translations)) - """ - Writing an array to the raw byte buffer is just about providing a loop to - write every array element one by one. - """ def emit_buffer_write(self, f, line_prefix, tlv_name, variable_name): common_var_prefix = utils.build_underscore_name(self.name) translations = { 'lp' : line_prefix, @@ -230,10 +216,6 @@ class VariableArray(Variable): f.write(string.Template(template).substitute(translations)) - """ - The array will be printed as a list of fields enclosed between curly - brackets - """ def emit_get_printable(self, f, line_prefix): common_var_prefix = utils.build_underscore_name(self.name) translations = { 'lp' : line_prefix, @@ -297,9 +279,6 @@ class VariableArray(Variable): f.write(string.Template(template).substitute(translations)) - """ - Variable declaration - """ def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'name' : variable_name } @@ -315,9 +294,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Getter for the array type - """ def build_getter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -336,9 +312,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the getter - """ def build_getter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -358,9 +331,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Builds the array getter implementation - """ def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -382,9 +352,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Setter for the array type - """ def build_setter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -403,9 +370,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the setter - """ def build_setter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -425,9 +389,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Builds the array setter implementation - """ def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -448,9 +409,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the struct field - """ def build_struct_field_documentation(self, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'array_element_public_format' : self.array_element.public_format, @@ -466,9 +424,6 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Dispose the array just with an unref - """ def build_dispose(self, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'variable_name' : variable_name } @@ -479,8 +434,5 @@ class VariableArray(Variable): return string.Template(template).substitute(translations) - """ - Add sections - """ def add_sections(self, sections): self.array_element.add_sections(sections) diff --git a/build-aux/qmi-codegen/VariableInteger.py b/build-aux/qmi-codegen/VariableInteger.py index 9cf15360..01e43540 100644 --- a/build-aux/qmi-codegen/VariableInteger.py +++ b/build-aux/qmi-codegen/VariableInteger.py @@ -33,9 +33,6 @@ Variable type for signed/unsigned Integers and floating point numbers: """ class VariableInteger(Variable): - """ - Constructor - """ def __init__(self, service, dictionary): # Call the parent constructor @@ -54,9 +51,7 @@ class VariableInteger(Variable): self.public_format = dictionary['public-format'] if 'public-format' in dictionary else self.private_format self.element_type = self.public_format - """ - Read a single integer from the raw byte buffer - """ + def emit_buffer_read(self, f, line_prefix, tlv_out, error, variable_name): translations = { 'lp' : line_prefix, 'tlv_out' : tlv_out, @@ -95,9 +90,6 @@ class VariableInteger(Variable): f.write(string.Template(template).substitute(translations)) - """ - Return the data type size of fixed c-types - """ @staticmethod def fixed_type_byte_size(fmt): if fmt == 'guint8': @@ -118,9 +110,7 @@ class VariableInteger(Variable): return 8 raise Exception("Unsupported format %s" % (fmt)) - """ - Write a single integer to the raw byte buffer - """ + def emit_buffer_write(self, f, line_prefix, tlv_name, variable_name): translations = { 'lp' : line_prefix, 'private_format' : self.private_format, @@ -162,9 +152,6 @@ class VariableInteger(Variable): f.write(string.Template(template).substitute(translations)) - """ - Get the integer as a printable string. - """ def emit_get_printable(self, f, line_prefix): common_format = '' common_cast = '' @@ -251,9 +238,6 @@ class VariableInteger(Variable): f.write(string.Template(template).substitute(translations)) - """ - Variable declaration - """ def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'private_format' : self.private_format, @@ -269,9 +253,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Getter for the integer type - """ def build_getter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -285,9 +266,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the getter - """ def build_getter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -300,9 +278,7 @@ class VariableInteger(Variable): '${lp}@${name}: (out)(optional): a placeholder for the output #${public_format}, or %NULL if not required.\n') return string.Template(template).substitute(translations) - """ - Builds the Integer getter implementation - """ + def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -320,9 +296,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Setter for the integer type - """ def build_setter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -336,9 +309,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the setter - """ def build_setter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -352,9 +322,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Implementation of the setter - """ def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -371,9 +338,6 @@ class VariableInteger(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the struct field - """ def build_struct_field_documentation(self, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'public_format' : self.public_format, diff --git a/build-aux/qmi-codegen/VariableSequence.py b/build-aux/qmi-codegen/VariableSequence.py index f2241425..6fb5427c 100644 --- a/build-aux/qmi-codegen/VariableSequence.py +++ b/build-aux/qmi-codegen/VariableSequence.py @@ -28,9 +28,6 @@ Variable type for Sequences ('sequence' format) """ class VariableSequence(Variable): - """ - Constructor - """ def __init__(self, service, dictionary, sequence_type_name, container_type): # Call the parent constructor @@ -53,36 +50,21 @@ class VariableSequence(Variable): break - """ - Emit all types for the members of the sequence - """ def emit_types(self, hfile, cfile, since, static): for member in self.members: member['object'].emit_types(hfile, cfile, since, static) - """ - Reading the contents of a sequence is just about reading each of the sequence - fields one by one. - """ def emit_buffer_read(self, f, line_prefix, tlv_out, error, variable_name): for member in self.members: member['object'].emit_buffer_read(f, line_prefix, tlv_out, error, variable_name + '_' + member['name']) - """ - Writing the contents of a sequence is just about writing each of the sequence - fields one by one. - """ def emit_buffer_write(self, f, line_prefix, tlv_name, variable_name): for member in self.members: member['object'].emit_buffer_write(f, line_prefix, tlv_name, variable_name + '_' + member['name']) - """ - The sequence will be printed as a list of fields enclosed between square - brackets - """ def emit_get_printable(self, f, line_prefix): translations = { 'lp' : line_prefix } @@ -107,9 +89,6 @@ class VariableSequence(Variable): f.write(string.Template(template).substitute(translations)) - """ - Variable declaration - """ def build_variable_declaration(self, public, line_prefix, variable_name): built = '' for member in self.members: @@ -117,10 +96,6 @@ class VariableSequence(Variable): return built - """ - The getter for a sequence variable will include independent getters for each - of the variables in the sequence. - """ def build_getter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -131,9 +106,6 @@ class VariableSequence(Variable): return built - """ - Documentation for the getter - """ def build_getter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -144,9 +116,6 @@ class VariableSequence(Variable): return built - """ - Builds the Struct getter implementation - """ def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -159,10 +128,6 @@ class VariableSequence(Variable): return built - """ - The setter for a sequence variable will include independent setters for each - of the variables in the sequence. - """ def build_setter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -173,9 +138,6 @@ class VariableSequence(Variable): return built - """ - Documentation for the setter - """ def build_setter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -186,9 +148,6 @@ class VariableSequence(Variable): return built - """ - Builds the sequence setter implementation - """ def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -201,10 +160,6 @@ class VariableSequence(Variable): return built - """ - Disposing a sequence is just about disposing each of the sequence fields one by - one. - """ def build_dispose(self, line_prefix, variable_name): built = '' for member in self.members: @@ -212,9 +167,6 @@ class VariableSequence(Variable): return built - """ - Add sections - """ def add_sections(self, sections): # Add sections for each member for member in self.members: diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py index 07d0a960..aace5660 100644 --- a/build-aux/qmi-codegen/VariableString.py +++ b/build-aux/qmi-codegen/VariableString.py @@ -27,9 +27,6 @@ Variable type for Strings ('string' format) """ class VariableString(Variable): - """ - Constructor - """ def __init__(self, service, dictionary): # Call the parent constructor @@ -74,9 +71,6 @@ class VariableString(Variable): self.max_size = dictionary['max-size'] if 'max-size' in dictionary else '' - """ - Read a string from the raw byte buffer. - """ def emit_buffer_read(self, f, line_prefix, tlv_out, error, variable_name): translations = { 'lp' : line_prefix, 'tlv_out' : tlv_out, @@ -112,9 +106,6 @@ class VariableString(Variable): f.write(string.Template(template).substitute(translations)) - """ - Write a string to the raw byte buffer. - """ def emit_buffer_write(self, f, line_prefix, tlv_name, variable_name): translations = { 'lp' : line_prefix, 'tlv_name' : tlv_name, @@ -131,9 +122,6 @@ class VariableString(Variable): f.write(string.Template(template).substitute(translations)) - """ - Get the string as printable - """ def emit_get_printable(self, f, line_prefix): translations = { 'lp' : line_prefix } @@ -166,9 +154,6 @@ class VariableString(Variable): f.write(string.Template(template).substitute(translations)) - """ - Variable declaration - """ def build_variable_declaration(self, public, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'name' : variable_name } @@ -189,9 +174,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Getter for the string type - """ def build_getter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -204,9 +186,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the getter - """ def build_getter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -219,9 +198,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Builds the String getter implementation - """ def build_getter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -236,9 +212,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Setter for the string type - """ def build_setter_declaration(self, line_prefix, variable_name): if not self.visible: return "" @@ -251,9 +224,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the setter - """ def build_setter_documentation(self, line_prefix, variable_name): if not self.visible: return "" @@ -275,9 +245,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Builds the String setter implementation - """ def build_setter_implementation(self, line_prefix, variable_name_from, variable_name_to): if not self.visible: return "" @@ -317,9 +284,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Documentation for the struct field - """ def build_struct_field_documentation(self, line_prefix, variable_name): translations = { 'lp' : line_prefix, 'name' : variable_name } @@ -338,9 +302,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Dispose the string - """ def build_dispose(self, line_prefix, variable_name): # Fixed-size strings don't need dispose if self.is_fixed_size and not self.public: @@ -354,9 +315,6 @@ class VariableString(Variable): return string.Template(template).substitute(translations) - """ - Flag as being public - """ def flag_public(self): # Call the parent method Variable.flag_public(self) diff --git a/build-aux/qmi-codegen/VariableStruct.py b/build-aux/qmi-codegen/VariableStruct.py index d6e5063d..4bbb44db 100644 --- a/build-aux/qmi-codegen/VariableStruct.py +++ b/build-aux/qmi-codegen/VariableStruct.py @@ -30,9 +30,6 @@ independent TLVs. Use Sequence instead for that. """ class VariableStruct(Variable): - """ - Constructor - """ def __init__(self, service, dictionary, struct_type_name, container_type): # Call the parent constructor @@ -65,9 +62,6 @@ class VariableStruct(Variable): break - """ - Emit all types for the members of the struct plus the new struct type itself - """ def emit_types(self, hfile, cfile, since, static): for member in self.members: member['object'].emit_types(hfile, cfile, since, static) @@ -119,28 +113,16 @@ class VariableStruct(Variable): cfile.write(string.Template(template).substitute(translations)) - """ - Reading the contents of a struct is just about reading each of the struct - fields one by one. - """ def emit_buffer_read(self, f, line_prefix, tlv_out, error, variable_name): for member in self.members: member['object'].emit_buffer_read(f, line_prefix, tlv_out, error, variable_name + '.' + member['name']) - """ - Writing the contents of a struct is just about writing each of the struct - fields one by one. - """ def emit_buffer_write(self, f, line_prefix, tlv_name, variable_name): for member in self.members: member['object'].emit_buffer_write(f, line_prefix, tlv_name, variable_name + '.' + member['name']) - """ - The struct will be printed as a list of fields enclosed between square - brackets - """ def emit_get_printable(self, f, line_prefix): translations = { 'lp' : line_prefix } @@ -165,10 +147,6 @@ class VariableStruct(Variable): f.write(string.Template(template).substitute(translations)) - """ - Disposing a struct is just about disposing each of the struct fields one by - one. - """ def build_dispose(self, line_prefix, variable_name): built = '' for member in self.members: @@ -176,11 +154,7 @@ class VariableStruct(Variable): return built - """ - Add sections - """ def add_sections(self, sections): - # Add sections for each member for member in self.members: member['object'].add_sections(sections) |