Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: tools/json_schema_compiler/h_generator.py

Issue 10824002: JSON Schema Compiler supports functions as PropertyTypes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: bool function; becomes bool has_function; Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ba7c5ca133a27b4a4ebc5e87089b5a77071a143c..67f1d264b01c99c9d80ca862c276fe02d4cc87dc 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -156,11 +156,17 @@ class HGenerator(object):
c.Append()
for prop in self._cpp_type_generator.ExpandParams(props):
- if prop.description:
+ if prop.type_ == PropertyType.FUNCTION and prop.optional:
+ c.Comment('Determines whether the given optional function was passed '
+ 'as a parameter.')
not at google - send to devlin 2012/07/25 01:32:33 include the function name here, and include the ov
chebert 2012/07/25 18:38:30 Done.
+ elif prop.description:
c.Comment(prop.description)
- c.Append('%s %s;' % (
- self._cpp_type_generator.GetType(prop, wrap_optional=True),
- prop.unix_name))
+ if prop.type_ == PropertyType.FUNCTION:
+ c.Append('bool has_%s;' % prop.unix_name)
not at google - send to devlin 2012/07/25 01:32:33 i think you only want this if it's optional too.
chebert 2012/07/25 18:38:30 Done.
+ else:
+ c.Append('%s %s;' % (
+ self._cpp_type_generator.GetType(prop, wrap_optional=True),
+ prop.unix_name))
c.Append()
return c

Powered by Google App Engine
This is Rietveld 408576698