aboutsummaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2014-12-10 14:49:23 +0100
committerDavid Wagner <david.wagner@intel.com>2015-01-22 11:53:52 +0100
commitd8a53107d5f965c8ca406ee95f5999efd6694730 (patch)
tree26656386d16a6f260fb1ecc79ce20e6e96f595f3 /parameter
parent29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b (diff)
downloadexternal_parameter-framework-d8a53107d5f965c8ca406ee95f5999efd6694730.zip
external_parameter-framework-d8a53107d5f965c8ca406ee95f5999efd6694730.tar.gz
external_parameter-framework-d8a53107d5f965c8ca406ee95f5999efd6694730.tar.bz2
Pass the SystemClass as deserialization context for Domains
This allows diminishing the dependency on the parent element when creating a Domain element from an XML document: the parent was used to get a handle to the system class in order to check the existence of ConfigurableElements included in the Domain. Change-Id: Icba7c3c4db2b9728c0fb7c6840a254de9775f6a4 Signed-off-by: David Wagner <david.wagner@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r--parameter/ConfigurableDomain.cpp12
-rw-r--r--parameter/ParameterMgr.cpp5
-rw-r--r--parameter/XmlDomainImportContext.h14
3 files changed, 19 insertions, 12 deletions
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index c3fa1f9..bdcddd4 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -253,12 +253,7 @@ bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElemen
bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElement,
CXmlDomainImportContext& serializingContext)
{
- // Get System Class Element
- CElement* pRootElement = getRoot();
-
- CElement* pSystemClassElement = pRootElement->findChildOfKind("SystemClass");
-
- assert(pSystemClassElement);
+ CSystemClass& systemClass = serializingContext.getSystemClass();
// Get ConfigurableElements element
CXmlElement xmlConfigurableElementsElement;
@@ -278,14 +273,15 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen
string strError;
// Is there an element and does it match system class name?
- if (!pathNavigator.navigateThrough(pSystemClassElement->getName(), strError)) {
+ if (!pathNavigator.navigateThrough(systemClass.getName(), strError)) {
serializingContext.setError("Could not find configurable element of path " + strConfigurableElementPath + " from ConfigurableDomain description " + getName() + " (" + strError + ")");
return false;
}
// Browse system class for configurable element
- CConfigurableElement* pConfigurableElement = static_cast<CConfigurableElement*>(pSystemClassElement->findDescendant(pathNavigator));
+ CConfigurableElement* pConfigurableElement =
+ static_cast<CConfigurableElement*>(systemClass.findDescendant(pathNavigator));
if (!pConfigurableElement) {
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 749aacd..8a6adf0 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -622,7 +622,8 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
string strXmlConfigurationDomainsFolder = pConfigurableDomainsFileLocation->getFolderPath(_strXmlConfigurationFolderPath);
// Parse configuration domains XML file (ask to read settings from XML file if they are not provided as binary)
- CXmlDomainImportContext xmlDomainImportContext(strError, !pBinarySettingsFileLocation);
+ CXmlDomainImportContext xmlDomainImportContext(strError, !pBinarySettingsFileLocation,
+ *getSystemClass());
// Selection criteria definition for rule creation
xmlDomainImportContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition());
@@ -2011,7 +2012,7 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Context
- CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings);
+ CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass());
// Selection criteria definition for rule creation
xmlDomainImportContext.setSelectionCriteriaDefinition(
diff --git a/parameter/XmlDomainImportContext.h b/parameter/XmlDomainImportContext.h
index ed48122..11090b0 100644
--- a/parameter/XmlDomainImportContext.h
+++ b/parameter/XmlDomainImportContext.h
@@ -31,14 +31,21 @@
#include "XmlDomainSerializingContext.h"
#include "SelectionCriteriaDefinition.h"
+#include "SystemClass.h"
#include <string>
class CXmlDomainImportContext : public CXmlDomainSerializingContext
{
public:
- CXmlDomainImportContext(std::string& strError, bool bWithSettings):
- base(strError, bWithSettings), _bAutoValidationRequired(true) {}
+ CXmlDomainImportContext(std::string& strError, bool bWithSettings, CSystemClass& systemClass):
+ base(strError, bWithSettings), _systemClass(systemClass), _bAutoValidationRequired(true) {}
+
+ // System Class
+ CSystemClass& getSystemClass() const
+ {
+ return _systemClass;
+ }
// Criteria defintion
void setSelectionCriteriaDefinition(
@@ -66,6 +73,9 @@ public:
private:
typedef CXmlDomainSerializingContext base;
+ // System Class
+ CSystemClass& _systemClass;
+
// Criteria defintion
const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;