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 #ifndef TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ | 5 #ifndef TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ |
6 #define TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ | 6 #define TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 template <class T> | 200 template <class T> |
201 std::unique_ptr<base::Value> CreateValueFromArray(const std::vector<T>& from) { | 201 std::unique_ptr<base::Value> CreateValueFromArray(const std::vector<T>& from) { |
202 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 202 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
203 PopulateListFromArray(from, list.get()); | 203 PopulateListFromArray(from, list.get()); |
204 return std::move(list); | 204 return std::move(list); |
205 } | 205 } |
206 | 206 |
207 template <class T> | 207 template <class T> |
208 std::unique_ptr<base::Value> CreateValueFromOptionalArray( | 208 std::unique_ptr<base::Value> CreateValueFromOptionalArray( |
209 const std::unique_ptr<std::vector<T>>& from) { | 209 const std::unique_ptr<std::vector<T>>& from) { |
210 if (from) | 210 return from ? CreateValueFromArray(*from) : nullptr; |
211 return CreateValueFromArray(*from); | |
212 return nullptr; | |
213 } | 211 } |
214 | 212 |
215 std::string ValueTypeToString(base::Value::Type type); | |
216 | |
217 } // namespace util | 213 } // namespace util |
218 } // namespace json_schema_compiler | 214 } // namespace json_schema_compiler |
219 | 215 |
220 #endif // TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ | 216 #endif // TOOLS_JSON_SCHEMA_COMPILER_UTIL_H_ |
OLD | NEW |