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

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

Issue 143473003: Generate ax enums from idl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add allow custom filename property to top level idl. Created 6 years, 10 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 (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 import schema_util 8 import schema_util
9 import util_cc_helper 9 import util_cc_helper
10 10
(...skipping 28 matching lines...) Expand all
39 c = Code() 39 c = Code()
40 (c.Append(cpp_util.CHROMIUM_LICENSE) 40 (c.Append(cpp_util.CHROMIUM_LICENSE)
41 .Append() 41 .Append()
42 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file) 42 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file)
43 .Append() 43 .Append()
44 .Append(self._util_cc_helper.GetIncludePath()) 44 .Append(self._util_cc_helper.GetIncludePath())
45 .Append('#include "base/logging.h"') 45 .Append('#include "base/logging.h"')
46 .Append('#include "base/strings/string_number_conversions.h"') 46 .Append('#include "base/strings/string_number_conversions.h"')
47 .Append('#include "base/strings/utf_string_conversions.h"') 47 .Append('#include "base/strings/utf_string_conversions.h"')
48 .Append('#include "%s/%s.h"' % 48 .Append('#include "%s/%s.h"' %
49 (self._namespace.source_file_dir, self._namespace.unix_name)) 49 (self._namespace.source_file_dir, self._namespace.short_filename))
50 .Cblock(self._type_helper.GenerateIncludes(include_soft=True)) 50 .Cblock(self._type_helper.GenerateIncludes(include_soft=True))
51 .Append() 51 .Append()
52 .Concat(cpp_util.OpenNamespace(self._cpp_namespace)) 52 .Concat(cpp_util.OpenNamespace(self._cpp_namespace))
53 .Cblock(self._type_helper.GetNamespaceStart()) 53 .Cblock(self._type_helper.GetNamespaceStart())
54 ) 54 )
55 if self._namespace.properties: 55 if self._namespace.properties:
56 (c.Append('//') 56 (c.Append('//')
57 .Append('// Properties') 57 .Append('// Properties')
58 .Append('//') 58 .Append('//')
59 .Append() 59 .Append()
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 if self._generate_error_messages: 936 if self._generate_error_messages:
937 params = list(params) + ['base::string16* error'] 937 params = list(params) + ['base::string16* error']
938 return ', '.join(str(p) for p in params) 938 return ', '.join(str(p) for p in params)
939 939
940 def _GenerateArgs(self, args): 940 def _GenerateArgs(self, args):
941 """Builds the argument list for a function, given an array of arguments. 941 """Builds the argument list for a function, given an array of arguments.
942 """ 942 """
943 if self._generate_error_messages: 943 if self._generate_error_messages:
944 args = list(args) + ['error'] 944 args = list(args) + ['error']
945 return ', '.join(str(a) for a in args) 945 return ', '.join(str(a) for a in args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698