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>
diff --git a/property_store.h b/property_store.h
index 2edc333..696ea17 100644
--- a/property_store.h
+++ b/property_store.h
@@ -68,7 +68,13 @@
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 @@
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_;