summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-11-07 20:01:02 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:59 +0100
commit99041c5b5ed90dd66c65fa1903a74f5f3f9a8fdc (patch)
tree0cfd397ffc37b512c0dc155083e25202382b3420 /parameter/ParameterMgr.cpp
parent082dd4728914bae6d6cb70e74c8cffa5155082a3 (diff)
downloadexternal_parameter-framework-99041c5b5ed90dd66c65fa1903a74f5f3f9a8fdc.zip
external_parameter-framework-99041c5b5ed90dd66c65fa1903a74f5f3f9a8fdc.tar.gz
external_parameter-framework-99041c5b5ed90dd66c65fa1903a74f5f3f9a8fdc.tar.bz2
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>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp44
1 files changed, 5 insertions, 39 deletions
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 @@ bool CParameterMgr::doSetValue(const string& strPath, const string& strValue, bo
{
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 @@ bool CParameterMgr::doGetValue(const string& strPath, string& strValue, bool bRa
{
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;
}