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

Side by Side Diff: dbus/values_util.h

Issue 2023633002: Change PopDataAsValue to return a std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « chromeos/dbus/shill_client_unittest_base.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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "dbus/dbus_export.h" 12 #include "dbus/dbus_export.h"
11 13
12 namespace base { 14 namespace base {
13 class Value; 15 class Value;
14 } 16 }
15 17
16 namespace dbus { 18 namespace dbus {
17 19
18 class MessageReader; 20 class MessageReader;
19 class MessageWriter; 21 class MessageWriter;
20 22
21 // Pops a value from |reader| as a base::Value. 23 // Pops a value from |reader| as a base::Value.
22 // Returns NULL if an error occurs. 24 // Returns NULL if an error occurs.
23 // Note: Integer values larger than int32_t (including uint32_t) are converted 25 // Note: Integer values larger than int32_t (including uint32_t) are converted
24 // to double. Non-string dictionary keys are converted to strings. 26 // to double. Non-string dictionary keys are converted to strings.
25 CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader); 27 CHROME_DBUS_EXPORT std::unique_ptr<base::Value> PopDataAsValue(
28 MessageReader* reader);
26 29
27 // Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER, 30 // Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER,
28 // DOUBLE, and STRING. Use this function for values that are known to be basic 31 // DOUBLE, and STRING. Use this function for values that are known to be basic
29 // types and to handle basic type members of collections that should not 32 // types and to handle basic type members of collections that should not
30 // have type "a{sv}" or "av". Otherwise, use AppendValueData. 33 // have type "a{sv}" or "av". Otherwise, use AppendValueData.
31 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer, 34 CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer,
32 const base::Value& value); 35 const base::Value& value);
33 36
34 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN, 37 // Appends a basic type value to |writer| as a variant. Basic types are BOOLEAN,
35 // INTEGER, DOUBLE, and STRING. Use this function for values that are known to 38 // INTEGER, DOUBLE, and STRING. Use this function for values that are known to
(...skipping 15 matching lines...) Expand all
51 // as a collection type, such as dictionary or list. Collections will be 54 // as a collection type, such as dictionary or list. Collections will be
52 // recursively written as variant containers, i.e. dictionaries will be written 55 // recursively written as variant containers, i.e. dictionaries will be written
53 // with type a{sv} and lists with type av. Any sub-dictionaries or sub-lists 56 // with type a{sv} and lists with type av. Any sub-dictionaries or sub-lists
54 // will also have these types. 57 // will also have these types.
55 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer, 58 CHROME_DBUS_EXPORT void AppendValueDataAsVariant(MessageWriter* writer,
56 const base::Value& value); 59 const base::Value& value);
57 60
58 } // namespace dbus 61 } // namespace dbus
59 62
60 #endif // DBUS_VALUES_UTIL_H_ 63 #endif // DBUS_VALUES_UTIL_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_client_unittest_base.cc ('k') | dbus/values_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698