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 DBUS_VALUES_UTIL_H_ | 5 #ifndef DBUS_VALUES_UTIL_H_ |
6 #define DBUS_VALUES_UTIL_H_ | 6 #define DBUS_VALUES_UTIL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "dbus/dbus_export.h" | 10 #include "dbus/dbus_export.h" |
9 | 11 |
10 namespace base { | 12 namespace base { |
11 class Value; | 13 class Value; |
12 } | 14 } |
13 | 15 |
14 namespace dbus { | 16 namespace dbus { |
15 | 17 |
16 class MessageReader; | 18 class MessageReader; |
17 class MessageWriter; | 19 class MessageWriter; |
18 | 20 |
19 // Pops a value from |reader| as a base::Value. | 21 // Pops a value from |reader| as a base::Value. |
20 // Returns NULL if an error occurs. | 22 // Returns NULL if an error occurs. |
21 // Note: Integer values larger than int32 (including uint32) are converted to | 23 // Note: Integer values larger than int32_t (including uint32_t) are converted |
22 // double. Non-string diciontary keys are converted to strings. | 24 // to double. Non-string dictionary keys are converted to strings. |
23 CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader); | 25 CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader); |
24 | 26 |
25 // Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER, | 27 // Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER, |
26 // DOUBLE, and STRING. Use this function for values that are known to be basic | 28 // DOUBLE, and STRING. Use this function for values that are known to be basic |
27 // types and to handle basic type members of collections that should not | 29 // types and to handle basic type members of collections that should not |
28 // have type "a{sv}" or "av". Otherwise, use AppendValueData. | 30 // have type "a{sv}" or "av". Otherwise, use AppendValueData. |
29 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer, | 31 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer, |
30 const base::Value& value); | 32 const base::Value& value); |
31 | 33 |
32 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN, | 34 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN, |
(...skipping 16 matching lines...) Expand all Loading... |
49 // as a collection type, such as dictionary or list. Collections will be | 51 // as a collection type, such as dictionary or list. Collections will be |
50 // recursively written as variant containers, i.e. dictionaries will be written | 52 // recursively written as variant containers, i.e. dictionaries will be written |
51 // with type a{sv} and lists with type av. Any sub-dictionaries or sub-lists | 53 // with type a{sv} and lists with type av. Any sub-dictionaries or sub-lists |
52 // will also have these types. | 54 // will also have these types. |
53 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer, | 55 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer, |
54 const base::Value& value); | 56 const base::Value& value); |
55 | 57 |
56 } // namespace dbus | 58 } // namespace dbus |
57 | 59 |
58 #endif // DBUS_VALUES_UTIL_H_ | 60 #endif // DBUS_VALUES_UTIL_H_ |
OLD | NEW |