| 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 18 matching lines...) Expand all Loading... |
| 29 import os.path | 29 import os.path |
| 30 import shutil | 30 import shutil |
| 31 | 31 |
| 32 from in_file import InFile | 32 from in_file import InFile |
| 33 | 33 |
| 34 | 34 |
| 35 class Writer(object): | 35 class Writer(object): |
| 36 # Subclasses should override. | 36 # Subclasses should override. |
| 37 class_name = None | 37 class_name = None |
| 38 defaults = None | 38 defaults = None |
| 39 valid_values = None |
| 39 default_parameters = None | 40 default_parameters = None |
| 40 | 41 |
| 41 def __init__(self, in_file_path): | 42 def __init__(self, in_file_path): |
| 42 self.in_file = InFile.load_from_path(in_file_path, self.defaults, self.d
efault_parameters) | 43 self.in_file = InFile.load_from_path(in_file_path, self.defaults, self.v
alid_values, self.default_parameters) |
| 43 | 44 |
| 44 # Subclasses should override. | 45 # Subclasses should override. |
| 45 def generate_header(self): | 46 def generate_header(self): |
| 46 raise NotImplementedError | 47 raise NotImplementedError |
| 47 | 48 |
| 48 # Subclasses should override. | 49 # Subclasses should override. |
| 49 def generate_implementation(self): | 50 def generate_implementation(self): |
| 50 raise NotImplementedError | 51 raise NotImplementedError |
| 51 | 52 |
| 52 # Subclasses should override. | 53 # Subclasses should override. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 args = argv[1:] | 105 args = argv[1:] |
| 105 if len(args) < 1: | 106 if len(args) < 1: |
| 106 print "USAGE: %i INPUT_FILE [OUTPUT_DIRECTORY]" % script_name | 107 print "USAGE: %i INPUT_FILE [OUTPUT_DIRECTORY]" % script_name |
| 107 exit(1) | 108 exit(1) |
| 108 output_dir = args[1] if len(args) > 1 else os.getcwd() | 109 output_dir = args[1] if len(args) > 1 else os.getcwd() |
| 109 | 110 |
| 110 writer = self._writer_class(args[0]) | 111 writer = self._writer_class(args[0]) |
| 111 writer.write_header(output_dir) | 112 writer.write_header(output_dir) |
| 112 writer.write_implmentation(output_dir) | 113 writer.write_implmentation(output_dir) |
| 113 writer.write_idl(output_dir) | 114 writer.write_idl(output_dir) |
| OLD | NEW |