| Index: tools/json_schema_compiler/cpp_type_generator.py
|
| diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py
|
| index 28967b06fcbb8102d5675b774ed616b3a63bab57..5b54bae9ff8dc9dcf21ee853eb5a760b2ed43958 100644
|
| --- a/tools/json_schema_compiler/cpp_type_generator.py
|
| +++ b/tools/json_schema_compiler/cpp_type_generator.py
|
| @@ -35,22 +35,31 @@ class CppTypeGenerator(object):
|
| self._type_namespaces[type_] = namespace
|
| self._cpp_namespaces[namespace] = cpp_namespace
|
|
|
| - def GetExpandedChoicesInParams(self, params):
|
| + def ExpandParams(self, params):
|
| """Returns the given parameters with PropertyType.CHOICES parameters
|
| - expanded so that each choice is a separate parameter and sets a unix_name
|
| - for each choice.
|
| + expanded so that each choice is a separate parameter.
|
| """
|
| expanded = []
|
| for param in params:
|
| if param.type_ == PropertyType.CHOICES:
|
| for choice in param.choices.values():
|
| - choice.unix_name = (
|
| - param.unix_name + '_' + choice.type_.name.lower())
|
| expanded.append(choice)
|
| else:
|
| expanded.append(param)
|
| return expanded
|
|
|
| + def GetAllPossibleParameterLists(self, params):
|
| + """Returns all possible parameter lists for the given set of parameters.
|
| + Every combination of arguments passed to any of the PropertyType.CHOICES
|
| + parameters will have a corresponding parameter list returned here.
|
| + """
|
| + if not params:
|
| + return [[]]
|
| + partial_parameter_lists = self.GetAllPossibleParameterLists(params[1:])
|
| + return [[param] + partial_list
|
| + for param in self.ExpandParams(params[:1])
|
| + for partial_list in partial_parameter_lists]
|
| +
|
| def GetCppNamespaceName(self, namespace):
|
| """Gets the mapped C++ namespace name for the given namespace relative to
|
| the root namespace.
|
|
|