Chromium Code Reviews| 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 cad64ae37d3cb64150c8d645c108fd3fde90d687..44e7b59b0b2cfea489f6ae30ecb80c5b0292a0ff 100644 |
| --- a/tools/json_schema_compiler/cpp_type_generator.py |
| +++ b/tools/json_schema_compiler/cpp_type_generator.py |
| @@ -4,6 +4,7 @@ |
| from code import Code |
| from model import PropertyType |
| +import any_helper |
| import cpp_util |
| class CppTypeGenerator(object): |
| @@ -134,8 +135,12 @@ class CppTypeGenerator(object): |
| cpp_type = 'std::string' |
| elif prop.type_ == PropertyType.ENUM: |
| cpp_type = cpp_util.Classname(prop.name) |
| - elif prop.type_ == PropertyType.ANY: |
| + elif prop.type_ == PropertyType.ADDITIONAL_PROPERTIES: |
| cpp_type = 'DictionaryValue' |
| + elif prop.type_ == PropertyType.ANY: |
| + cpp_type = any_helper.ANY_CLASS |
| + elif prop.type_ == PropertyType.OBJECT: |
| + cpp_type = cpp_util.Classname(prop.name) |
| elif prop.type_ == PropertyType.ARRAY: |
| if prop.item_type.type_ in ( |
| PropertyType.REF, PropertyType.ANY, PropertyType.OBJECT): |
| @@ -144,8 +149,6 @@ class CppTypeGenerator(object): |
| cpp_type = 'std::vector<%s> ' |
| cpp_type = cpp_type % self.GetType( |
| prop.item_type, pad_for_generics=True) |
| - elif prop.type_ == PropertyType.OBJECT: |
|
not at google - send to devlin
2012/02/28 22:41:17
Confused, why not support OBJECT? Even if you don
calamity
2012/03/01 04:47:09
Moved this up, sorry. wanted all the simple, 1-lin
|
| - cpp_type = cpp_util.Classname(prop.name) |
| else: |
| raise NotImplementedError(prop.type_) |