summaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2014-12-19 11:15:02 +0100
committerDavid Wagner <david.wagner@intel.com>2015-01-22 11:53:52 +0100
commit29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b (patch)
tree5786f9d76eae3a29eb7f22a0727921979e53c8bb /parameter
parentc39e7f4bbad04e92b53054b61b3f3deaa98ccd61 (diff)
downloadexternal_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')
-rw-r--r--parameter/Android.mk1
-rw-r--r--parameter/CMakeLists.txt2
-rw-r--r--parameter/ConfigurableDomain.cpp36
-rw-r--r--parameter/ConfigurableDomain.h38
-rw-r--r--parameter/DomainConfiguration.cpp17
-rw-r--r--parameter/ParameterMgr.cpp26
-rw-r--r--parameter/SelectionCriterionRule.cpp11
-rw-r--r--parameter/XmlDomainExportContext.h72
-rw-r--r--parameter/XmlDomainImportContext.h75
-rw-r--r--parameter/XmlDomainSerializingContext.cpp89
-rw-r--r--parameter/XmlDomainSerializingContext.h36
11 files changed, 242 insertions, 161 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 2027e97..aaa40ea 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -85,7 +85,6 @@ common_src_files := \
ConfigurationAccessContext.cpp \
XmlElementSerializingContext.cpp \
XmlParameterSerializingContext.cpp \
- XmlDomainSerializingContext.cpp \
BinarySerializableElement.cpp \
BitwiseAreaConfiguration.cpp \
BitParameterBlockType.cpp \
diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt
index f98848f..50fc15b 100644
--- a/parameter/CMakeLists.txt
+++ b/parameter/CMakeLists.txt
@@ -72,7 +72,6 @@ add_library(parameter SHARED
ConfigurationAccessContext.cpp
XmlElementSerializingContext.cpp
XmlParameterSerializingContext.cpp
- XmlDomainSerializingContext.cpp
BinarySerializableElement.cpp
BitwiseAreaConfiguration.cpp
BitParameterBlockType.cpp
@@ -147,7 +146,6 @@ add_library(parameter SHARED
ConfigurationAccessContext.cpp
XmlElementSerializingContext.cpp
XmlParameterSerializingContext.cpp
- XmlDomainSerializingContext.cpp
BinarySerializableElement.cpp
BitwiseAreaConfiguration.cpp
BitParameterBlockType.cpp
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index f81baec..c3fa1f9 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -32,6 +32,8 @@
#include "ConfigurableElement.h"
#include "ConfigurationAccessContext.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainImportContext.h"
+#include "XmlDomainExportContext.h"
#include <assert.h>
#define base CBinarySerializableElement
@@ -169,9 +171,10 @@ void CConfigurableDomain::composeConfigurableElements(CXmlElement& xmlElement) c
void CConfigurableDomain::composeSettings(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Context
- const CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<const CXmlDomainSerializingContext&>(serializingContext);
+ const CXmlDomainExportContext& xmlDomainExportContext =
+ static_cast<const CXmlDomainExportContext&>(serializingContext);
- if (!xmlDomainSerializingContext.withSettings()) {
+ if (!xmlDomainExportContext.withSettings()) {
return;
}
@@ -206,20 +209,23 @@ void CConfigurableDomain::composeSettings(CXmlElement& xmlElement, CXmlSerializi
bool CConfigurableDomain::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
// Context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainImportContext& xmlDomainImportContext =
+ static_cast<CXmlDomainImportContext&>(serializingContext);
// Sequence awareness (optional)
_bSequenceAware = xmlElement.hasAttribute("SequenceAware") && xmlElement.getAttributeBoolean("SequenceAware");
// Local parsing. Do not dig
- if (!parseDomainConfigurations(xmlElement, serializingContext) || !parseConfigurableElements(xmlElement, serializingContext) || !parseSettings(xmlElement, serializingContext)) {
+ if (!parseDomainConfigurations(xmlElement, xmlDomainImportContext) ||
+ !parseConfigurableElements(xmlElement, xmlDomainImportContext) ||
+ !parseSettings(xmlElement, xmlDomainImportContext)) {
return false;
}
// All provided configurations are parsed
// Attempt validation on areas of non provided configurations for all configurable elements if required
- if (xmlDomainSerializingContext.autoValidationRequired()) {
+ if (xmlDomainImportContext.autoValidationRequired()) {
autoValidateAll();
}
@@ -228,7 +234,8 @@ bool CConfigurableDomain::fromXml(const CXmlElement& xmlElement, CXmlSerializing
}
// XML parsing
-bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
// We're supposedly clean
assert(_configurableElementList.empty());
@@ -243,7 +250,8 @@ bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElemen
}
// Parse configurable elements
-bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
// Get System Class Element
CElement* pRootElement = getRoot();
@@ -298,13 +306,11 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen
}
// Parse settings
-bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
- // Context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
-
// Check we actually need to parse configuration settings
- if (!xmlDomainSerializingContext.withSettings()) {
+ if (!serializingContext.withSettings()) {
// No parsing required
return true;
@@ -329,12 +335,14 @@ bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement, CXmlSeria
if (!pDomainConfiguration) {
- xmlDomainSerializingContext.setError("Could not find domain configuration referred to by configurable domain " + getName());
+ serializingContext.setError("Could not find domain configuration referred to by"
+ " configurable domain \"" + getName() + "\".");
return false;
}
// Have domain configuration parse settings for all configurable elements
- if (!pDomainConfiguration->parseSettings(xmlConfigurationSettingsElement, xmlDomainSerializingContext)) {
+ if (!pDomainConfiguration->parseSettings(xmlConfigurationSettingsElement,
+ serializingContext)) {
return false;
}
diff --git a/parameter/ConfigurableDomain.h b/parameter/ConfigurableDomain.h
index a7cbf73..084c187 100644
--- a/parameter/ConfigurableDomain.h
+++ b/parameter/ConfigurableDomain.h
@@ -30,6 +30,8 @@
#pragma once
#include "BinarySerializableElement.h"
+#include "XmlSerializingContext.h"
+#include "XmlDomainImportContext.h"
#include "SyncerSet.h"
#include <list>
#include <set>
@@ -154,9 +156,39 @@ private:
void doRemoveConfigurableElement(CConfigurableElement* pConfigurableElement, bool bRecomputeSyncSet);
// XML parsing
- bool parseDomainConfigurations(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
- bool parseConfigurableElements(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
- bool parseSettings(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
+ /**
+ * Deserialize domain configurations from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] serializingContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseDomainConfigurations(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
+ /**
+ * Deserialize domain elements from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] serializingContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseConfigurableElements(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
+ /**
+ * Deserialize settings from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] xmlDomainImportContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseSettings(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
// XML composing
void composeDomainConfigurations(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
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;
}
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index b707225..749aacd 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -60,6 +60,8 @@
#include "ConfigurableDomain.h"
#include "DomainConfiguration.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainExportContext.h"
+#include "XmlDomainImportContext.h"
#include "BitParameterBlockType.h"
#include "BitParameterType.h"
#include "StringParameterType.h"
@@ -620,18 +622,18 @@ 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)
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, !pBinarySettingsFileLocation);
+ CXmlDomainImportContext xmlDomainImportContext(strError, !pBinarySettingsFileLocation);
// Selection criteria definition for rule creation
- xmlDomainSerializingContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition());
+ xmlDomainImportContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition());
// Auto validation of configurations if no binary settings provided
- xmlDomainSerializingContext.setAutoValidationRequired(!pBinarySettingsFileLocation);
+ xmlDomainImportContext.setAutoValidationRequired(!pBinarySettingsFileLocation);
log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
// Do parse
- if (!xmlParse(xmlDomainSerializingContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
+ if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
return false;
}
@@ -2009,14 +2011,14 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings);
// Selection criteria definition for rule creation
- xmlDomainSerializingContext.setSelectionCriteriaDefinition(
+ xmlDomainImportContext.setSelectionCriteriaDefinition(
getConstSelectionCriteria()->getSelectionCriteriaDefinition());
// Init serializing context
- xmlDomainSerializingContext.set(
+ xmlDomainImportContext.set(
_pElementLibrarySet->getElementLibrary(EParameterConfigurationLibrary),
"", _strSchemaFolderLocation);
@@ -2050,7 +2052,7 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
// Use a doc sink that instantiate Configurable Domains from the given doc source
CXmlMemoryDocSink memorySink(pConfigurableDomains);
- bool bProcessSuccess = memorySink.process(*pSource, xmlDomainSerializingContext);
+ bool bProcessSuccess = memorySink.process(*pSource, xmlDomainImportContext);
if (!bProcessSuccess) {
@@ -2088,13 +2090,13 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
pConfigurableDomains->getKind() + ".xsd";
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
// Value space
- xmlDomainSerializingContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
// Output raw format
- xmlDomainSerializingContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
// Use a doc source by loading data from instantiated Configurable Domains
CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(),
@@ -2115,7 +2117,7 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
pSink = new CXmlStringDocSink(strXmlDest);
}
- bool bProcessSuccess = pSink->process(memorySource, xmlDomainSerializingContext);
+ bool bProcessSuccess = pSink->process(memorySource, xmlDomainExportContext);
delete pSink;
return bProcessSuccess;
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<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainImportContext& xmlDomainImportContext = static_cast<CXmlDomainImportContext&>(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;
}
diff --git a/parameter/XmlDomainExportContext.h b/parameter/XmlDomainExportContext.h
new file mode 100644
index 0000000..6a95d97
--- /dev/null
+++ b/parameter/XmlDomainExportContext.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "XmlDomainSerializingContext.h"
+#include <string>
+
+class CXmlDomainExportContext : public CXmlDomainSerializingContext
+{
+public:
+ CXmlDomainExportContext(std::string& strError, bool bWithSettings):
+ base(strError, bWithSettings) {}
+
+ // Value interpretation as Real or Raw
+ void setValueSpaceRaw(bool bIsRaw)
+ {
+ _bValueSpaceIsRaw = bIsRaw;
+ }
+
+ bool valueSpaceIsRaw() const
+ {
+ return _bValueSpaceIsRaw;
+ }
+
+ // Output Raw Format for user get value interpretation
+ void setOutputRawFormat(bool bIsHex)
+ {
+ _bOutputRawFormatIsHex = bIsHex;
+ }
+
+ bool outputRawFormatIsHex() const
+ {
+ return _bOutputRawFormatIsHex;
+ }
+
+private:
+ typedef CXmlDomainSerializingContext base;
+
+ // Value Space
+ bool _bValueSpaceIsRaw;
+
+ // Output Raw Format
+ bool _bOutputRawFormatIsHex;
+
+};
diff --git a/parameter/XmlDomainImportContext.h b/parameter/XmlDomainImportContext.h
new file mode 100644
index 0000000..ed48122
--- /dev/null
+++ b/parameter/XmlDomainImportContext.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "XmlDomainSerializingContext.h"
+#include "SelectionCriteriaDefinition.h"
+
+#include <string>
+
+class CXmlDomainImportContext : public CXmlDomainSerializingContext
+{
+public:
+ CXmlDomainImportContext(std::string& strError, bool bWithSettings):
+ base(strError, bWithSettings), _bAutoValidationRequired(true) {}
+
+ // Criteria defintion
+ void setSelectionCriteriaDefinition(
+ const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition)
+ {
+ _pSelectionCriteriaDefinition = pSelectionCriteriaDefinition;
+ }
+
+ const CSelectionCriteriaDefinition* getSelectionCriteriaDefinition() const
+ {
+ return _pSelectionCriteriaDefinition;
+ }
+
+ // Auto validation of configurations
+ void setAutoValidationRequired(bool bAutoValidationRequired)
+ {
+ _bAutoValidationRequired = bAutoValidationRequired;
+ }
+
+ bool autoValidationRequired() const
+ {
+ return _bAutoValidationRequired;
+ }
+
+private:
+ typedef CXmlDomainSerializingContext base;
+
+ // Criteria defintion
+ const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;
+
+ // Auto validation of configurations
+ bool _bAutoValidationRequired;
+};
+
diff --git a/parameter/XmlDomainSerializingContext.cpp b/parameter/XmlDomainSerializingContext.cpp
deleted file mode 100644
index c159fbf..0000000
--- a/parameter/XmlDomainSerializingContext.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "XmlDomainSerializingContext.h"
-
-#define base CXmlElementSerializingContext
-
-using std::string;
-
-CXmlDomainSerializingContext::CXmlDomainSerializingContext(string& strError, bool bWithSettings)
- : base(strError), _bWithSettings(bWithSettings), _bValueSpaceIsRaw(false), _bOutputRawFormatIsHex(false), _pSelectionCriteriaDefinition(NULL), _bAutoValidationRequired(true)
-{
-}
-
-// Settings to be loaded or not
-bool CXmlDomainSerializingContext::withSettings() const
-{
- return _bWithSettings;
-}
-
-// Value Space
-void CXmlDomainSerializingContext::setValueSpaceRaw(bool bIsRaw)
-{
- _bValueSpaceIsRaw = bIsRaw;
-}
-
-bool CXmlDomainSerializingContext::valueSpaceIsRaw() const
-{
- return _bValueSpaceIsRaw;
-}
-
-// Output Raw Format for user get value interpretation
-void CXmlDomainSerializingContext::setOutputRawFormat(bool bIsHex)
-{
- _bOutputRawFormatIsHex = bIsHex;
-}
-
-bool CXmlDomainSerializingContext::outputRawFormatIsHex()
-{
- return _bOutputRawFormatIsHex;
-}
-
-// Criteria defintion
-void CXmlDomainSerializingContext::setSelectionCriteriaDefinition(const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition)
-{
- _pSelectionCriteriaDefinition = pSelectionCriteriaDefinition;
-}
-
-const CSelectionCriteriaDefinition* CXmlDomainSerializingContext::getSelectionCriteriaDefinition() const
-{
- return _pSelectionCriteriaDefinition;
-}
-
-// Auto validation of configurations
-void CXmlDomainSerializingContext::setAutoValidationRequired(bool bAutoValidationRequired)
-{
- _bAutoValidationRequired = bAutoValidationRequired;
-}
-
-bool CXmlDomainSerializingContext::autoValidationRequired() const
-{
- return _bAutoValidationRequired;
-}
diff --git a/parameter/XmlDomainSerializingContext.h b/parameter/XmlDomainSerializingContext.h
index 88d2b5f..955d939 100644
--- a/parameter/XmlDomainSerializingContext.h
+++ b/parameter/XmlDomainSerializingContext.h
@@ -33,41 +33,21 @@
#include <string>
-class CParameterBlackboard;
-class CSelectionCriteriaDefinition;
-
class CXmlDomainSerializingContext : public CXmlElementSerializingContext
{
public:
- CXmlDomainSerializingContext(std::string& strError, bool bWithSettings);
+ CXmlDomainSerializingContext(std::string& strError, bool bWithSettings):
+ base(strError), _bWithSettings(bWithSettings) {}
// Settings to be serialized or not
- bool withSettings() const;
-
- // Value interpretation as Real or Raw
- void setValueSpaceRaw(bool bIsRaw);
- bool valueSpaceIsRaw() const;
-
- // Output Raw Format for user get value interpretation
- void setOutputRawFormat(bool bIsHex);
- bool outputRawFormatIsHex();
+ bool withSettings() const
+ {
+ return _bWithSettings;
+ }
- // Criteria defintion
- void setSelectionCriteriaDefinition(const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition);
- const CSelectionCriteriaDefinition* getSelectionCriteriaDefinition() const;
-
- // Auto validation of configurations
- void setAutoValidationRequired(bool bAutoValidationRequired);
- bool autoValidationRequired() const;
private:
+ typedef CXmlElementSerializingContext base;
+
// Indicate wheter or not to import settings
bool _bWithSettings;
- // Value Space
- bool _bValueSpaceIsRaw;
- // Output Raw Format
- bool _bOutputRawFormatIsHex;
- // Criteria defintion
- const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;
- // Auto validation of configurations
- bool _bAutoValidationRequired;
};