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

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

Issue 22228002: Add optional schema compiler error messages (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced up to latest master. Created 7 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
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | 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 API_UTIL_NAMESPACE = 'json_schema_compiler::util' 5 API_UTIL_NAMESPACE = 'json_schema_compiler::util'
6 6
7 class UtilCCHelper(object): 7 class UtilCCHelper(object):
8 """A util class that generates code that uses 8 """A util class that generates code that uses
9 tools/json_schema_compiler/util.cc. 9 tools/json_schema_compiler/util.cc.
10 """ 10 """
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 if optional: 71 if optional:
72 val = '%(namespace)s::CreateValueFromOptionalArray(%(src)s)' 72 val = '%(namespace)s::CreateValueFromOptionalArray(%(src)s)'
73 else: 73 else:
74 val = '%(namespace)s::CreateValueFromArray(%(src)s)' 74 val = '%(namespace)s::CreateValueFromArray(%(src)s)'
75 75
76 return val % sub 76 return val % sub
77 77
78 def GetIncludePath(self): 78 def GetIncludePath(self):
79 return '#include "tools/json_schema_compiler/util.h"' 79 return '#include "tools/json_schema_compiler/util.h"'
80
81 def GetValueTypeString(self, value, is_ptr=False):
82 call = '.GetType()'
83 if is_ptr:
84 call = '->GetType()'
85 return 'json_schema_compiler::util::ValueTypeToString(%s%s)' % (value, call)
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698