diff options
author | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 04:30:22 +0000 |
---|---|---|
committer | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 04:30:22 +0000 |
commit | cf6d0b3ccfb8ac71cde074be1db2be4729792f5d (patch) | |
tree | 6cdb7a41dbf16f6d60dc5ecf7cdf33340575284e /tools/json_schema_compiler/util_cc_helper.py | |
parent | e68d8c6aa7b5fb623800562b946a3a9e03c645c2 (diff) | |
download | chromium_src-cf6d0b3ccfb8ac71cde074be1db2be4729792f5d.zip chromium_src-cf6d0b3ccfb8ac71cde074be1db2be4729792f5d.tar.gz chromium_src-cf6d0b3ccfb8ac71cde074be1db2be4729792f5d.tar.bz2 |
Allow json schema compiler to use arrays as types
Right now the json schema compiler can only handle objects as types. This allows
the schema compiler to use arrays as types. For an example look at
browserAction.
BUG=122075
TEST=cpp_type_generator_test.py
Review URL: http://codereview.chromium.org/10022005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/util_cc_helper.py')
-rw-r--r-- | tools/json_schema_compiler/util_cc_helper.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/json_schema_compiler/util_cc_helper.py b/tools/json_schema_compiler/util_cc_helper.py index 18dcb02..bf089dd 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)' |