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

Unified Diff: tools/json_schema_compiler/h_generator.py

Issue 10796114: Added ToJson to JSON schema compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changes per comments 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..5bd680cc19926965ffbcda6554d6fc472c73ea13 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -229,7 +229,8 @@ class HGenerator(object):
"""
c = Code()
(c.Sblock('namespace %s {' % cpp_util.Classname(event.name))
- .Concat(self._GenerateCreateCallbackArguments(event))
+ .Concat(self._GenerateCreateCallbackArguments(event,
+ generate_to_json=True))
.Eblock('};')
)
return c
@@ -323,7 +324,7 @@ class HGenerator(object):
cpp_util.Classname(prop.name)))
return c
- def _GenerateCreateCallbackArguments(self, function):
+ def _GenerateCreateCallbackArguments(self, function, generate_to_json=False):
"""Generates functions for passing paramaters to a callback.
"""
c = Code()
@@ -340,6 +341,8 @@ class HGenerator(object):
param, self._cpp_type_generator.GetType(param)))
c.Append('scoped_ptr<base::ListValue> Create(%s);' %
', '.join(declaration_list))
+ if is_event:
not at google - send to devlin 2012/07/26 02:39:58 I think this needs to be generate_to_json...
mitchellwrosen 2012/07/26 17:38:59 Oops! Done
+ c.Append('std::string ToJson(%s);' % ', '.join(declaration_list))
return c
def _GenerateFunctionResults(self, callback):

Powered by Google App Engine
This is Rietveld 408576698