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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 'type_name': None, | 58 'type_name': None, |
59 'getter': None, | 59 'getter': None, |
60 'setter': None, | 60 'setter': None, |
61 'initial': None, | 61 'initial': None, |
62 # Setting these stops default handlers being generated | 62 # Setting these stops default handlers being generated |
63 # Setting custom_all is the same as setting the other three | 63 # Setting custom_all is the same as setting the other three |
64 'custom_all': False, | 64 'custom_all': False, |
65 'custom_initial': False, | 65 'custom_initial': False, |
66 'custom_inherit': False, | 66 'custom_inherit': False, |
67 'custom_value': False, | 67 'custom_value': False, |
68 # For the length apply type. Will get moved out to StyleBuilderFunctions.cpp.tmp
l | 68 # For the length apply type. Will get moved out to StyleBuilderFunctions.cpp |
69 'use_none': False, | 69 'use_none': False, |
70 'use_intrinsic': False, | 70 'use_intrinsic': False, |
71 'use_auto': False, | 71 'use_auto': False, |
72 } | 72 } |
73 | 73 |
74 def __init__(self, in_files, enabled_conditions): | 74 def __init__(self, in_files, enabled_conditions): |
75 super(StyleBuilderWriter, self).__init__(in_files, enabled_conditions) | 75 super(StyleBuilderWriter, self).__init__(in_files, enabled_conditions) |
76 self._outputs = {("StyleBuilderFunctions.h"): self.generate_style_builde
r_functions_h, | 76 self._outputs = {("StyleBuilderFunctions.h"): self.generate_style_builde
r_functions_h, |
77 ("StyleBuilderFunctions.cpp"): self.generate_style_buil
der_functions_cpp, | 77 ("StyleBuilderFunctions.cpp"): self.generate_style_buil
der_functions_cpp, |
78 ("StyleBuilder.cpp"): self.generate_style_builder, | 78 ("StyleBuilder.cpp"): self.generate_style_builder, |
(...skipping 27 matching lines...) Expand all Loading... |
106 return re.sub(r'(^[^-])|-(.)', lambda match: (match.group(1) or match.gr
oup(2)).upper(), property_name) | 106 return re.sub(r'(^[^-])|-(.)', lambda match: (match.group(1) or match.gr
oup(2)).upper(), property_name) |
107 | 107 |
108 @staticmethod | 108 @staticmethod |
109 def _lower_first(s): | 109 def _lower_first(s): |
110 return s[0].lower() + s[1:] | 110 return s[0].lower() + s[1:] |
111 | 111 |
112 @staticmethod | 112 @staticmethod |
113 def _upper_first(s): | 113 def _upper_first(s): |
114 return s[0].upper() + s[1:] | 114 return s[0].upper() + s[1:] |
115 | 115 |
116 @template_expander.use_jinja("StyleBuilderFunctions.h.tmpl") | 116 @template_expander.use_jinja("StyleBuilderFunctions.h") |
117 def generate_style_builder_functions_h(self): | 117 def generate_style_builder_functions_h(self): |
118 return { | 118 return { |
119 "properties": self._properties, | 119 "properties": self._properties, |
120 } | 120 } |
121 | 121 |
122 @template_expander.use_jinja("StyleBuilderFunctions.cpp.tmpl") | 122 @template_expander.use_jinja("StyleBuilderFunctions.cpp") |
123 def generate_style_builder_functions_cpp(self): | 123 def generate_style_builder_functions_cpp(self): |
124 return { | 124 return { |
125 "properties": self._properties, | 125 "properties": self._properties, |
126 } | 126 } |
127 | 127 |
128 @template_expander.use_jinja("StyleBuilder.cpp.tmpl") | 128 @template_expander.use_jinja("StyleBuilder.cpp") |
129 def generate_style_builder(self): | 129 def generate_style_builder(self): |
130 return { | 130 return { |
131 "properties": self._properties, | 131 "properties": self._properties, |
132 } | 132 } |
133 | 133 |
134 | 134 |
135 if __name__ == "__main__": | 135 if __name__ == "__main__": |
136 in_generator.Maker(StyleBuilderWriter).main(sys.argv) | 136 in_generator.Maker(StyleBuilderWriter).main(sys.argv) |
OLD | NEW |