Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: tools/json_schema_compiler/h_generator.py

Issue 2000403003: [forbots] IWYU for ax_enums.h Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/accessibility_browser_test_utils.cc ('k') | ui/accessibility/ax_node_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from code import Code 7 from code import Code
8 from model import PropertyType 8 from model import PropertyType
9 import cpp_util 9 import cpp_util
10 import schema_util 10 import schema_util
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 dependency_order.append(type_) 134 dependency_order.append(type_)
135 135
136 for type_ in self._namespace.types.values(): 136 for type_ in self._namespace.types.values():
137 ExpandType([], type_) 137 ExpandType([], type_)
138 return dependency_order 138 return dependency_order
139 139
140 def _GenerateEnumDeclaration(self, enum_name, type_): 140 def _GenerateEnumDeclaration(self, enum_name, type_):
141 """Generate a code object with the declaration of a C++ enum. 141 """Generate a code object with the declaration of a C++ enum.
142 """ 142 """
143 c = Code() 143 c = Code()
144 c.Sblock('enum %s {' % enum_name) 144 c.Sblock('enum %s : int {' % enum_name)
145 c.Append(self._type_helper.GetEnumNoneValue(type_) + ',') 145 c.Append(self._type_helper.GetEnumNoneValue(type_) + ',')
146 for value in type_.enum_values: 146 for value in type_.enum_values:
147 current_enum_string = self._type_helper.GetEnumValue(type_, value) 147 current_enum_string = self._type_helper.GetEnumValue(type_, value)
148 c.Append(current_enum_string + ',') 148 c.Append(current_enum_string + ',')
149 c.Append('%s = %s,' % ( 149 c.Append('%s = %s,' % (
150 self._type_helper.GetEnumLastValue(type_), current_enum_string)) 150 self._type_helper.GetEnumLastValue(type_), current_enum_string))
151 c.Eblock('};') 151 c.Eblock('};')
152 return c 152 return c
153 153
154 def _GenerateFields(self, props): 154 def _GenerateFields(self, props):
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 """Builds the parameter list for a function, given an array of parameters. 396 """Builds the parameter list for a function, given an array of parameters.
397 """ 397 """
398 # |error| is populated with warnings and/or errors found during parsing. 398 # |error| is populated with warnings and/or errors found during parsing.
399 # |error| being set does not necessarily imply failure and may be 399 # |error| being set does not necessarily imply failure and may be
400 # recoverable. 400 # recoverable.
401 # For example, optional properties may have failed to parse, but the 401 # For example, optional properties may have failed to parse, but the
402 # parser was able to continue. 402 # parser was able to continue.
403 if self._generate_error_messages: 403 if self._generate_error_messages:
404 params += ('base::string16* error',) 404 params += ('base::string16* error',)
405 return ', '.join(str(p) for p in params) 405 return ', '.join(str(p) for p in params)
OLDNEW
« no previous file with comments | « content/test/accessibility_browser_test_utils.cc ('k') | ui/accessibility/ax_node_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698