diff options
author | mukesh agrawal <quiche@chromium.org> | 2011-09-06 11:26:05 -0700 |
---|---|---|
committer | mukesh agrawal <quiche@chromium.org> | 2011-09-23 13:55:27 -0700 |
commit | 7a4e4008dc09effe39c94a5f9575644a79ee1388 (patch) | |
tree | 5548268fbae288a48369303ebed3ad17baf029c3 /key_value_store.h | |
parent | 877ff9894e21c4c78b63777025f6c8d577ccd855 (diff) | |
download | shill-7a4e4008dc09effe39c94a5f9575644a79ee1388.tar.gz |
shill: implement Manager.GetService (error-case only)
BUG=chromium-os:20254
TEST=unittests, WiFiManager/000_SSID_Length_Limit
this gives us enough to pass the autotest for
network_WiFiManager/000_SSID_Length_Limit.
Change-Id: Ib0305e707d2203327d846be3e0b206033d6a884a
Reviewed-on: http://gerrit.chromium.org/gerrit/7567
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Diffstat (limited to 'key_value_store.h')
-rw-r--r-- | key_value_store.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/key_value_store.h b/key_value_store.h new file mode 100644 index 00000000..bf026000 --- /dev/null +++ b/key_value_store.h @@ -0,0 +1,51 @@ +// Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SHILL_KEY_VALUE_STORE_ +#define SHILL_KEY_VALUE_STORE_ + +#include <map> +#include <string> + +#include <base/basictypes.h> + +namespace shill { + +class KeyValueStore { + // A simple store for key-value pairs, which supports (a limited set of) + // heterogenous value types. + // + // Compare to PropertyStore, which enables a class to (selectively) + // expose its instance members as properties accessible via + // RPC. (RPC support for ProperyStore is implemented in a + // protocol-specific adaptor. e.g. dbus_adpator.) + // + // Implemented separately from PropertyStore, to avoid complicating + // the PropertyStore interface. In particular, objects implementing the + // PropertyStore interface always provide the storage themselves. In + // contrast, users of KeyValueStore expect KeyValueStore to provide + // storage. + public: + KeyValueStore(); + + bool ContainsBool(const std::string &name) const; + bool ContainsString(const std::string &name) const; + + bool GetBool(const std::string &name) const; + const std::string &GetString(const std::string &name) const; + + void SetBool(const std::string &name, bool value); + void SetString(const std::string& name, + const std::string& value); + + private: + std::map<std::string, bool> bool_properties_; + std::map<std::string, std::string> string_properties_; + + DISALLOW_COPY_AND_ASSIGN(KeyValueStore); +}; + +} // namespace shill + +#endif // SHILL_KEY_VALUE_STORE_ |