| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 def _GenerateEvent(self, event): | 282 def _GenerateEvent(self, event): |
| 283 """Generates the namespaces for an event. | 283 """Generates the namespaces for an event. |
| 284 """ | 284 """ |
| 285 c = Code() | 285 c = Code() |
| 286 # TODO(kalman): use event.unix_name not Classname. | 286 # TODO(kalman): use event.unix_name not Classname. |
| 287 event_namespace = cpp_util.Classname(event.name) | 287 event_namespace = cpp_util.Classname(event.name) |
| 288 (c.Append('namespace %s {' % event_namespace) | 288 (c.Append('namespace %s {' % event_namespace) |
| 289 .Append() | 289 .Append() |
| 290 .Concat(self._GenerateEventNameConstant(event)) | 290 .Concat(self._GenerateEventNameConstant(event)) |
| 291 .Concat(self._GenerateCreateCallbackArguments(event)) | 291 .Concat(self._GenerateCreateCallbackArguments(event)) |
| 292 .Eblock('} // namespace %s' % event_namespace) | 292 .Append('} // namespace %s' % event_namespace) |
| 293 ) | 293 ) |
| 294 return c | 294 return c |
| 295 | 295 |
| 296 def _GenerateFunction(self, function): | 296 def _GenerateFunction(self, function): |
| 297 """Generates the namespaces and structs for a function. | 297 """Generates the namespaces and structs for a function. |
| 298 """ | 298 """ |
| 299 c = Code() | 299 c = Code() |
| 300 # TODO(kalman): Use function.unix_name not Classname here. | 300 # TODO(kalman): Use function.unix_name not Classname here. |
| 301 function_namespace = cpp_util.Classname(function.name) | 301 function_namespace = cpp_util.Classname(function.name) |
| 302 # Windows has a #define for SendMessage, so to avoid any issues, we need | 302 # Windows has a #define for SendMessage, so to avoid any issues, we need |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 """Builds the parameter list for a function, given an array of parameters. | 388 """Builds the parameter list for a function, given an array of parameters. |
| 389 """ | 389 """ |
| 390 # |error| is populated with warnings and/or errors found during parsing. | 390 # |error| is populated with warnings and/or errors found during parsing. |
| 391 # |error| being set does not necessarily imply failure and may be | 391 # |error| being set does not necessarily imply failure and may be |
| 392 # recoverable. | 392 # recoverable. |
| 393 # For example, optional properties may have failed to parse, but the | 393 # For example, optional properties may have failed to parse, but the |
| 394 # parser was able to continue. | 394 # parser was able to continue. |
| 395 if self._generate_error_messages: | 395 if self._generate_error_messages: |
| 396 params += ('base::string16* error',) | 396 params += ('base::string16* error',) |
| 397 return ', '.join(str(p) for p in params) | 397 return ', '.join(str(p) for p in params) |
| OLD | NEW |