From 29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 19 Dec 2014 11:15:02 +0100 Subject: 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 --- parameter/SelectionCriterionRule.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'parameter/SelectionCriterionRule.cpp') diff --git a/parameter/SelectionCriterionRule.cpp b/parameter/SelectionCriterionRule.cpp index 6f350c3..b6df7aa 100644 --- a/parameter/SelectionCriterionRule.cpp +++ b/parameter/SelectionCriterionRule.cpp @@ -30,6 +30,7 @@ #include "SelectionCriterionRule.h" #include "SelectionCriterion.h" #include "XmlDomainSerializingContext.h" +#include "XmlDomainImportContext.h" #include "SelectionCriteriaDefinition.h" #include "SelectionCriterionTypeInterface.h" #include "RuleParser.h" @@ -152,17 +153,17 @@ bool CSelectionCriterionRule::matches() const bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) { // Retrieve actual context - CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast(serializingContext); + CXmlDomainImportContext& xmlDomainImportContext = static_cast(serializingContext); // Get selection criterion string strSelectionCriterion = xmlElement.getAttributeString("SelectionCriterion"); - _pSelectionCriterion = xmlDomainSerializingContext.getSelectionCriteriaDefinition()->getSelectionCriterion(strSelectionCriterion); + _pSelectionCriterion = xmlDomainImportContext.getSelectionCriteriaDefinition()->getSelectionCriterion(strSelectionCriterion); // Check existence if (!_pSelectionCriterion) { - xmlDomainSerializingContext.setError("Couldn't find selection criterion " + strSelectionCriterion + " in " + getKind() + " " + xmlElement.getPath()); + xmlDomainImportContext.setError("Couldn't find selection criterion " + strSelectionCriterion + " in " + getKind() + " " + xmlElement.getPath()); return false; } @@ -173,7 +174,7 @@ bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSeriali if (!setMatchesWhen(strMatchesWhen, strError)) { - xmlDomainSerializingContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath() + ": " + strError); + xmlDomainImportContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath() + ": " + strError); return false; } @@ -183,7 +184,7 @@ bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSeriali if (!_pSelectionCriterion->getCriterionType()->getNumericalValue(strValue, _iMatchValue)) { - xmlDomainSerializingContext.setError("Wrong Value attribute value " + strValue + " in " + getKind() + " " + xmlElement.getPath()); + xmlDomainImportContext.setError("Wrong Value attribute value " + strValue + " in " + getKind() + " " + xmlElement.getPath()); return false; } -- cgit v1.1