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..7fc14e5491107073463f7f3f6e467a848de5214b 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,7 @@ 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 schema_util.IsLocalReference(prop, self._namespace.name): |
not at google - send to devlin
2012/06/07 03:00:54
IsReferenceInNamespace?
though I would still have
benjhayden
2012/06/08 16:41:52
Done.
|
ExpandType(path + [type_], self._namespace.types[prop.ref_type]) |
if not type_ in dependency_order: |
dependency_order.append(type_) |
@@ -178,7 +176,20 @@ class HGenerator(object): |
if type_.description: |
c.Comment(type_.description) |
c.Append('typedef std::string %(classname)s;') |
- c.Substitute({'classname': classname}) |
+ elif type_.type_ == PropertyType.DOUBLE: |
+ if type_.description: |
+ c.Comment(type_.description) |
+ c.Append('typedef double %(classname)s;') |
+ elif type_.type_ == PropertyType.INTEGER: |
+ if type_.description: |
+ c.Comment(type_.description) |
+ # TODO(benjhayden): c.Sblock('enum %(classname)s {') ... .Eblock('};') |
+ # Generated cpp code should contain all constants defined in the IDL so |
+ # that they don't need to be copied between the IDL and the |
+ # implementation. This requires correctly parsing and transmitting the |
+ # constants' names from the IDL to here. The same goes for string and |
+ # double enums. |
not at google - send to devlin
2012/06/07 03:00:54
We do generate code for constants that are defined
benjhayden
2012/06/08 16:41:52
Antony suggested using extended attributes to be m
|
+ c.Append('typedef int %(classname)s;') |
else: |
if type_.description: |
c.Comment(type_.description) |