summaryrefslogtreecommitdiff
path: root/key_value_store.h
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@chromium.org>2015-08-14 16:31:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-08-28 16:44:35 -0700
commit625d65886e75f9b15cab6e0683d6fc832a5c8010 (patch)
treed93575c7bb12a4aa91b41c736070121bf2987e32 /key_value_store.h
parent0bce1e99f2ef851a8894f6633fc39a22d07d72cc (diff)
downloadshill-625d65886e75f9b15cab6e0683d6fc832a5c8010.tar.gz
shill: KeyValueStore: add support for chromeos::Any value
This is useful for supporting rare/complex data types, so that we don't have to define a new API for each one of them. BUG=chromium:517680 TEST=unittests Change-Id: I0d27948107f4a2a903309a2f9b83aad204c8ec7a Reviewed-on: https://chromium-review.googlesource.com/293891 Commit-Ready: Zeping Qiu <zqiu@chromium.org> Tested-by: Zeping Qiu <zqiu@chromium.org> Reviewed-by: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'key_value_store.h')
-rw-r--r--key_value_store.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/key_value_store.h b/key_value_store.h
index ce0238b7..ed2b9ac9 100644
--- a/key_value_store.h
+++ b/key_value_store.h
@@ -53,6 +53,7 @@ class KeyValueStore {
bool ContainsUint8(const std::string& name) const;
bool ContainsUint8s(const std::string& name) const;
bool ContainsUint32s(const std::string& name) const;
+ bool Contains(const std::string& name) const;
bool GetBool(const std::string& name) const;
const std::vector<std::vector<uint8_t>>& GetByteArrays(
@@ -70,6 +71,7 @@ class KeyValueStore {
uint8_t GetUint8(const std::string& name) const;
const std::vector<uint8_t>& GetUint8s(const std::string& name) const;
const std::vector<uint32_t>& GetUint32s(const std::string& name) const;
+ const chromeos::Any& Get(const std::string& name) const;
// TODO(zqiu): remove type specific set functions and add a generic set
// function instead. This way, we don't need to add new functions every
@@ -91,6 +93,7 @@ class KeyValueStore {
void SetUint8(const std::string& name, uint8_t value);
void SetUint8s(const std::string& name, const std::vector<uint8_t>& value);
void SetUint32s(const std::string& name, const std::vector<uint32_t>& value);
+ void Set(const std::string& name, const chromeos::Any& value);
// TODO(zqiu): remove type specific remove functions and add a generic remove
// function instead.
@@ -106,6 +109,7 @@ class KeyValueStore {
void RemoveUint8(const std::string& name);
void RemoveUint8s(const std::string& name);
void RemoveUint32s(const std::string& name);
+ void Remove(const std::string& name);
// If |name| is in this store returns its value, otherwise returns
// |default_value|.