Vitaly Buka | 4615e0d | 2015-10-14 15:35:12 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Weave Authors. All rights reserved. |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Vitaly Buka | 912b698 | 2015-07-06 11:13:03 -0700 | [diff] [blame] | 5 | #ifndef LIBWEAVE_SRC_UTILS_H_ |
| 6 | #define LIBWEAVE_SRC_UTILS_H_ |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 7 | |
| 8 | #include <memory> |
Alex Vakulenko | 9e2f8cd | 2015-04-07 16:28:09 -0700 | [diff] [blame] | 9 | #include <string> |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 10 | |
| 11 | #include <base/values.h> |
Vitaly Buka | 0801a1f | 2015-08-14 10:03:46 -0700 | [diff] [blame] | 12 | #include <weave/error.h> |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 13 | |
Vitaly Buka | b6f015a | 2015-07-09 14:59:23 -0700 | [diff] [blame] | 14 | namespace weave { |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 15 | |
Vitaly Buka | e2810e0 | 2015-08-16 23:31:55 -0700 | [diff] [blame] | 16 | namespace errors { |
Vitaly Buka | 0fa51e5 | 2015-07-10 00:12:25 -0700 | [diff] [blame] | 17 | extern const char kErrorDomain[]; |
Vitaly Buka | e2810e0 | 2015-08-16 23:31:55 -0700 | [diff] [blame] | 18 | extern const char kSchemaError[]; |
Alex Vakulenko | 07216fe | 2014-09-19 15:31:09 -0700 | [diff] [blame] | 19 | extern const char kInvalidCategoryError[]; |
| 20 | extern const char kInvalidPackageError[]; |
Vitaly Buka | e2810e0 | 2015-08-16 23:31:55 -0700 | [diff] [blame] | 21 | } // namespace errors |
Alex Vakulenko | 07216fe | 2014-09-19 15:31:09 -0700 | [diff] [blame] | 22 | |
| 23 | // kDefaultCategory represents a default state property category for standard |
| 24 | // properties from "base" package which are provided by buffet and not any of |
| 25 | // the daemons running on the device. |
| 26 | const char kDefaultCategory[] = ""; |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 27 | |
Alex Vakulenko | 9e2f8cd | 2015-04-07 16:28:09 -0700 | [diff] [blame] | 28 | // Helper function to load a JSON dictionary from a string. |
Vitaly Buka | 207c1cb | 2015-05-14 17:06:18 -0700 | [diff] [blame] | 29 | std::unique_ptr<base::DictionaryValue> LoadJsonDict( |
| 30 | const std::string& json_string, |
Vitaly Buka | 0801a1f | 2015-08-14 10:03:46 -0700 | [diff] [blame] | 31 | ErrorPtr* error); |
Alex Vakulenko | 9e2f8cd | 2015-04-07 16:28:09 -0700 | [diff] [blame] | 32 | |
Vitaly Buka | 70f77d9 | 2015-10-07 15:42:40 -0700 | [diff] [blame] | 33 | std::unique_ptr<base::DictionaryValue> ErrorInfoToJson(const Error& error); |
| 34 | |
Vitaly Buka | b6f015a | 2015-07-09 14:59:23 -0700 | [diff] [blame] | 35 | } // namespace weave |
Alex Vakulenko | b04936f | 2014-09-19 14:53:58 -0700 | [diff] [blame] | 36 | |
Vitaly Buka | 912b698 | 2015-07-06 11:13:03 -0700 | [diff] [blame] | 37 | #endif // LIBWEAVE_SRC_UTILS_H_ |