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

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

Issue 14272007: Update the remaining include paths of base/string_piece.h to its new location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/android/forwarder2/host_forwarder_main.cc ('k') | ui/base/resource/data_pack.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 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 class _SchemasHGenerator(object): 202 class _SchemasHGenerator(object):
203 """Generates a code.Code object for the generated schemas .h file""" 203 """Generates a code.Code object for the generated schemas .h file"""
204 def __init__(self, cpp_bundle): 204 def __init__(self, cpp_bundle):
205 self._bundle = cpp_bundle 205 self._bundle = cpp_bundle
206 206
207 def Generate(self, namespace): 207 def Generate(self, namespace):
208 c = code.Code() 208 c = code.Code()
209 c.Append('#include <map>') 209 c.Append('#include <map>')
210 c.Append('#include <string>') 210 c.Append('#include <string>')
211 c.Append(); 211 c.Append();
212 c.Append('#include "base/string_piece.h"') 212 c.Append('#include "base/strings/string_piece.h"')
213 c.Append() 213 c.Append()
214 c.Concat(cpp_util.OpenNamespace(self._bundle._cpp_namespace)) 214 c.Concat(cpp_util.OpenNamespace(self._bundle._cpp_namespace))
215 c.Append() 215 c.Append()
216 c.Append('class GeneratedSchemas {') 216 c.Append('class GeneratedSchemas {')
217 c.Sblock(' public:') 217 c.Sblock(' public:')
218 c.Append('// Puts all API schemas in |schemas|.') 218 c.Append('// Puts all API schemas in |schemas|.')
219 c.Append('static void Get(' 219 c.Append('static void Get('
220 'std::map<std::string, base::StringPiece>* schemas);') 220 'std::map<std::string, base::StringPiece>* schemas);')
221 c.Eblock('};'); 221 c.Eblock('};');
222 c.Append() 222 c.Append()
(...skipping 25 matching lines...) Expand all
248 separators=(',', ':')) 248 separators=(',', ':'))
249 # Escape all double-quotes and backslashes. For this to output a valid 249 # Escape all double-quotes and backslashes. For this to output a valid
250 # JSON C string, we need to escape \ and ". 250 # JSON C string, we need to escape \ and ".
251 json_content = json_content.replace('\\', '\\\\').replace('"', '\\"') 251 json_content = json_content.replace('\\', '\\\\').replace('"', '\\"')
252 c.Append('(*schemas)["%s"] = "%s";' % (namespace.name, json_content)) 252 c.Append('(*schemas)["%s"] = "%s";' % (namespace.name, json_content))
253 c.Eblock('}') 253 c.Eblock('}')
254 c.Append() 254 c.Append()
255 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace)) 255 c.Concat(cpp_util.CloseNamespace(self._bundle._cpp_namespace))
256 c.Append() 256 c.Append()
257 return c 257 return c
OLDNEW
« no previous file with comments | « tools/android/forwarder2/host_forwarder_main.cc ('k') | ui/base/resource/data_pack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698