PFW: parameter access code reuse
BZ: 13283
Path navigator embeds a navigate and validate functionality
that spares parameter manager from replicating code between
get and set parameter contexts.
Change-Id: Ic7c950660cd8c22b233ce02238fa1a66649a501b
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/25403
Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 83867d5..61e204a 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -1652,31 +1652,14 @@
{
CPathNavigator pathNavigator(strPath);
- if (!pathNavigator.isPathValid()) {
-
- strError = "Path not well formed";
-
- return false;
- }
-
- string* pStrChildName = pathNavigator.next();
-
- if (!pStrChildName) {
-
- strError = "Non settable element";
-
- return false;
- }
-
- if (*pStrChildName != getSystemClass()->getName()) {
-
- strError = "Path not found";
+ // Nagivate through system class
+ if (!pathNavigator.navigateThrough(getSystemClass()->getName(), strError)) {
return false;
}
// Define context
- CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, bRawValueSpace, false);
+ CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, bRawValueSpace);
// Set auto sync
parameterAccessContext.setAutoSync(_bAutoSyncOn);
@@ -1692,25 +1675,8 @@
{
CPathNavigator pathNavigator(strPath);
- if (!pathNavigator.isPathValid()) {
-
- strError = "Path not well formed";
-
- return false;
- }
-
- string* pStrChildName = pathNavigator.next();
-
- if (!pStrChildName) {
-
- strError = "Non settable element";
-
- return false;
- }
-
- if (*pStrChildName != getConstSystemClass()->getName()) {
-
- strError = "Path not found";
+ // Nagivate through system class
+ if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strError)) {
return false;
}