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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 197873009: Support scoped types in PPAPI IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Created 6 years, 9 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/cc_generator.py ('k') | tools/json_schema_compiler/idl_schema_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 e0e82789ccfee369dc87faad13eb0d971b6d525c..7088c91ff0f4ce1183e005df5fcd76537c35a170 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -96,10 +96,7 @@ class CppTypeGenerator(object):
ref_type = self._FindType(type_.ref_type)
if ref_type is None:
raise KeyError('Cannot find referenced type: %s' % type_.ref_type)
- if self._default_namespace is ref_type.namespace:
- cpp_type = ref_type.name
- else:
- cpp_type = '%s::%s' % (ref_type.namespace.unix_name, ref_type.name)
+ cpp_type = self.GetCppType(ref_type)
elif type_.property_type == PropertyType.BOOLEAN:
cpp_type = 'bool'
elif type_.property_type == PropertyType.INTEGER:
@@ -110,13 +107,16 @@ class CppTypeGenerator(object):
cpp_type = 'double'
elif type_.property_type == PropertyType.STRING:
cpp_type = 'std::string'
- elif type_.property_type == PropertyType.ENUM:
- cpp_type = cpp_util.Classname(type_.name)
+ elif type_.property_type in (PropertyType.ENUM,
+ PropertyType.OBJECT,
+ PropertyType.CHOICES):
+ if self._default_namespace is type_.namespace:
+ cpp_type = cpp_util.Classname(type_.name)
+ else:
+ cpp_type = '%s::%s' % (type_.namespace.unix_name,
+ cpp_util.Classname(type_.name))
elif type_.property_type == PropertyType.ANY:
cpp_type = 'base::Value'
- elif (type_.property_type == PropertyType.OBJECT or
- type_.property_type == PropertyType.CHOICES):
- cpp_type = cpp_util.Classname(type_.name)
elif type_.property_type == PropertyType.FUNCTION:
# Functions come into the json schema compiler as empty objects. We can
# record these as empty DictionaryValues so that we know if the function
« no previous file with comments | « tools/json_schema_compiler/cc_generator.py ('k') | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698