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 f398c752ec04e4348e1188e6cc89d6730a55b93b..f18b66b31d6d8675de8581fdbd7bae386a6f426b 100644 |
--- a/tools/json_schema_compiler/cpp_type_generator.py |
+++ b/tools/json_schema_compiler/cpp_type_generator.py |
@@ -152,6 +152,10 @@ class CppTypeGenerator(object): |
cpp_type = any_helper.ANY_CLASS |
elif prop.type_ == PropertyType.OBJECT: |
cpp_type = cpp_util.Classname(prop.name) |
+ elif prop.type_ == PropertyType.FUNCTION: |
+ # If the property is an optional function, we need to know if it whether |
+ # or not it was passed. |
+ cpp_type = 'bool' |
elif prop.type_ == PropertyType.ARRAY: |
item_type = prop.item_type |
if item_type.type_ == PropertyType.REF: |
@@ -170,7 +174,8 @@ class CppTypeGenerator(object): |
# Enums aren't wrapped because C++ won't allow it. Optional enums have a |
# NONE value generated instead. |
not at google - send to devlin
2012/07/25 01:32:33
Add comment like "We only generate "has" methods f
chebert
2012/07/25 18:38:30
Done.
|
- if wrap_optional and prop.optional and prop.type_ != PropertyType.ENUM: |
+ if wrap_optional and prop.optional and prop.type_ not in (PropertyType.ENUM, |
+ PropertyType.FUNCTION): |
not at google - send to devlin
2012/07/25 01:32:33
nit: each condition on its own line, like
if (wra
chebert
2012/07/25 18:38:30
Done.
|
cpp_type = 'scoped_ptr<%s> ' % cpp_type |
if pad_for_generics: |
return cpp_type |