Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1060)

Side by Side Diff: dbus/values_util.h

Issue 221393004: dbus/values_util.h: Add functions to append collection type values to message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed keybuk@'s comment, unmarked old functions as deprecated as they are useful. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/nfc_tag_client.cc ('k') | dbus/values_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "dbus/dbus_export.h" 8 #include "dbus/dbus_export.h"
9 9
10 namespace base { 10 namespace base {
11 class Value; 11 class Value;
12 } 12 }
13 13
14 namespace dbus { 14 namespace dbus {
15 15
16 class MessageReader; 16 class MessageReader;
17 class MessageWriter; 17 class MessageWriter;
18 18
19 // Pops a value from |reader| as a base::Value. 19 // Pops a value from |reader| as a base::Value.
20 // Returns NULL if an error occurs. 20 // Returns NULL if an error occurs.
21 // Note: Integer values larger than int32 (including uint32) are converted to 21 // Note: Integer values larger than int32 (including uint32) are converted to
22 // double. Non-string diciontary keys are converted to strings. 22 // double. Non-string diciontary keys are converted to strings.
23 CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader); 23 CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader);
24 24
25 // Appends a basic type value to |writer|. 25 // 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
27 // types and to handle basic type members of collections that should not
28 // have type "a{sv}" or "av". Otherwise, use AppendValueData.
26 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer, 29 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer,
27 const base::Value& value); 30 const base::Value& value);
28 31
29 // Appends a basic type value to |writer| as a variant. 32 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN,
33 // INTEGER, DOUBLE, and STRING. Use this function for values that are known to
34 // be basic types and to handle basic type members of collections that should
35 // not have type "a{sv}" or "av". Otherwise, use AppendValueDataAsVariant.
30 CHROME_DBUS_EXPORT void AppendBasicTypeValueDataAsVariant( 36 CHROME_DBUS_EXPORT void AppendBasicTypeValueDataAsVariant(
31 MessageWriter* writer, 37 MessageWriter* writer,
32 const base::Value& value); 38 const base::Value& value);
33 39
40 // Appends a value to |writer|. Value can be a basic type, as well as a
41 // collection type, such as dictionary or list. Collections will be recursively
42 // written as variant containers, i.e. dictionaries will be written with type
43 // a{sv} and lists with type av. Any sub-dictionaries or sub-lists will also
44 // have these types.
45 CHROME_DBUS_EXPORT void AppendValueData(MessageWriter* writer,
46 const base::Value& value);
47
48 // Appends a value to |writer| as a variant. Value can be a basic type, as well
49 // as a collection type, such as dictionary or list. Collections will be
50 // 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
52 // will also have these types.
53 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer,
54 const base::Value& value);
55
34 } // namespace dbus 56 } // namespace dbus
35 57
36 #endif // DBUS_VALUES_UTIL_H_ 58 #endif // DBUS_VALUES_UTIL_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/nfc_tag_client.cc ('k') | dbus/values_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698