| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  115  |  115  | 
|  116 class ExceptionCodeDescriptionWriter(name_macros.Writer): |  116 class ExceptionCodeDescriptionWriter(name_macros.Writer): | 
|  117     defaults = { |  117     defaults = { | 
|  118         'interfaceName': None, |  118         'interfaceName': None, | 
|  119         'conditional': None, |  119         'conditional': None, | 
|  120     } |  120     } | 
|  121     default_parameters = { |  121     default_parameters = { | 
|  122         'namespace': '', |  122         'namespace': '', | 
|  123     } |  123     } | 
|  124  |  124  | 
 |  125     def __init__(self, in_file_path, enabled_conditions): | 
 |  126         super(ExceptionCodeDescriptionWriter, self).__init__(in_file_path, enabl
     ed_conditions) | 
 |  127         self._outputs[(self.class_name + ".cpp")] = self.generate_implementation | 
 |  128         self._outputs[(self.class_name + ".h")] = self.generate_header | 
 |  129  | 
|  125     def _exceptions(self): |  130     def _exceptions(self): | 
|  126         return self.in_file.name_dictionaries |  131         return self.in_file.name_dictionaries | 
|  127  |  132  | 
|  128     def _exception_type(self, exception): |  133     def _exception_type(self, exception): | 
|  129         name = os.path.basename(exception['name']) |  134         name = os.path.basename(exception['name']) | 
|  130         return self.wrap_with_condition('    ' + name + 'Type,', exception['cond
     itional']) |  135         return self.wrap_with_condition('    ' + name + 'Type,', exception['cond
     itional']) | 
|  131  |  136  | 
|  132     def generate_header(self): |  137     def generate_header(self): | 
|  133         return HEADER_TEMPLATE % { |  138         return HEADER_TEMPLATE % { | 
|  134             'license': license.license_for_generated_cpp(), |  139             'license': license.license_for_generated_cpp(), | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|  152         return IMPLEMENTATION_TEMPLATE % { |  157         return IMPLEMENTATION_TEMPLATE % { | 
|  153             'license': license.license_for_generated_cpp(), |  158             'license': license.license_for_generated_cpp(), | 
|  154             'class_name': self.class_name, |  159             'class_name': self.class_name, | 
|  155             'includes': '\n'.join(map(self._include, self._exceptions())), |  160             'includes': '\n'.join(map(self._include, self._exceptions())), | 
|  156             'description_initalizations': '\n'.join(map(self._description_inital
     ization, self._exceptions())), |  161             'description_initalizations': '\n'.join(map(self._description_inital
     ization, self._exceptions())), | 
|  157         } |  162         } | 
|  158  |  163  | 
|  159  |  164  | 
|  160 if __name__ == "__main__": |  165 if __name__ == "__main__": | 
|  161     name_macros.Maker(ExceptionCodeDescriptionWriter).main(sys.argv) |  166     name_macros.Maker(ExceptionCodeDescriptionWriter).main(sys.argv) | 
| OLD | NEW |