| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 default_parameters = { | 46 default_parameters = { |
| 47 'namespace': '', | 47 'namespace': '', |
| 48 } | 48 } |
| 49 filters = { | 49 filters = { |
| 50 'script_name': name_utilities.script_name, | 50 'script_name': name_utilities.script_name, |
| 51 'cpp_name': name_utilities.cpp_name, | 51 'cpp_name': name_utilities.cpp_name, |
| 52 'lower_first': name_utilities.lower_first, | 52 'lower_first': name_utilities.lower_first, |
| 53 } | 53 } |
| 54 | 54 |
| 55 def __init__(self, in_file_path, enabled_conditions): | 55 def __init__(self, in_file_path): |
| 56 super(EventFactoryWriter, self).__init__(in_file_path, enabled_condition
s) | 56 super(EventFactoryWriter, self).__init__(in_file_path) |
| 57 self._outputs[(self.namespace + ".cpp")] = self.generate_implementation | 57 self._outputs[(self.namespace + ".cpp")] = self.generate_implementation |
| 58 | 58 |
| 59 @template_expander.use_jinja('EventFactory.cpp.tmpl', filters=filters) | 59 @template_expander.use_jinja('EventFactory.cpp.tmpl', filters=filters) |
| 60 def generate_implementation(self): | 60 def generate_implementation(self): |
| 61 return { | 61 return { |
| 62 'namespace': self.namespace, | 62 'namespace': self.namespace, |
| 63 'events': self.in_file.name_dictionaries, | 63 'events': self.in_file.name_dictionaries, |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 if __name__ == "__main__": | 67 if __name__ == "__main__": |
| 68 name_macros.Maker(EventFactoryWriter).main(sys.argv) | 68 name_macros.Maker(EventFactoryWriter).main(sys.argv) |
| OLD | NEW |