summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parameter/ParameterAccessContext.h2
-rw-r--r--parameter/ParameterMgr.cpp44
-rw-r--r--parameter/PathNavigator.cpp29
-rw-r--r--parameter/PathNavigator.h6
4 files changed, 41 insertions, 40 deletions
diff --git a/parameter/ParameterAccessContext.h b/parameter/ParameterAccessContext.h
index af6f1b7..11c0fdc 100644
--- a/parameter/ParameterAccessContext.h
+++ b/parameter/ParameterAccessContext.h
@@ -37,7 +37,7 @@ class CParameterBlackboard;
class CParameterAccessContext : public CErrorContext
{
public:
- CParameterAccessContext(string& strError, CParameterBlackboard* pParameterBlackboard, bool bValueSpaceIsRaw, bool bOutputRawFormatIsHex);
+ CParameterAccessContext(string& strError, CParameterBlackboard* pParameterBlackboard, bool bValueSpaceIsRaw, bool bOutputRawFormatIsHex = false);
CParameterAccessContext(string& strError);
// ParameterBlackboard
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;
}
diff --git a/parameter/PathNavigator.cpp b/parameter/PathNavigator.cpp
index 1911002..cb6bec3 100644
--- a/parameter/PathNavigator.cpp
+++ b/parameter/PathNavigator.cpp
@@ -50,6 +50,35 @@ bool CPathNavigator::isPathValid() const
return _bValid;
}
+// Navigate through
+bool CPathNavigator::navigateThrough(const string& strItemName, string& strError)
+{
+ if (!_bValid) {
+
+ strError = "Path not well formed";
+
+ return false;
+ }
+
+ string* pStrChildName = next();
+
+ if (!pStrChildName) {
+
+ strError = "Path not complete";
+
+ return false;
+ }
+
+ if (*pStrChildName != strItemName) {
+
+ strError = "Path not found";
+
+ return false;
+ }
+
+ return true;
+}
+
string* CPathNavigator::next()
{
if (_uiCurrentIndex < _astrItems.size()) {
diff --git a/parameter/PathNavigator.h b/parameter/PathNavigator.h
index ae3a901..c7f637a 100644
--- a/parameter/PathNavigator.h
+++ b/parameter/PathNavigator.h
@@ -41,10 +41,16 @@ class CPathNavigator
public:
CPathNavigator(const string& strPath);
+ // Path validity
bool isPathValid() const;
+ // Navigate through
+ bool navigateThrough(const string& strItemName, string& strError);
+
+ // Nagivate
string* next();
+ // Current path
string getCurrentPath() const;
private: