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

Side by Side Diff: tools/json_schema_compiler/cpp_bundle_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
« no previous file with comments | « no previous file | tools/json_schema_compiler/cpp_type_generator.py » ('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 code 5 import code
6 import cpp_util 6 import cpp_util
7 from model import Platforms 7 from model import Platforms
8 from schema_util import CapitalizeFirstLetter 8 from schema_util import CapitalizeFirstLetter
9 from schema_util import JsFunctionNameToClassName 9 from schema_util import JsFunctionNameToClassName
10 10
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 class _APIHGenerator(object): 156 class _APIHGenerator(object):
157 """Generates the header for API registration / declaration""" 157 """Generates the header for API registration / declaration"""
158 def __init__(self, cpp_bundle): 158 def __init__(self, cpp_bundle):
159 self._bundle = cpp_bundle 159 self._bundle = cpp_bundle
160 160
161 def Generate(self, _): # namespace not relevant, this is a bundle 161 def Generate(self, _): # namespace not relevant, this is a bundle
162 c = code.Code() 162 c = code.Code()
163 163
164 c.Append('#include <string>') 164 c.Append('#include <string>')
165 c.Append() 165 c.Append()
166 c.Append('#include "base/basictypes.h"')
167 c.Append()
168 c.Append("class ExtensionFunctionRegistry;") 166 c.Append("class ExtensionFunctionRegistry;")
169 c.Append() 167 c.Append()
170 c.Concat(cpp_util.OpenNamespace(self._bundle._cpp_namespace)) 168 c.Concat(cpp_util.OpenNamespace(self._bundle._cpp_namespace))
171 c.Append() 169 c.Append()
172 c.Append('class %s {' % 170 c.Append('class %s {' %
173 self._bundle._GenerateBundleClass('GeneratedFunctionRegistry')) 171 self._bundle._GenerateBundleClass('GeneratedFunctionRegistry'))
174 c.Sblock(' public:') 172 c.Sblock(' public:')
175 c.Append('static void RegisterAll(' 173 c.Append('static void RegisterAll('
176 'ExtensionFunctionRegistry* registry);') 174 'ExtensionFunctionRegistry* registry);')
177 c.Eblock('};') 175 c.Eblock('};')
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 c.Append() 322 c.Append()
325 c.Append('// static') 323 c.Append('// static')
326 c.Sblock('bool %s::IsGenerated(std::string name) {' % 324 c.Sblock('bool %s::IsGenerated(std::string name) {' %
327 self._bundle._GenerateBundleClass('GeneratedSchemas')) 325 self._bundle._GenerateBundleClass('GeneratedSchemas'))
328 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;') 326 c.Append('return g_lazy_instance.Get().schemas.count(name) > 0;')
329 c.Eblock('}') 327 c.Eblock('}')
330 c.Append() 328 c.Append()
331 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) 329 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace))
332 c.Append() 330 c.Append()
333 return c 331 return c
OLDNEW
« no previous file with comments | « no previous file | tools/json_schema_compiler/cpp_type_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698