| Index: tools/json_schema_compiler/model.py
|
| diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
|
| index 967e9abec0041ef9d2d7c7de6378d7abbd7ee1e3..ed8a2ec404edef066279720ad422c3ee7a6c4a43 100644
|
| --- a/tools/json_schema_compiler/model.py
|
| +++ b/tools/json_schema_compiler/model.py
|
| @@ -190,7 +190,7 @@ class Type(object):
|
| elif 'enum' in json and json_type == 'string':
|
| self.property_type = PropertyType.ENUM
|
| self.enum_values = [EnumValue(value) for value in json['enum']]
|
| - self.cpp_omit_enum_type = 'cpp_omit_enum_type' in json
|
| + self.cpp_enum_prefix_override = json.get('cpp_enum_prefix_override', None)
|
| elif json_type == 'any':
|
| self.property_type = PropertyType.ANY
|
| elif json_type == 'binary':
|
| @@ -410,6 +410,9 @@ class EnumValue(object):
|
| self.name = json
|
| self.description = None
|
|
|
| + def CamelName(self):
|
| + return CamelName(self.name)
|
| +
|
| class _Enum(object):
|
| """Superclass for enum types with a "name" field, setting up repr/eq/ne.
|
| Enums need to do this so that equality/non-equality work over pickling.
|
| @@ -484,6 +487,19 @@ def UnixName(name):
|
| return ''.join(unix_name)
|
|
|
|
|
| +@memoize
|
| +def CamelName(snake):
|
| + ''' Converts a snake_cased_string to a camelCasedOne. '''
|
| + pieces = snake.split('_')
|
| + camel = []
|
| + for i, piece in enumerate(pieces):
|
| + if i == 0:
|
| + camel.append(piece)
|
| + else:
|
| + camel.append(piece.capitalize())
|
| + return ''.join(camel)
|
| +
|
| +
|
| def _StripNamespace(name, namespace):
|
| if name.startswith(namespace.name + '.'):
|
| return name[len(namespace.name + '.'):]
|
|
|