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..d97ac30b6c8d9faadadd4eeb2f9eb741f742ab99 100644 |
--- a/tools/json_schema_compiler/cpp_type_generator.py |
+++ b/tools/json_schema_compiler/cpp_type_generator.py |
@@ -21,6 +21,12 @@ class _TypeDependency(object): |
return '%s.%s' % (self.type_.namespace.name, self.type_.name) |
+def GetNamespacePattern(namespace): |
+ if namespace.environment: |
not at google - send to devlin
2014/08/26 20:16:06
Again, when will there not be an environment? I wo
lfg
2014/08/26 21:18:43
Done.
|
+ return namespace.environment.namespace_pattern |
+ return '' |
+ |
+ |
class CppTypeGenerator(object): |
"""Manages the types of properties and provides utilities for getting the |
C++ type out of a model.Property |
@@ -96,7 +102,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( |
+ GetNamespacePattern(type_.namespace), |
+ 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 +139,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,7 +153,7 @@ class CppTypeGenerator(object): |
if not filtered_deps: |
continue |
- cpp_namespace = cpp_util.GetCppNamespace(cpp_namespace_pattern, |
+ cpp_namespace = cpp_util.GetCppNamespace(GetNamespacePattern(namespace), |
namespace.unix_name) |
c.Concat(cpp_util.OpenNamespace(cpp_namespace)) |
for dep in filtered_deps: |