diff options
author | David Wagner <david.wagner@intel.com> | 2014-12-19 11:15:02 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2015-01-22 11:53:52 +0100 |
commit | 29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b (patch) | |
tree | 5786f9d76eae3a29eb7f22a0727921979e53c8bb /parameter/DomainConfiguration.cpp | |
parent | c39e7f4bbad04e92b53054b61b3f3deaa98ccd61 (diff) | |
download | external_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.zip external_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.tar.gz external_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.tar.bz2 |
Extract and specialize domain import- and export-specific contexts
Import and Export of ConfigurableDomains have different context needs: e.g. the
value representation is only used for export; auto-validation is only
meaningful for import whereas the "with settings" context is common to both.
We create two new classes, derived from XmlDomainSerializingContext and move
most of its content to each class it belongs to.
Change-Id: I56589cdb3a8ea417e11d2ed98ccd055d7cdead67
Signed-off-by: David Wagner <david.wagner@intel.com>
Diffstat (limited to 'parameter/DomainConfiguration.cpp')
-rw-r--r-- | parameter/DomainConfiguration.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/parameter/DomainConfiguration.cpp b/parameter/DomainConfiguration.cpp index 41ffeef..9c353ee 100644 --- a/parameter/DomainConfiguration.cpp +++ b/parameter/DomainConfiguration.cpp @@ -33,6 +33,8 @@ #include "CompoundRule.h" #include "Subsystem.h" #include "XmlDomainSerializingContext.h" +#include "XmlDomainImportContext.h" +#include "XmlDomainExportContext.h" #include "ConfigurationAccessContext.h" #include <assert.h> #include "RuleParser.h" @@ -71,7 +73,7 @@ bool CDomainConfiguration::childrenAreDynamic() const bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) { // Actual XML context - CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext); + CXmlDomainImportContext& xmlDomainImportContext = static_cast<CXmlDomainImportContext&>(serializingContext); // Take care of configurable elements / area configurations ranks std::list<CAreaConfiguration*> areaConfigurationList; @@ -90,7 +92,7 @@ bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsEl if (!pAreaConfiguration) { - xmlDomainSerializingContext.setError("Configurable Element " + strConfigurableElementPath + " referred to by Configuration " + getPath() + " not associated to Domain"); + xmlDomainImportContext.setError("Configurable Element " + strConfigurableElementPath + " referred to by Configuration " + getPath() + " not associated to Domain"); return false; } @@ -98,7 +100,7 @@ bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsEl areaConfigurationList.push_back(pAreaConfiguration); // Parse - if (!serializeConfigurableElementSettings(pAreaConfiguration, xmlConfigurableElementSettingsElement, xmlDomainSerializingContext, false)) { + if (!serializeConfigurableElementSettings(pAreaConfiguration, xmlConfigurableElementSettingsElement, xmlDomainImportContext, false)) { return false; } @@ -140,7 +142,8 @@ void CDomainConfiguration::composeSettings(CXmlElement& xmlConfigurationSettings bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut) { // Actual XML context - CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext); + CXmlDomainExportContext& xmlDomainExportContext = + static_cast<CXmlDomainExportContext&>(serializingContext); // Configurable Element const CConfigurableElement* pConfigurableElement = pAreaConfiguration->getConfigurableElement(); @@ -183,10 +186,10 @@ bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfigurati CConfigurationAccessContext configurationAccessContext(strError, bSerializeOut); // Provide current value space - configurationAccessContext.setValueSpaceRaw(xmlDomainSerializingContext.valueSpaceIsRaw()); + configurationAccessContext.setValueSpaceRaw(xmlDomainExportContext.valueSpaceIsRaw()); // Provide current output raw format - configurationAccessContext.setOutputRawFormat(xmlDomainSerializingContext.outputRawFormatIsHex()); + configurationAccessContext.setOutputRawFormat(xmlDomainExportContext.outputRawFormatIsHex()); // Get subsystem const CSubsystem* pSubsystem = pConfigurableElement->getBelongingSubsystem(); @@ -203,7 +206,7 @@ bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfigurati if (!pAreaConfiguration->serializeXmlSettings(xmlConfigurableElementSettingsElementContent, configurationAccessContext)) { // Forward error - xmlDomainSerializingContext.setError(strError); + xmlDomainExportContext.setError(strError); return false; } |