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>
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::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 @@
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) {