OLD | NEW |
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 Loading... |
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) |
OLD | NEW |