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

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

Issue 437883002: Make the root_namespace argument to json_schema_compiler.gypi a string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: un-escape %% for windows Created 6 years, 4 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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.path 5 import os.path
6 6
7 from code import Code 7 from code import Code
8 import cpp_util 8 import cpp_util
9 9
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 def Generate(self): 26 def Generate(self):
27 """Generates a Code object for features. 27 """Generates a Code object for features.
28 """ 28 """
29 c = Code() 29 c = Code()
30 (c.Append(cpp_util.CHROMIUM_LICENSE) 30 (c.Append(cpp_util.CHROMIUM_LICENSE)
31 .Append() 31 .Append()
32 .Append(cpp_util.GENERATED_FEATURE_MESSAGE % self._source_file) 32 .Append(cpp_util.GENERATED_FEATURE_MESSAGE % self._source_file)
33 .Append() 33 .Append()
34 ) 34 )
35 ifndef_name = cpp_util.GenerateIfndefName(self._source_file_filename, 35
36 self._class_name) 36 # Hack: for the purpose of gyp the header file will always be the source
37 # file with its file extension replaced by '.h'. Assume so.
38 output_file = os.path.splitext(self._namespace.source_file)[0] + '.h'
39 ifndef_name = cpp_util.GenerateIfndefName(output_file)
40
37 (c.Append('#ifndef %s' % ifndef_name) 41 (c.Append('#ifndef %s' % ifndef_name)
38 .Append('#define %s' % ifndef_name) 42 .Append('#define %s' % ifndef_name)
39 .Append() 43 .Append()
40 ) 44 )
41 45
42 (c.Append('#include <map>') 46 (c.Append('#include <map>')
43 .Append('#include <string>') 47 .Append('#include <string>')
44 .Append() 48 .Append()
45 .Concat(cpp_util.OpenNamespace(self._namespace)) 49 .Concat(cpp_util.OpenNamespace(self._namespace))
46 .Append() 50 .Append()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 c = Code() 90 c = Code()
87 91
88 (c.Sblock() 92 (c.Sblock()
89 .Append('kUnknown,') 93 .Append('kUnknown,')
90 ) 94 )
91 for feature in self._feature_defs: 95 for feature in self._feature_defs:
92 c.Append('%s,' % cpp_util.ConstantName(feature.name)) 96 c.Append('%s,' % cpp_util.ConstantName(feature.name))
93 c.Append('kEnumBoundary') 97 c.Append('kEnumBoundary')
94 98
95 return c 99 return c
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698