1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DBUS_VALUES_UTIL_H_
6 #define DBUS_VALUES_UTIL_H_
10 #include "dbus/dbus_export.h"
22 // Pops a value from |reader| as a base::Value.
23 // Returns base::Value() if an error occurs.
24 // Note: Integer values larger than int32_t (including uint32_t) are converted
25 // to double. Non-string dictionary keys are converted to strings.
26 CHROME_DBUS_EXPORT base::Value PopDataAsValue(MessageReader* reader);
28 // Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER,
29 // DOUBLE, and STRING. Use this function for values that are known to be basic
30 // types and to handle basic type members of collections that should not
31 // have type "a{sv}" or "av". Otherwise, use AppendValueData.
32 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer,
33 base::ValueView value);
35 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN,
36 // INTEGER, DOUBLE, and STRING. Use this function for values that are known to
37 // be basic types and to handle basic type members of collections that should
38 // not have type "a{sv}" or "av". Otherwise, use AppendValueDataAsVariant.
39 CHROME_DBUS_EXPORT void AppendBasicTypeValueDataAsVariant(
40 MessageWriter* writer,
41 base::ValueView value);
43 // Appends a value to |writer|. Value can be a basic type, as well as a
44 // collection type, such as dictionary or list. Collections will be recursively
45 // written as variant containers, i.e. dictionaries will be written with type
46 // a{sv} and lists with type av. Any sub-dictionaries or sub-lists will also
48 CHROME_DBUS_EXPORT void AppendValueData(MessageWriter* writer,
49 base::ValueView value);
51 // Appends a value to |writer| as a variant. Value can be a basic type, as well
52 // as a collection type, such as dictionary or list. Collections will be
53 // recursively written as variant containers, i.e. dictionaries will be written
54 // with type a{sv} and lists with type av. Any sub-dictionaries or sub-lists
55 // will also have these types.
56 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer,
57 base::ValueView value);
61 #endif // DBUS_VALUES_UTIL_H_