| 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 7cf6836fbf00ae8d92d79d166c46c056ea7c0665..3eca5a7e4cf52cd22e3ded29fbca8b4e2cc06a65 100644
|
| --- a/tools/json_schema_compiler/h_generator.py
|
| +++ b/tools/json_schema_compiler/h_generator.py
|
| @@ -26,6 +26,9 @@ class _Generator(object):
|
| self._cpp_namespace = cpp_namespace
|
| self._target_namespace = (
|
| self._type_helper.GetCppNamespaceName(self._namespace))
|
| + self._error_parameter = ''
|
| + if self._namespace.generate_error_messages:
|
| + self._error_parameter = ', std::string* error = NULL'
|
|
|
| def Generate(self):
|
| """Generates a Code object with the .h for a single namespace.
|
| @@ -228,14 +231,15 @@ class _Generator(object):
|
| .Comment('Populates a %s object from a base::Value. Returns'
|
| ' whether |out| was successfully populated.' % classname)
|
| .Append('static bool Populate(const base::Value& value, '
|
| - '%(classname)s* out);')
|
| + '%s* out%s);' % (classname, self._error_parameter))
|
| )
|
| if is_toplevel:
|
| (c.Append()
|
| .Comment('Creates a %s object from a base::Value, or NULL on '
|
| 'failure.' % classname)
|
| - .Append('static scoped_ptr<%(classname)s> '
|
| - 'FromValue(const base::Value& value);')
|
| + .Append('static scoped_ptr<%s> FromValue('
|
| + 'const base::Value& value%s);' %
|
| + (classname, self._error_parameter))
|
| )
|
| if type_.origin.from_client:
|
| (c.Append()
|
| @@ -279,7 +283,7 @@ class _Generator(object):
|
| (c.Comment('Populates a %s object from a base::Value. Returns'
|
| ' whether |out| was successfully populated.' % classname)
|
| .Append('static bool Populate(const base::Value& value, '
|
| - '%(classname)s* out);')
|
| + '%s* out%s);' % (classname, self._error_parameter))
|
| .Append()
|
| )
|
| if type_.origin.from_client:
|
| @@ -338,7 +342,8 @@ class _Generator(object):
|
|
|
| c = Code()
|
| (c.Sblock('struct Params {')
|
| - .Append('static scoped_ptr<Params> Create(const base::ListValue& args);')
|
| + .Append('static scoped_ptr<Params> Create('
|
| + 'const base::ListValue& args%s);' % self._error_parameter)
|
| .Append('~Params();')
|
| .Append()
|
| .Cblock(self._GenerateTypes(p.type_ for p in function.params))
|
|
|