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 5f59ffbe04603f83e730b78cf7bbec8c94698bb7..d64e2daf809e3cb8a2b2711ebea8e2ed317f472a 100644 |
--- a/tools/json_schema_compiler/h_generator.py |
+++ b/tools/json_schema_compiler/h_generator.py |
@@ -214,6 +214,9 @@ class HGenerator(object): |
(c.Eblock() |
.Sblock(' private:') |
+ .Concat(self._GeneratePrivatePropertyStructures( |
+ type_.properties.values())) |
+ .Append() |
.Append('DISALLOW_COPY_AND_ASSIGN(%(classname)s);') |
.Eblock('};') |
) |
@@ -303,6 +306,23 @@ class HGenerator(object): |
c.Append(create_enum_value) |
return c |
+ def _GeneratePrivatePropertyStructures(self, props): |
+ """Generate the private structures required by a property such as OBJECT |
+ classes and enums. |
+ """ |
+ c = Code() |
+ for prop in props: |
+ if prop.type_ == PropertyType.ARRAY: |
+ c.Concat(self._GeneratePrivatePropertyStructures([prop.item_type])) |
+ c.Append() |
+ elif prop.type_ == PropertyType.CHOICES: |
+ # We only need GetChoiceValue() if there is a ToValue() method. |
+ if prop.from_json and prop.from_client: |
not at google - send to devlin
2012/07/19 01:48:22
ditto, why prop.from_json?
chebert
2012/07/19 21:06:17
see cc_generator comment.
On 2012/07/19 01:48:22,
|
+ c.Append('scoped_ptr<base::Value> GetChoiceValue(%s) const;' % |
not at google - send to devlin
2012/07/19 01:48:22
static?
chebert
2012/07/19 21:06:17
see cc_generator comment.
On 2012/07/19 01:48:22,
|
+ cpp_util.GetParameterDeclaration(prop, |
+ self._cpp_type_generator.GetChoicesEnumType(prop))) |
+ return c |
+ |
def _GenerateCreateCallbackArguments(self, function): |
"""Generates functions for passing paramaters to a callback. |
""" |