| 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 ee5d6f55baa837e3f88e6f57c627bb508ea7e515..4c99718e30a0125f57dcfa44cbf186645e312eb9 100644
|
| --- a/tools/json_schema_compiler/util_cc_helper.py
|
| +++ b/tools/json_schema_compiler/util_cc_helper.py
|
| @@ -12,21 +12,22 @@ class UtilCCHelper(object):
|
| def __init__(self, type_manager):
|
| self._type_manager = type_manager
|
|
|
| - def PopulateArrayFromList(self, src, dst, optional):
|
| + def PopulateArrayFromList(self, src, dst, optional, items_are_binary=False):
|
| """Generates code to get an array from src into dst.
|
|
|
| src: ListValue*
|
| dst: std::vector or scoped_ptr<std::vector>
|
| """
|
| - if optional:
|
| - val = '%(namespace)s::PopulateOptionalArrayFromList(*%(src)s, &%(dst)s)'
|
| - else:
|
| - val = '%(namespace)s::PopulateArrayFromList(*%(src)s, &%(dst)s)'
|
| - return val % {
|
| - 'namespace': _API_UTIL_NAMESPACE,
|
| - 'src': src,
|
| - 'dst': dst
|
| - }
|
| + populate_item_fn = ('PopulateStringFromBinaryValue' if items_are_binary
|
| + else 'PopulateItem')
|
| + populate_list_fn = ('PopulateOptionalArrayFromList' if optional
|
| + else 'PopulateArrayFromList')
|
| + return ('%s::%s(*%s, &%s::%s, &%s)') % (_API_UTIL_NAMESPACE,
|
| + populate_list_fn,
|
| + src,
|
| + _API_UTIL_NAMESPACE,
|
| + populate_item_fn,
|
| + dst)
|
|
|
| def CreateValueFromArray(self, src, optional):
|
| """Generates code to create a scoped_pt<Value> from the array at src.
|
|
|