Index: tools/json_schema_compiler/h_generator.py |
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py |
index 72877f1b1f86d1516f55488a268ef9d775e12da9..f83131cd43c8a60425c5225af26040c9123f22a2 100644 |
--- a/tools/json_schema_compiler/h_generator.py |
+++ b/tools/json_schema_compiler/h_generator.py |
@@ -5,8 +5,6 @@ |
from code import Code |
from model import PropertyType |
import cpp_util |
-import model |
-import os |
import schema_util |
class HGenerator(object): |
@@ -111,7 +109,8 @@ class HGenerator(object): |
raise ValueError("Illegal circular dependency via cycle " + |
", ".join(map(lambda x: x.name, path + [type_]))) |
for prop in type_.properties.values(): |
- if not prop.optional and prop.type_ == PropertyType.REF: |
+ if prop.type_ == PropertyType.REF and ((not '.' in prop.ref_type) or |
+ prop.ref_type.startswith(self._namespace.name + '.')): |
not at google - send to devlin
2012/06/04 04:16:49
Perhaps add GetSchemaNamespace to schema_util.py t
benjhayden
2012/06/04 20:33:15
Done.
|
ExpandType(path + [type_], self._namespace.types[prop.ref_type]) |
if not type_ in dependency_order: |
dependency_order.append(type_) |
@@ -179,6 +178,11 @@ class HGenerator(object): |
c.Comment(type_.description) |
c.Append('typedef std::string %(classname)s;') |
c.Substitute({'classname': classname}) |
not at google - send to devlin
2012/06/04 04:16:49
mind deleting the above line while you're here?
benjhayden
2012/06/04 20:33:15
Done.
|
+ elif type_.type_ == PropertyType.INTEGER: |
+ if type_.description: |
+ c.Comment(type_.description) |
+ # TODO: c.Sblock('enum %(classname)s {') ... .Eblock('};') |
not at google - send to devlin
2012/06/04 04:16:49
Please expand on this TODO: add your name, and exp
benjhayden
2012/06/04 20:33:15
Done.
|
+ c.Append('typedef int %(classname)s;') |
else: |
if type_.description: |
c.Comment(type_.description) |