Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 9491002: json_schema_compiler: any, additionalProperties, functions on types (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add any in arrays to util.h Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | tools/json_schema_compiler/cpp_type_generator_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
- cpp_type = cpp_util.Classname(prop.name)
else:
raise NotImplementedError(prop.type_)
« no previous file with comments | « tools/json_schema_compiler/compiler.py ('k') | tools/json_schema_compiler/cpp_type_generator_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698