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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 487533005: Add support for references in different paths in apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
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 de6d1306287511d5419ed199174aae6b1663ac17..6bec67e43c03187e15d7d9cbba51b823cb016a5c 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -96,7 +96,10 @@ class CppTypeGenerator(object):
if self._default_namespace is type_.namespace:
cpp_type = cpp_util.Classname(type_.name)
else:
- cpp_type = '%s::%s' % (type_.namespace.unix_name,
+ cpp_namespace = cpp_util.GetCppNamespace(
+ type_.namespace.environment.namespace_pattern,
+ type_.namespace.unix_name)
+ cpp_type = '%s::%s' % (cpp_namespace,
cpp_util.Classname(type_.name))
elif type_.property_type == PropertyType.ANY:
cpp_type = 'base::Value'
@@ -130,7 +133,7 @@ class CppTypeGenerator(object):
PropertyType.OBJECT,
PropertyType.CHOICES))
- def GenerateForwardDeclarations(self, cpp_namespace_pattern):
+ def GenerateForwardDeclarations(self):
"""Returns the forward declarations for self._default_namespace.
"""
c = Code()
@@ -144,8 +147,9 @@ class CppTypeGenerator(object):
if not filtered_deps:
continue
- cpp_namespace = cpp_util.GetCppNamespace(cpp_namespace_pattern,
- namespace.unix_name)
+ cpp_namespace = cpp_util.GetCppNamespace(
+ namespace.environment.namespace_pattern,
+ namespace.unix_name)
c.Concat(cpp_util.OpenNamespace(cpp_namespace))
for dep in filtered_deps:
c.Append('struct %s;' % dep.type_.name)
« no previous file with comments | « tools/json_schema_compiler/cpp_namespace_environment.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