diff options
author | mukesh agrawal <quiche@chromium.org> | 2011-10-06 15:26:10 -0700 |
---|---|---|
committer | mukesh agrawal <quiche@chromium.org> | 2011-10-07 09:52:15 -0700 |
commit | ffa3d0433d419aa9251f3768a0090a27b6b1c434 (patch) | |
tree | f7beac0b6eba964d1d0fa6fd25d7440342a8925b /property_store.h | |
parent | ab565bb6f148849fc0ceb12529ff93acfbbed71f (diff) | |
download | shill-ffa3d0433d419aa9251f3768a0090a27b6b1c434.tar.gz |
shill: allow property accessors to return an error message if a
property's value cannot be changed.
also, reduce some code duplication in property_store.cc
BUG=chromium-os:21384
TEST=unittests
Change-Id: Iaac8d40bbb9e9a1341d6c6d01642885d88ac0e27
Reviewed-on: http://gerrit.chromium.org/gerrit/8925
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Diffstat (limited to 'property_store.h')
-rw-r--r-- | property_store.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/property_store.h b/property_store.h index 2edc333e..696ea17d 100644 --- a/property_store.h +++ b/property_store.h @@ -68,7 +68,13 @@ class PropertyStore { uint32 value, Error *error); - // Accessors for iterators over property maps. + // We do not provide methods for reading individual properties, + // because we don't need them to implement the flimflam API. (The flimflam + // API only allows fetching all properties at once -- not individual + // properties.) + + // Accessors for iterators over property maps. Useful for dumping all + // properties. PropertyConstIterator<bool> GetBoolPropertiesIter() const; PropertyConstIterator<int16> GetInt16PropertiesIter() const; PropertyConstIterator<int32> GetInt32PropertiesIter() const; @@ -112,6 +118,14 @@ class PropertyStore { const StrIntPairAccessor &accessor); private: + template <class V> + bool SetProperty( + const std::string &name, + const V &value, + Error *error, + std::map< std::string, std::tr1::shared_ptr< AccessorInterface<V> > > &, + const std::string &value_type_english); + // These are std::maps instead of something cooler because the common // operation is iterating through them and returning all properties. std::map<std::string, BoolAccessor> bool_properties_; |