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

Unified Diff: tools/json_schema_compiler/util_cc_helper.py

Issue 10022005: Let json schema compiler handle using arrays as types (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor style changes Created 8 years, 8 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
« no previous file with comments | « tools/json_schema_compiler/test/browserAction.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/util_cc_helper.py
diff --git a/tools/json_schema_compiler/util_cc_helper.py b/tools/json_schema_compiler/util_cc_helper.py
index 18dcb020d689f55a2be0403c56ea117329275625..bf089dd990f5a70e09e81ab9e5247baf21008558 100644
--- a/tools/json_schema_compiler/util_cc_helper.py
+++ b/tools/json_schema_compiler/util_cc_helper.py
@@ -35,7 +35,7 @@ class UtilCCHelper(object):
return val % sub
- def PopulateArrayFromList(self, array_prop, src, dst):
+ def PopulateArrayFromList(self, array_prop, src, dst, optional):
"""Generates code to get an array from src into dst.
src: ListValue*
@@ -49,14 +49,14 @@ class UtilCCHelper(object):
'type': self._type_manager.GetType(prop),
}
- if array_prop.optional:
+ if optional:
val = '%(namespace)s::PopulateOptionalArrayFromList(*%(src)s, &%(dst)s)'
else:
val = '%(namespace)s::PopulateArrayFromList(*%(src)s, &%(dst)s)'
return val % sub
- def CreateValueFromArray(self, array_prop, src):
+ def CreateValueFromArray(self, array_prop, src, optional):
"""Generates code to create a scoped_pt<Value> from the array at src.
src: std::vector or scoped_ptr<std::vector>
@@ -68,7 +68,7 @@ class UtilCCHelper(object):
'type': self._type_manager.GetType(prop),
}
- if array_prop.optional:
+ if optional:
val = '%(namespace)s::CreateValueFromOptionalArray(%(src)s)'
else:
val = '%(namespace)s::CreateValueFromArray(%(src)s)'
« no previous file with comments | « tools/json_schema_compiler/test/browserAction.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698