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

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

Issue 1551493002: Switch to standard integer types in tools/json_schema_compiler/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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 from code import Code 5 from code import Code
6 from model import PropertyType 6 from model import PropertyType
7 import cpp_util 7 import cpp_util
8 from json_parse import OrderedDict 8 from json_parse import OrderedDict
9 import schema_util 9 import schema_util
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if type_.property_type == PropertyType.REF: 78 if type_.property_type == PropertyType.REF:
79 ref_type = self._FindType(type_.ref_type) 79 ref_type = self._FindType(type_.ref_type)
80 if ref_type is None: 80 if ref_type is None:
81 raise KeyError('Cannot find referenced type: %s' % type_.ref_type) 81 raise KeyError('Cannot find referenced type: %s' % type_.ref_type)
82 cpp_type = self.GetCppType(ref_type) 82 cpp_type = self.GetCppType(ref_type)
83 elif type_.property_type == PropertyType.BOOLEAN: 83 elif type_.property_type == PropertyType.BOOLEAN:
84 cpp_type = 'bool' 84 cpp_type = 'bool'
85 elif type_.property_type == PropertyType.INTEGER: 85 elif type_.property_type == PropertyType.INTEGER:
86 cpp_type = 'int' 86 cpp_type = 'int'
87 elif type_.property_type == PropertyType.INT64: 87 elif type_.property_type == PropertyType.INT64:
88 cpp_type = 'int64' 88 cpp_type = 'int64_t'
89 elif type_.property_type == PropertyType.DOUBLE: 89 elif type_.property_type == PropertyType.DOUBLE:
90 cpp_type = 'double' 90 cpp_type = 'double'
91 elif type_.property_type == PropertyType.STRING: 91 elif type_.property_type == PropertyType.STRING:
92 cpp_type = 'std::string' 92 cpp_type = 'std::string'
93 elif type_.property_type in (PropertyType.ENUM, 93 elif type_.property_type in (PropertyType.ENUM,
94 PropertyType.OBJECT, 94 PropertyType.OBJECT,
95 PropertyType.CHOICES): 95 PropertyType.CHOICES):
96 if self._default_namespace is type_.namespace: 96 if self._default_namespace is type_.namespace:
97 cpp_type = cpp_util.Classname(type_.name) 97 cpp_type = cpp_util.Classname(type_.name)
98 else: 98 else:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 child_code = self.GeneratePropertyValues(child_property, 268 child_code = self.GeneratePropertyValues(child_property,
269 line, 269 line,
270 nodoc=nodoc) 270 nodoc=nodoc)
271 if child_code: 271 if child_code:
272 has_child_code = True 272 has_child_code = True
273 c.Concat(child_code) 273 c.Concat(child_code)
274 c.Eblock('} // namespace %s' % prop.name) 274 c.Eblock('} // namespace %s' % prop.name)
275 if not has_child_code: 275 if not has_child_code:
276 c = None 276 c = None
277 return c 277 return c
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/cpp_bundle_generator.py ('k') | tools/json_schema_compiler/h_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698