| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 | 297 |
| 298 # [ImplementedAs] | 298 # [ImplementedAs] |
| 299 def cpp_name(definition_or_member): | 299 def cpp_name(definition_or_member): |
| 300 extended_attributes = definition_or_member.extended_attributes | 300 extended_attributes = definition_or_member.extended_attributes |
| 301 if 'ImplementedAs' not in extended_attributes: | 301 if 'ImplementedAs' not in extended_attributes: |
| 302 return definition_or_member.name | 302 return definition_or_member.name |
| 303 return extended_attributes['ImplementedAs'] | 303 return extended_attributes['ImplementedAs'] |
| 304 | 304 |
| 305 | 305 |
| 306 def cpp_name_from_interfaces_info(name, interfaces_info): |
| 307 return interfaces_info.get(name, {}).get('implemented_as') or name |
| 308 |
| 309 |
| 306 def cpp_name_or_partial(interface): | 310 def cpp_name_or_partial(interface): |
| 307 cpp_class_name = cpp_name(interface) | 311 cpp_class_name = cpp_name(interface) |
| 308 if interface.is_partial: | 312 if interface.is_partial: |
| 309 return ''.join([cpp_class_name, 'Partial']) | 313 return ''.join([cpp_class_name, 'Partial']) |
| 310 return cpp_class_name | 314 return cpp_class_name |
| 311 | 315 |
| 312 | 316 |
| 313 # [MeasureAs] | 317 # [MeasureAs] |
| 314 def measure_as(definition_or_member): | 318 def measure_as(definition_or_member): |
| 315 extended_attributes = definition_or_member.extended_attributes | 319 extended_attributes = definition_or_member.extended_attributes |
| (...skipping 18 matching lines...) Expand all Loading... |
| 334 | 338 |
| 335 The returned function checks if a method/attribute is enabled. | 339 The returned function checks if a method/attribute is enabled. |
| 336 Given extended attribute RuntimeEnabled=FeatureName, return: | 340 Given extended attribute RuntimeEnabled=FeatureName, return: |
| 337 RuntimeEnabledFeatures::{featureName}Enabled | 341 RuntimeEnabledFeatures::{featureName}Enabled |
| 338 """ | 342 """ |
| 339 extended_attributes = definition_or_member.extended_attributes | 343 extended_attributes = definition_or_member.extended_attributes |
| 340 if 'RuntimeEnabled' not in extended_attributes: | 344 if 'RuntimeEnabled' not in extended_attributes: |
| 341 return None | 345 return None |
| 342 feature_name = extended_attributes['RuntimeEnabled'] | 346 feature_name = extended_attributes['RuntimeEnabled'] |
| 343 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 347 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
| OLD | NEW |