shill: vpn: Use Mapped custom accessor for properties
VPN services simply ask their drivers to populate their PropertyStore.
VPN drivers use CustomMapped accessors to make their KeyValueStore
available.
BUG=chromium-os:28303,chromium-os:28223
TEST=New unit tests
Change-Id: I05a4f2c09ddd03b40b947274fd38572da5d6dbdc
Reviewed-on: https://gerrit.chromium.org/gerrit/18989
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/property_accessor.h b/property_accessor.h
index 9005192..74071fc 100644
--- a/property_accessor.h
+++ b/property_accessor.h
@@ -227,7 +227,7 @@
CustomMappedAccessor(C *target,
void(C::*clearer)(const A &argument, Error *error),
T(C::*getter)(const A &argument, Error *error),
- void(C::*setter)(const T &value, const A &argument,
+ void(C::*setter)(const A &argument, const T &value,
Error *error),
const A &argument)
: target_(target),
@@ -249,7 +249,7 @@
}
void Set(const T &value, Error *error) {
if (setter_) {
- (target_->*setter_)(value, argument_, error);
+ (target_->*setter_)(argument_, value, error);
} else {
error->Populate(Error::kInvalidArguments, "Property is read-only");
}
@@ -259,7 +259,7 @@
C *const target_;
void(C::*const clearer_)(const A &argument, Error *error);
T(C::*const getter_)(const A &argument, Error *error);
- void(C::*const setter_)(const T &value, const A &argument, Error *error);
+ void(C::*const setter_)(const A &argument, const T &value, Error *error);
A argument_;
DISALLOW_COPY_AND_ASSIGN(CustomMappedAccessor);
};