| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from code import Code | 5 from code import Code |
| 6 from model import PropertyType | 6 from model import PropertyType |
| 7 import cpp_util | 7 import cpp_util |
| 8 import schema_util | 8 import schema_util |
| 9 import util_cc_helper | 9 import util_cc_helper |
| 10 | 10 |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 def _GenerateError(self, body): | 921 def _GenerateError(self, body): |
| 922 """Generates an error message pertaining to population failure. | 922 """Generates an error message pertaining to population failure. |
| 923 | 923 |
| 924 E.g 'expected bool, got int' | 924 E.g 'expected bool, got int' |
| 925 """ | 925 """ |
| 926 c = Code() | 926 c = Code() |
| 927 if not self._generate_error_messages: | 927 if not self._generate_error_messages: |
| 928 return c | 928 return c |
| 929 (c.Append('if (error)') | 929 (c.Append('if (error)') |
| 930 .Append(' *error = UTF8ToUTF16(' + body + ');')) | 930 .Append(' *error = base::UTF8ToUTF16(' + body + ');')) |
| 931 return c | 931 return c |
| 932 | 932 |
| 933 def _GenerateParams(self, params): | 933 def _GenerateParams(self, params): |
| 934 """Builds the parameter list for a function, given an array of parameters. | 934 """Builds the parameter list for a function, given an array of parameters. |
| 935 """ | 935 """ |
| 936 if self._generate_error_messages: | 936 if self._generate_error_messages: |
| 937 params = list(params) + ['base::string16* error'] | 937 params = list(params) + ['base::string16* error'] |
| 938 return ', '.join(str(p) for p in params) | 938 return ', '.join(str(p) for p in params) |
| 939 | 939 |
| 940 def _GenerateArgs(self, args): | 940 def _GenerateArgs(self, args): |
| 941 """Builds the argument list for a function, given an array of arguments. | 941 """Builds the argument list for a function, given an array of arguments. |
| 942 """ | 942 """ |
| 943 if self._generate_error_messages: | 943 if self._generate_error_messages: |
| 944 args = list(args) + ['error'] | 944 args = list(args) + ['error'] |
| 945 return ', '.join(str(a) for a in args) | 945 return ', '.join(str(a) for a in args) |
| OLD | NEW |