| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 from in_file import InFile | 34 from in_file import InFile |
| 35 import name_macros | 35 import name_macros |
| 36 import name_utilities | 36 import name_utilities |
| 37 import template_expander | 37 import template_expander |
| 38 | 38 |
| 39 | 39 |
| 40 def case_insensitive_matching(name): | 40 def case_insensitive_matching(name): |
| 41 return (name == ('HTMLEvents') | 41 return (name == ('HTMLEvents') |
| 42 or name == 'Event' | 42 or name == 'Event' |
| 43 or name == 'Events' | 43 or name == 'Events' |
| 44 or name.startswith('UIEvent') | 44 or name.startswith('UIEvent')) |
| 45 or name.startswith('CustomEvent')) | |
| 46 | 45 |
| 47 class EventFactoryWriter(name_macros.Writer): | 46 class EventFactoryWriter(name_macros.Writer): |
| 48 defaults = { | 47 defaults = { |
| 49 'ImplementedAs': None, | 48 'ImplementedAs': None, |
| 50 'Conditional': None, | 49 'Conditional': None, |
| 51 'RuntimeEnabled': None, | 50 'RuntimeEnabled': None, |
| 52 } | 51 } |
| 53 default_parameters = { | 52 default_parameters = { |
| 54 'namespace': '', | 53 'namespace': '', |
| 55 'suffix': '', | 54 'suffix': '', |
| 56 } | 55 } |
| 57 filters = { | 56 filters = { |
| 58 'cpp_name': name_utilities.cpp_name, | 57 'cpp_name': name_utilities.cpp_name, |
| 59 'enable_conditional': name_utilities.enable_conditional_if_endif, | 58 'enable_conditional': name_utilities.enable_conditional_if_endif, |
| 60 'lower_first': name_utilities.lower_first, | 59 'lower_first': name_utilities.lower_first, |
| 61 'case_insensitive_matching': case_insensitive_matching, | 60 'case_insensitive_matching': case_insensitive_matching, |
| 62 'script_name': name_utilities.script_name, | 61 'script_name': name_utilities.script_name, |
| 63 } | 62 } |
| 64 | 63 |
| 65 def __init__(self, in_file_path): | 64 def __init__(self, in_file_path): |
| 66 super(EventFactoryWriter, self).__init__(in_file_path) | 65 super(EventFactoryWriter, self).__init__(in_file_path) |
| 67 | 66 |
| 68 if __name__ == "__main__": | 67 if __name__ == "__main__": |
| 69 name_macros.Maker(EventFactoryWriter).main(sys.argv) | 68 name_macros.Maker(EventFactoryWriter).main(sys.argv) |
| OLD | NEW |