| 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 import os | 5 import os |
| 6 | 6 |
| 7 from code import Code | 7 from code import Code |
| 8 from model import PropertyType | 8 from model import PropertyType |
| 9 import cpp_util | 9 import cpp_util |
| 10 import schema_util | 10 import schema_util |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 (maybe_static, classname, classname)) | 221 (maybe_static, classname, classname)) |
| 222 ) | 222 ) |
| 223 elif type_.property_type in (PropertyType.CHOICES, | 223 elif type_.property_type in (PropertyType.CHOICES, |
| 224 PropertyType.OBJECT): | 224 PropertyType.OBJECT): |
| 225 if type_.description: | 225 if type_.description: |
| 226 c.Comment(type_.description) | 226 c.Comment(type_.description) |
| 227 (c.Sblock('struct %(classname)s {') | 227 (c.Sblock('struct %(classname)s {') |
| 228 .Append('%(classname)s();') | 228 .Append('%(classname)s();') |
| 229 .Append('~%(classname)s();') | 229 .Append('~%(classname)s();') |
| 230 ) | 230 ) |
| 231 if 'use_movable_types' in type_.namespace.compiler_options: | 231 (c.Append('%(classname)s(%(classname)s&& rhs);') |
| 232 (c.Append('%(classname)s(%(classname)s&& rhs);') | 232 .Append('%(classname)s& operator=(%(classname)s&& rhs);') |
| 233 .Append('%(classname)s& operator=(%(classname)s&& rhs);') | 233 ) |
| 234 ) | |
| 235 if type_.origin.from_json: | 234 if type_.origin.from_json: |
| 236 (c.Append() | 235 (c.Append() |
| 237 .Comment('Populates a %s object from a base::Value. Returns' | 236 .Comment('Populates a %s object from a base::Value. Returns' |
| 238 ' whether |out| was successfully populated.' % classname) | 237 ' whether |out| was successfully populated.' % classname) |
| 239 .Append('static bool Populate(%s);' % self._GenerateParams( | 238 .Append('static bool Populate(%s);' % self._GenerateParams( |
| 240 ('const base::Value& value', '%s* out' % classname))) | 239 ('const base::Value& value', '%s* out' % classname))) |
| 241 ) | 240 ) |
| 242 if is_toplevel: | 241 if is_toplevel: |
| 243 (c.Append() | 242 (c.Append() |
| 244 .Comment('Creates a %s object from a base::Value, or NULL on ' | 243 .Comment('Creates a %s object from a base::Value, or NULL on ' |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 """Builds the parameter list for a function, given an array of parameters. | 397 """Builds the parameter list for a function, given an array of parameters. |
| 399 """ | 398 """ |
| 400 # |error| is populated with warnings and/or errors found during parsing. | 399 # |error| is populated with warnings and/or errors found during parsing. |
| 401 # |error| being set does not necessarily imply failure and may be | 400 # |error| being set does not necessarily imply failure and may be |
| 402 # recoverable. | 401 # recoverable. |
| 403 # For example, optional properties may have failed to parse, but the | 402 # For example, optional properties may have failed to parse, but the |
| 404 # parser was able to continue. | 403 # parser was able to continue. |
| 405 if self._generate_error_messages: | 404 if self._generate_error_messages: |
| 406 params += ('base::string16* error',) | 405 params += ('base::string16* error',) |
| 407 return ', '.join(str(p) for p in params) | 406 return ', '.join(str(p) for p in params) |
| OLD | NEW |