Chris Masone | 8fe2c7e | 2011-06-09 15:51:19 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_PROPERTY_STORE_INTERFACE_ |
| 6 | #define SHILL_PROPERTY_STORE_INTERFACE_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <base/basictypes.h> |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class Error; |
| 17 | |
| 18 | class PropertyStoreInterface { |
| 19 | public: |
| 20 | virtual ~PropertyStoreInterface(); |
| 21 | |
| 22 | // Methods to allow the setting, by name, of properties stored in this object. |
| 23 | // The property names are declared in chromeos/dbus/service_constants.h, |
| 24 | // so that they may be shared with libcros. |
| 25 | // Upon success, these methods return true and leave |error| untouched. |
| 26 | // Upon failure, they return false and set |error| appropriately, if it |
| 27 | // is non-NULL. |
| 28 | virtual bool SetBoolProperty(const std::string& name, |
| 29 | bool value, |
| 30 | Error *error); |
| 31 | |
| 32 | virtual bool SetInt16Property(const std::string& name, |
| 33 | int16 value, |
| 34 | Error *error); |
| 35 | |
| 36 | virtual bool SetInt32Property(const std::string& name, |
| 37 | int32 value, |
| 38 | Error *error); |
| 39 | |
| 40 | virtual bool SetStringProperty(const std::string& name, |
| 41 | const std::string& value, |
| 42 | Error *error); |
| 43 | |
| 44 | virtual bool SetStringmapProperty( |
| 45 | const std::string& name, |
| 46 | const std::map<std::string, std::string>& values, |
| 47 | Error *error); |
| 48 | |
| 49 | virtual bool SetStringsProperty(const std::string& name, |
| 50 | const std::vector<std::string>& values, |
| 51 | Error *error); |
| 52 | |
| 53 | virtual bool SetUint8Property(const std::string& name, |
| 54 | uint8 value, |
| 55 | Error *error); |
| 56 | |
| 57 | virtual bool SetUint16Property(const std::string& name, |
| 58 | uint16 value, |
| 59 | Error *error); |
| 60 | |
| 61 | virtual bool SetUint32Property(const std::string& name, |
| 62 | uint32 value, |
| 63 | Error *error); |
| 64 | |
| 65 | protected: |
| 66 | PropertyStoreInterface(); |
| 67 | |
| 68 | private: |
| 69 | bool ReturnError(const std::string& name, Error *error); |
| 70 | |
| 71 | DISALLOW_COPY_AND_ASSIGN(PropertyStoreInterface); |
| 72 | }; |
| 73 | |
| 74 | } // namespace shill |
| 75 | |
| 76 | #endif // SHILL_PROPERTY_STORE_INTERFACE_ |