| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 return self._native_type | 494 return self._native_type |
| 495 return self._idl_type | 495 return self._idl_type |
| 496 | 496 |
| 497 def parameter_adapter_info(self): | 497 def parameter_adapter_info(self): |
| 498 native_type = self.native_type() | 498 native_type = self.native_type() |
| 499 if self._ref_counted: | 499 if self._ref_counted: |
| 500 native_type = 'RefPtr< %s >' % native_type | 500 native_type = 'RefPtr< %s >' % native_type |
| 501 if self._has_dart_wrapper: | 501 if self._has_dart_wrapper: |
| 502 wrapper_type = 'Dart%s' % self.idl_type() | 502 wrapper_type = 'Dart%s' % self.idl_type() |
| 503 adapter_type = 'ParameterAdapter<%s, %s>' % (native_type, wrapper_type) | 503 adapter_type = 'ParameterAdapter<%s, %s>' % (native_type, wrapper_type) |
| 504 return (adapter_type, wrapper_type) | 504 return (adapter_type, '"%s.h"' % wrapper_type) |
| 505 return ('ParameterAdapter< %s >' % native_type, self._idl_type) | 505 return ('ParameterAdapter< %s >' % native_type, '"%s.h"' % self._idl_type) |
| 506 | 506 |
| 507 def parameter_type(self): | 507 def parameter_type(self): |
| 508 return '%s*' % self.native_type() | 508 return '%s*' % self.native_type() |
| 509 | 509 |
| 510 def webcore_includes(self): | 510 def webcore_includes(self): |
| 511 WTF_INCLUDES = [ |
| 512 'ArrayBuffer', |
| 513 'ArrayBufferView', |
| 514 'Float32Array', |
| 515 'Float64Array', |
| 516 'Int8Array', |
| 517 'Int16Array', |
| 518 'Int32Array', |
| 519 'Uint8Array', |
| 520 'Uint16Array', |
| 521 'Uint32Array', |
| 522 'Uint8ClampedArray', |
| 523 ] |
| 524 |
| 525 if self._idl_type in WTF_INCLUDES: |
| 526 return ['<wtf/%s.h>' % self._idl_type] |
| 527 |
| 511 if not self._idl_type.startswith('SVG'): | 528 if not self._idl_type.startswith('SVG'): |
| 512 return [self._idl_type] | 529 return ['"%s.h"' % self._idl_type] |
| 513 | 530 |
| 514 if self._idl_type in ['SVGNumber', 'SVGPoint']: | 531 if self._idl_type in ['SVGNumber', 'SVGPoint']: |
| 515 return [] | 532 return [] |
| 516 if self._idl_type.startswith('SVGPathSeg'): | 533 if self._idl_type.startswith('SVGPathSeg'): |
| 517 include = self._idl_type.replace('Abs', '').replace('Rel', '') | 534 include = self._idl_type.replace('Abs', '').replace('Rel', '') |
| 518 else: | 535 else: |
| 519 include = self._idl_type | 536 include = self._idl_type |
| 520 return [include] + _svg_supplemental_includes | 537 return ['"%s.h"' % include] + _svg_supplemental_includes |
| 521 | 538 |
| 522 def receiver(self): | 539 def receiver(self): |
| 523 return 'receiver->' | 540 return 'receiver->' |
| 524 | 541 |
| 525 def conversion_includes(self): | 542 def conversion_includes(self): |
| 526 return ['Dart%s' % include for include in [self.dart_type()] + self._convers
ion_includes] | 543 return ['"Dart%s.h"' % include for include in [self.dart_type()] + self._con
version_includes] |
| 527 | 544 |
| 528 def conversion_cast(self, expression): | 545 def conversion_cast(self, expression): |
| 529 if self._conversion_template: | 546 if self._conversion_template: |
| 530 return self._conversion_template % expression | 547 return self._conversion_template % expression |
| 531 return expression | 548 return expression |
| 532 | 549 |
| 533 def custom_to_dart(self): | 550 def custom_to_dart(self): |
| 534 return self._custom_to_dart | 551 return self._custom_to_dart |
| 535 | 552 |
| 536 class PrimitiveIDLTypeInfo(IDLTypeInfo): | 553 class PrimitiveIDLTypeInfo(IDLTypeInfo): |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 'SVGPoint': SVGTearOffIDLTypeInfo('SVGPoint', native_type='SVGPropertyTearOf
f<FloatPoint>'), | 666 'SVGPoint': SVGTearOffIDLTypeInfo('SVGPoint', native_type='SVGPropertyTearOf
f<FloatPoint>'), |
| 650 'SVGPointList': SVGTearOffIDLTypeInfo('SVGPointList', ref_counted=False), | 667 'SVGPointList': SVGTearOffIDLTypeInfo('SVGPointList', ref_counted=False), |
| 651 'SVGPreserveAspectRatio': SVGTearOffIDLTypeInfo('SVGPreserveAspectRatio'), | 668 'SVGPreserveAspectRatio': SVGTearOffIDLTypeInfo('SVGPreserveAspectRatio'), |
| 652 'SVGRect': SVGTearOffIDLTypeInfo('SVGRect', native_type='SVGPropertyTearOff<
FloatRect>'), | 669 'SVGRect': SVGTearOffIDLTypeInfo('SVGRect', native_type='SVGPropertyTearOff<
FloatRect>'), |
| 653 'SVGStringList': SVGTearOffIDLTypeInfo('SVGStringList', native_type='SVGStat
icListPropertyTearOff<SVGStringList>', ref_counted=False), | 670 'SVGStringList': SVGTearOffIDLTypeInfo('SVGStringList', native_type='SVGStat
icListPropertyTearOff<SVGStringList>', ref_counted=False), |
| 654 'SVGTransform': SVGTearOffIDLTypeInfo('SVGTransform'), | 671 'SVGTransform': SVGTearOffIDLTypeInfo('SVGTransform'), |
| 655 'SVGTransformList': SVGTearOffIDLTypeInfo('SVGTransformList', native_type='S
VGTransformListPropertyTearOff', ref_counted=False) | 672 'SVGTransformList': SVGTearOffIDLTypeInfo('SVGTransformList', native_type='S
VGTransformListPropertyTearOff', ref_counted=False) |
| 656 } | 673 } |
| 657 | 674 |
| 658 _svg_supplemental_includes = [ | 675 _svg_supplemental_includes = [ |
| 659 'SVGAnimatedPropertyTearOff', | 676 '"SVGAnimatedPropertyTearOff.h"', |
| 660 'SVGAnimatedListPropertyTearOff', | 677 '"SVGAnimatedListPropertyTearOff.h"', |
| 661 'SVGStaticListPropertyTearOff', | 678 '"SVGStaticListPropertyTearOff.h"', |
| 662 'SVGAnimatedListPropertyTearOff', | 679 '"SVGAnimatedListPropertyTearOff.h"', |
| 663 'SVGTransformListPropertyTearOff', | 680 '"SVGTransformListPropertyTearOff.h"', |
| 664 'SVGPathSegListPropertyTearOff', | 681 '"SVGPathSegListPropertyTearOff.h"', |
| 665 ] | 682 ] |
| 666 | 683 |
| 667 def GetIDLTypeInfo(idl_type_name): | 684 def GetIDLTypeInfo(idl_type_name): |
| 668 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 685 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |