summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Schemas/Android.mk13
-rw-r--r--Schemas/ConfigurableDomain.xsd117
-rw-r--r--Schemas/ConfigurableDomains.xsd114
-rw-r--r--parameter/Android.mk1
-rw-r--r--parameter/CMakeLists.txt2
-rw-r--r--parameter/ConfigurableDomain.cpp63
-rw-r--r--parameter/ConfigurableDomain.h41
-rw-r--r--parameter/ConfigurableDomains.cpp63
-rw-r--r--parameter/ConfigurableDomains.h36
-rw-r--r--parameter/DomainConfiguration.cpp17
-rwxr-xr-xparameter/Element.cpp14
-rw-r--r--parameter/Element.h14
-rw-r--r--parameter/ParameterMgr.cpp190
-rw-r--r--parameter/ParameterMgr.h79
-rw-r--r--parameter/SelectionCriterionRule.cpp11
-rw-r--r--parameter/XmlDomainExportContext.h72
-rw-r--r--parameter/XmlDomainImportContext.h85
-rw-r--r--parameter/XmlDomainSerializingContext.cpp89
-rw-r--r--parameter/XmlDomainSerializingContext.h36
19 files changed, 721 insertions, 336 deletions
diff --git a/Schemas/Android.mk b/Schemas/Android.mk
index 7a42a50..003bf3b 100644
--- a/Schemas/Android.mk
+++ b/Schemas/Android.mk
@@ -34,7 +34,7 @@ LOCAL_IS_HOST_MODULE := true
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
-LOCAL_MODULE := ConfigurableDomains.xsd
+LOCAL_MODULE := ConfigurableDomain.xsd
LOCAL_MODULE_OWNER := intel
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_CLASS = ETC
@@ -45,6 +45,17 @@ LOCAL_REQUIRED_MODULES := \
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
+LOCAL_MODULE := ConfigurableDomains.xsd
+LOCAL_MODULE_OWNER := intel
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+LOCAL_MODULE_CLASS = ETC
+LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas
+LOCAL_IS_HOST_MODULE := true
+LOCAL_REQUIRED_MODULES := \
+ ConfigurableDomain.xsd
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
LOCAL_MODULE := SystemClass.xsd
LOCAL_MODULE_OWNER := intel
LOCAL_SRC_FILES := $(LOCAL_MODULE)
diff --git a/Schemas/ConfigurableDomain.xsd b/Schemas/ConfigurableDomain.xsd
new file mode 100644
index 0000000..8683192
--- /dev/null
+++ b/Schemas/ConfigurableDomain.xsd
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="ParameterSettings.xsd"/>
+ <xs:complexType name="SelectionCriterionRuleType">
+ <xs:attribute name="SelectionCriterion" type="xs:NMTOKEN" use="required"/>
+ <xs:attribute name="MatchesWhen" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="Is"/>
+ <xs:enumeration value="IsNot"/>
+ <xs:enumeration value="Includes"/>
+ <xs:enumeration value="Excludes"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Value" use="required"/>
+ </xs:complexType>
+ <xs:group name="RuleGroup">
+ <xs:choice>
+ <xs:element name="CompoundRule" type="CompoundRuleType"/>
+ <xs:element name="SelectionCriterionRule" type="SelectionCriterionRuleType"/>
+ </xs:choice>
+ </xs:group>
+ <xs:complexType name="CompoundRuleType">
+ <xs:sequence>
+ <xs:group ref="RuleGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Type">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="Any"/>
+ <xs:enumeration value="All"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:complexType name="ConfigurationsType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" name="Configuration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="CompoundRule" type="CompoundRuleType" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="Name" use="required" type="xs:NCName"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:group name="ComponentGroup">
+ <xs:sequence>
+ <xs:group ref="ParameterBlockGroup"/>
+ </xs:sequence>
+ </xs:group>
+ <xs:complexType name="ComponentType">
+ <xs:sequence>
+ <xs:choice>
+ <xs:group ref="ComponentGroup" maxOccurs="unbounded"/>
+ <xs:element name="Subsystem" type="ComponentType" maxOccurs="unbounded"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="Name" use="required" type="xs:NCName"/>
+ </xs:complexType>
+ <xs:complexType name="ConfigurableElementsType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="ConfigurableElement">
+ <xs:complexType>
+ <xs:attribute name="Path" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:anyURI">
+ <xs:pattern value="/.*[^/]"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ConfigurableElementSettingsType">
+ <xs:choice>
+ <xs:element name="BitParameter" type="IntegerParameterType"/>
+ <xs:group ref="ComponentGroup"/>
+ </xs:choice>
+ <xs:attribute name="Path" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:anyURI">
+ <xs:pattern value="/.*[^/]"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:complexType name="SettingsType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="Configuration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ConfigurableElement" minOccurs="0" maxOccurs="unbounded" type="ConfigurableElementSettingsType"/>
+ </xs:sequence>
+ <xs:attribute name="Name" use="required" type="xs:NCName"/>
+ </xs:complexType>
+ <xs:unique name="ConfigurableElementUniqueness">
+ <xs:selector xpath="ConfigurableElement"/>
+ <xs:field xpath="@Path"/>
+ </xs:unique>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ConfigurableDomainType">
+ <xs:sequence>
+ <xs:element name="Configurations" type="ConfigurationsType"/>
+ <xs:element name="ConfigurableElements" type="ConfigurableElementsType"/>
+ <xs:element name="Settings" type="SettingsType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="Name" use="required" type="xs:NCName"/>
+ <xs:attribute name="SequenceAware" use="optional" type="xs:boolean" default="false"/>
+ </xs:complexType>
+ <xs:element name="ConfigurableDomain" type="ConfigurableDomainType"/>
+</xs:schema>
diff --git a/Schemas/ConfigurableDomains.xsd b/Schemas/ConfigurableDomains.xsd
index e4f5747..67e6b0f 100644
--- a/Schemas/ConfigurableDomains.xsd
+++ b/Schemas/ConfigurableDomains.xsd
@@ -1,118 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xs:include schemaLocation="ParameterSettings.xsd"/>
- <xs:complexType name="SelectionCriterionRuleType">
- <xs:attribute name="SelectionCriterion" type="xs:NMTOKEN" use="required"/>
- <xs:attribute name="MatchesWhen" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="Is"/>
- <xs:enumeration value="IsNot"/>
- <xs:enumeration value="Includes"/>
- <xs:enumeration value="Excludes"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="Value" use="required"/>
- </xs:complexType>
- <xs:group name="RuleGroup">
- <xs:choice>
- <xs:element name="CompoundRule" type="CompoundRuleType"/>
- <xs:element name="SelectionCriterionRule" type="SelectionCriterionRuleType"/>
- </xs:choice>
- </xs:group>
- <xs:complexType name="CompoundRuleType">
- <xs:sequence>
- <xs:group ref="RuleGroup" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="Type">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="Any"/>
- <xs:enumeration value="All"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- <xs:complexType name="ConfigurationsType">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" name="Configuration">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="CompoundRule" type="CompoundRuleType" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute name="Name" use="required" type="xs:NCName"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:group name="ComponentGroup">
- <xs:sequence>
- <xs:group ref="ParameterBlockGroup"/>
- </xs:sequence>
- </xs:group>
- <xs:complexType name="ComponentType">
- <xs:sequence>
- <xs:choice>
- <xs:group ref="ComponentGroup" maxOccurs="unbounded"/>
- <xs:element name="Subsystem" type="ComponentType" maxOccurs="unbounded"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="Name" use="required" type="xs:NCName"/>
- </xs:complexType>
- <xs:complexType name="ConfigurableElementsType">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="ConfigurableElement">
- <xs:complexType>
- <xs:attribute name="Path" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:anyURI">
- <xs:pattern value="/.*[^/]"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="ConfigurableElementSettingsType">
- <xs:choice>
- <xs:element name="BitParameter" type="IntegerParameterType"/>
- <xs:group ref="ComponentGroup"/>
- </xs:choice>
- <xs:attribute name="Path" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:anyURI">
- <xs:pattern value="/.*[^/]"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- <xs:complexType name="SettingsType">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="Configuration">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="ConfigurableElement" minOccurs="0" maxOccurs="unbounded" type="ConfigurableElementSettingsType"/>
- </xs:sequence>
- <xs:attribute name="Name" use="required" type="xs:NCName"/>
- </xs:complexType>
- <xs:unique name="ConfigurableElementUniqueness">
- <xs:selector xpath="ConfigurableElement"/>
- <xs:field xpath="@Path"/>
- </xs:unique>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="ConfigurableDomainType">
- <xs:sequence>
- <xs:element name="Configurations" type="ConfigurationsType"/>
- <xs:element name="ConfigurableElements" type="ConfigurableElementsType"/>
- <xs:element name="Settings" type="SettingsType" minOccurs="0"/>
- </xs:sequence>
- <xs:attribute name="Name" use="required" type="xs:NCName"/>
- <xs:attribute name="SequenceAware" use="optional" type="xs:boolean" default="false"/>
- </xs:complexType>
+ <xs:include schemaLocation="ConfigurableDomain.xsd"/>
<xs:element name="ConfigurableDomains">
<xs:complexType>
<xs:sequence>
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 6836146..8672548 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 61a8d5b..35acb9c 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -32,12 +32,19 @@
#include "ConfigurableElement.h"
#include "ConfigurationAccessContext.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainImportContext.h"
+#include "XmlDomainExportContext.h"
#include <assert.h>
#define base CBinarySerializableElement
using std::string;
+CConfigurableDomain::CConfigurableDomain() :
+ _bSequenceAware(false), _pLastAppliedConfiguration(NULL)
+{
+}
+
CConfigurableDomain::CConfigurableDomain(const string& strName) : base(strName), _bSequenceAware(false), _pLastAppliedConfiguration(NULL)
{
}
@@ -111,9 +118,15 @@ bool CConfigurableDomain::getSequenceAwareness() const
// From IXmlSource
void CConfigurableDomain::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
+ base::toXml(xmlElement, serializingContext);
+
// Sequence awareness
xmlElement.setAttributeBoolean("SequenceAware", _bSequenceAware);
+}
+void CConfigurableDomain::childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const
+{
// Configurations
composeDomainConfigurations(xmlElement, serializingContext);
@@ -133,7 +146,7 @@ void CConfigurableDomain::composeDomainConfigurations(CXmlElement& xmlElement, C
xmlElement.createChild(xmlConfigurationsElement, "Configurations");
// Delegate to base
- base::toXml(xmlConfigurationsElement, serializingContext);
+ base::childrenToXml(xmlConfigurationsElement, serializingContext);
}
void CConfigurableDomain::composeConfigurableElements(CXmlElement& xmlElement) const
@@ -163,9 +176,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;
}
@@ -200,20 +214,25 @@ 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");
+ setName(xmlElement.getAttributeString("Name"));
+
// 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();
}
@@ -222,7 +241,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());
@@ -237,14 +257,10 @@ 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();
-
- CElement* pSystemClassElement = pRootElement->findChildOfKind("SystemClass");
-
- assert(pSystemClassElement);
+ CSystemClass& systemClass = serializingContext.getSystemClass();
// Get ConfigurableElements element
CXmlElement xmlConfigurableElementsElement;
@@ -264,14 +280,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) {
@@ -292,13 +309,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;
@@ -323,12 +338,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 e91a5cb..a29c1ba 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>
@@ -46,6 +48,7 @@ class CConfigurableDomain : public CBinarySerializableElement
typedef std::list<CConfigurableElement*>::const_iterator ConfigurableElementListIterator;
typedef std::map<const CConfigurableElement*, CSyncerSet*>::const_iterator ConfigurableElementToSyncerSetMapIterator;
public:
+ CConfigurableDomain();
CConfigurableDomain(const std::string& strName);
virtual ~CConfigurableDomain();
@@ -103,6 +106,8 @@ public:
// From IXmlSource
virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+ virtual void childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const;
// Class kind
virtual std::string getKind() const;
@@ -152,9 +157,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/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index f11a155..b77e2aa 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -104,7 +104,7 @@ void CConfigurableDomains::toXml(CXmlElement& xmlElement, CXmlSerializingContext
// Set attribute
xmlElement.setAttributeString("SystemClassName", getName());
- base::toXml(xmlElement, serializingContext);
+ base::childrenToXml(xmlElement, serializingContext);
}
// Configuration/Domains handling
@@ -127,26 +127,52 @@ bool CConfigurableDomains::createDomain(const string& strName, string& strError)
return true;
}
-bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
+bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrite,
+ string& strError)
{
- CConfigurableDomain* pConfigurableDomain = findConfigurableDomain(strName, strError);
+ string strErrorDrop;
- if (!pConfigurableDomain) {
+ string strDomainName(domain.getName());
+ CConfigurableDomain* pExistingDomain = findConfigurableDomain(strDomainName, strErrorDrop);
- return false;
- }
+ if (pExistingDomain) {
+ if (!bOverwrite) {
+ strError = "Can't add domain \"" + strDomainName +
+ "\" because it already exists and overwrite was not requested.";
+ return false;
+ }
- log_info("Deleting configurable domain \"%s\"", strName.c_str());
+ deleteDomain(*pExistingDomain);
+ }
- // Hierarchy
- removeChild(pConfigurableDomain);
+ log_info("Adding configurable domain \"" + strDomainName + "\"");
- // Destroy
- delete pConfigurableDomain;
+ addChild(&domain);
return true;
}
+void CConfigurableDomains::deleteDomain(CConfigurableDomain& configurableDomain)
+{
+ log_info("Deleting configurable domain \"" + configurableDomain.getName() + "\"");
+
+ removeChild(&configurableDomain);
+
+ delete &configurableDomain;
+}
+
+bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
+{
+ CConfigurableDomain* pConfigurableDomain = findConfigurableDomain(strName, strError);
+
+ if (pConfigurableDomain) {
+ deleteDomain(*pConfigurableDomain);
+ return true;
+ }
+
+ return false;
+}
+
void CConfigurableDomains::deleteAllDomains()
{
log_info("Deleting all configurable domains");
@@ -566,17 +592,10 @@ bool CConfigurableDomains::serializeSettings(const string& strBinarySettingsFile
// Domain retrieval
CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError)
{
- // Find domain
- CConfigurableDomain* pConfigurableDomain = static_cast<CConfigurableDomain*>(findChild(strDomain));
-
- if (!pConfigurableDomain) {
-
- strError = "Configurable domain " + strDomain + " not found";
-
- return NULL;
- }
-
- return pConfigurableDomain;
+ // Call the const equivalent
+ return const_cast<CConfigurableDomain*>(
+ static_cast<const CConfigurableDomains*>(this)->findConfigurableDomain(strDomain, strError)
+ );
}
const CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError) const
diff --git a/parameter/ConfigurableDomains.h b/parameter/ConfigurableDomains.h
index 01c94ac..3cc16df 100644
--- a/parameter/ConfigurableDomains.h
+++ b/parameter/ConfigurableDomains.h
@@ -49,6 +49,30 @@ public:
// Configuration/Domains handling
/// Domains
bool createDomain(const std::string& strName, std::string& strError);
+
+ /*
+ * Adds a domain object to configurable domains. The ConfigurableDomains
+ * object takes ownership of the ConfigurableDomain object.
+ *
+ * @param[in] pDomain the domain object.
+ * @param[in] bOverwrite if false, will refuse to overwrite an existing
+ * domain, otherwise, an existing domain with the same name will first be
+ * removed.
+ * @param[in,out] strError error message
+ *
+ * @returns true if the domain was successfully added
+ */
+ bool addDomain(CConfigurableDomain& domain, bool bOverwrite, std::string& strError);
+
+ /**
+ * Delete a domain by name
+ *
+ * @param[in] strName name of the domain to be deleted
+ * @param[in,out] strError error message
+ *
+ * @returns true of the domain was sucessfully deleted, false otherwise (i.e.
+ * the domain didn't exist).
+ */
bool deleteDomain(const std::string& strName, std::string& strError);
void deleteAllDomains();
bool renameDomain(const std::string& strName, const std::string& strNewName, std::string& strError);
@@ -87,6 +111,9 @@ public:
bool& bIsLastApplied,
std::string& strError) const;
+ const CConfigurableDomain* findConfigurableDomain(const std::string& strDomain,
+ std::string& strError) const;
+
// Binary settings load/store
bool serializeSettings(const std::string& strBinarySettingsFilePath, bool bOut, uint8_t uiStructureChecksum, std::string& strError);
@@ -102,12 +129,19 @@ public:
// Class kind
virtual std::string getKind() const;
private:
+ /** Delete a domain
+ *
+ * @param(in] configurableDomain domain to be deleted
+ * @param[in,out] strError error message
+ * @returns true of the domain was sucessfully deleted, false otherwise (i.e.
+ * the domain didn't exist).
+ */
+ void deleteDomain(CConfigurableDomain& configurableDomain);
// Returns true if children dynamic creation is to be dealt with
virtual bool childrenAreDynamic() const;
// Gather owned configurable elements owned by any domain
void gatherAllOwnedConfigurableElements(std::set<const CConfigurableElement*>& configurableElementSet) const;
// Domain retrieval
CConfigurableDomain* findConfigurableDomain(const std::string& strDomain, std::string& strError);
- const CConfigurableDomain* findConfigurableDomain(const std::string& strDomain, std::string& strError) 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/Element.cpp b/parameter/Element.cpp
index 2c8393d..4ccf149 100755
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -292,8 +292,8 @@ bool CElement::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& se
return true;
}
-// From IXmlSource
-void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+void CElement::childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const
{
// Browse children and propagate
uint32_t uiNbChildren = getNbChildren();
@@ -308,15 +308,17 @@ void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializin
xmlElement.createChild(xmlChildElement, pChild->getKind());
- // Set attributes
- pChild->setXmlNameAttribute(xmlChildElement);
-
-
// Propagate
pChild->toXml(xmlChildElement, serializingContext);
}
}
+void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ setXmlNameAttribute(xmlElement);
+ childrenToXml(xmlElement, serializingContext);
+}
+
void CElement::setXmlNameAttribute(CXmlElement& xmlElement) const
{
// By default, set Name attribute if any
diff --git a/parameter/Element.h b/parameter/Element.h
index 8469ab6..4636dbd 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -94,6 +94,20 @@ public:
// From IXmlSource
virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+ /**
+ * Serialize the children to XML
+ *
+ * This method is virtual, to be derived in case a special treatment is
+ * needed before doing so.
+ *
+ * @param[in,out] xmlElement the XML Element below which the children must
+ * be serialized (which may or may not be the CElement
+ * object upon which this method is called)
+ * @param[in,out] serializingContext information about the serialization
+ */
+ virtual void childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const;
+
// Content structure dump
void dumpContent(std::string& strContent, CErrorContext& errorContext, const uint32_t uiDepth = 0) const;
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index b707225..84a3fd4 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"
@@ -87,6 +89,7 @@
#include "XmlMemoryDocSource.h"
#include "Utility.h"
#include <sstream>
+#include <memory>
#define base CElement
@@ -257,6 +260,11 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
{ "importDomainsWithSettingsXML",
&CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1,
"<file path>", "Import domains including settings from XML file" },
+ { "importDomainWithSettingsXML",
+ &CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess, 1,
+ "<file path> [overwrite]", "Import a single domain including settings from XML file."
+ " Does not overwrite an existing domain unless 'overwrite' is passed as second"
+ " argument" },
{ "exportSettings", &CParameterMgr::exportSettingsCommmandProcess, 1,
"<file path>", "Export settings to binary file" },
{ "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1,
@@ -264,6 +272,9 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
{ "getDomainsWithSettingsXML",
&CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
"", "Print domains including settings as XML" },
+ { "getDomainWithSettingsXML",
+ &CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess, 1,
+ "<domain>", "Print the given domain including settings as XML" },
{ "setDomainsWithSettingsXML",
&CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess, 1,
"<xml configurable domains>", "Import domains including settings from XML string" },
@@ -620,18 +631,19 @@ 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,
+ *getSystemClass());
// 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;
}
@@ -648,6 +660,38 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
return true;
}
+bool CParameterMgr::importDomainFromFile(const string& strXmlFilePath, bool bOverwrite,
+ string& strError)
+{
+ CXmlDomainImportContext xmlDomainImportContext(strError, true, *getSystemClass());
+
+ // Selection criteria definition for rule creation
+ xmlDomainImportContext.setSelectionCriteriaDefinition(
+ getConstSelectionCriteria()->getSelectionCriteriaDefinition());
+
+ // Auto validation of configurations
+ xmlDomainImportContext.setAutoValidationRequired(true);
+
+ // We initialize the domain with an empty name but since we have set the isDomainStandalone
+ // context, the name will be retrieved during de-serialization
+ std::auto_ptr<CConfigurableDomain> standaloneDomain(new CConfigurableDomain());
+ bool bSuccess = xmlParse(xmlDomainImportContext, standaloneDomain.get(),
+ strXmlFilePath, "", EParameterConfigurationLibrary, "");
+
+ if (!bSuccess) {
+ return false;
+ }
+
+ bSuccess = getConfigurableDomains()->addDomain(*standaloneDomain, bOverwrite, strError);
+ if (!bSuccess) {
+ return false;
+ }
+
+ // ownership has been transfered to the ConfigurableDomains object
+ standaloneDomain.release();
+ return true;
+}
+
// XML parsing
bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName)
{
@@ -658,17 +702,25 @@ bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingCo
// Get Schema file associated to root element
string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd";
- CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath,
- pRootElement->getKind(),
- pRootElement->getName(), strNameAttrituteName,
- _bValidateSchemasOnStart);
+ std::auto_ptr<CXmlFileDocSource> fileDocSource(NULL);
+
+ if (strNameAttrituteName.empty()) {
+ fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ _bValidateSchemasOnStart));
+ } else {
+ fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ pRootElement->getName(), strNameAttrituteName,
+ _bValidateSchemasOnStart));
+ }
// Start clean
pRootElement->clean();
CXmlMemoryDocSink memorySink(pRootElement);
- if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(*fileDocSource, elementSerializingContext)) {
//Cleanup
pRootElement->clean();
@@ -1513,6 +1565,26 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableD
return importDomainsXml(remoteCommand.getArgument(0), true, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+{
+ bool bOverwrite = false;
+
+ // Look for optional arguments
+ if (remoteCommand.getArgumentCount() > 1) {
+
+ if (remoteCommand.getArgument(1) == "overwrite") {
+
+ bOverwrite = true;
+ } else {
+ // Show usage
+ return CCommandHandler::EShowUsage;
+ }
+ }
+
+ return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
@@ -1538,6 +1610,16 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess(
+ const IRemoteCommand& remoteCommand, string& strResult)
+{
+ string strDomainName = remoteCommand.getArgument(0);
+
+ return exportSingleDomainXml(strResult, strDomainName, true, false, strResult) ?
+ CCommandHandler::ESucceeded : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus
CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
@@ -2009,14 +2091,14 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass());
// 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 +2132,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) {
@@ -2069,35 +2151,43 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
return bProcessSuccess;
}
-bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
- string& strError) const
+bool CParameterMgr::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
+ string& strError)
{
+ if (!checkTuningModeOn(strError)) {
+
+ return false;
+ }
+
// check path is absolute
- if (bToFile && strXmlDest[0] != '/') {
+ if (strXmlSource[0] != '/') {
strError = "Please provide absolute path";
return false;
}
- // Root element
- const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+ return importDomainFromFile(strXmlSource, bOverwrite, strError);
+}
- // Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
- pConfigurableDomains->getKind() + ".xsd";
+bool CParameterMgr::serializeElement(string& strXmlDest,
+ CXmlSerializingContext& xmlSerializingContext, bool bToFile,
+ const CElement& element, string& strError) const
+{
+ // check path is absolute
+ if (bToFile && strXmlDest[0] != '/') {
- // Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ strError = "Please provide absolute path";
- // Value space
- xmlDomainSerializingContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+ return false;
+ }
- // Output raw format
- xmlDomainSerializingContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ // Get Schema file associated to root element
+ string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
+ element.getKind() + ".xsd";
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(),
+ CXmlMemoryDocSource memorySource(&element, element.getKind(),
strXmlSchemaFilePath, "parameter-framework",
getVersion(), _bValidateSchemasOnStart);
@@ -2112,15 +2202,55 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
} else {
// Use a doc sink to write the doc data in a string
+ // TODO: use a stream rather than a string
pSink = new CXmlStringDocSink(strXmlDest);
}
- bool bProcessSuccess = pSink->process(memorySource, xmlDomainSerializingContext);
+ bool bProcessSuccess = pSink->process(memorySource, xmlSerializingContext);
delete pSink;
return bProcessSuccess;
}
+bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
+ string& strError) const
+{
+ const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+
+
+ return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
+ *pConfigurableDomains, strError);
+}
+
+bool CParameterMgr::exportSingleDomainXml(string& strXmlDest, const string& strDomainName,
+ bool bWithSettings, bool bToFile, string& strError) const
+{
+ const CConfigurableDomains* pAllDomains = getConstConfigurableDomains();
+
+ // Element to be serialized
+ const CConfigurableDomain* pRequestedDomain =
+ pAllDomains->findConfigurableDomain(strDomainName, strError);
+
+ if (!pRequestedDomain) {
+ return false;
+ }
+
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+
+ return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
+ *pRequestedDomain, strError);
+}
+
// Binary Import/Export
bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strError)
{
@@ -2224,7 +2354,7 @@ void CParameterMgr::feedElementLibraries()
// Parameter Configuration Domains creation
CElementLibrary* pParameterConfigurationLibrary = new CElementLibrary;
- pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TNamedElementBuilderTemplate<CConfigurableDomain>());
+ pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TElementBuilderTemplate<CConfigurableDomain>());
pParameterConfigurationLibrary->addElementBuilder("Configuration", new TNamedElementBuilderTemplate<CDomainConfiguration>());
pParameterConfigurationLibrary->addElementBuilder("CompoundRule", new TElementBuilderTemplate<CCompoundRule>());
pParameterConfigurationLibrary->addElementBuilder("SelectionCriterionRule", new TElementBuilderTemplate<CSelectionCriterionRule>());
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index 9e4a3fb..7962294 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -251,22 +251,78 @@ public:
std::string& strError);
/**
+ * Method that imports a single Configurable Domain from an Xml source.
+ *
+ * @param[in] strXmlSource a string containing an xml description or a path to an xml file
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bFromFile a boolean that determines if the source is an xml description in
+ * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
+ std::string& strError);
+
+ /**
+ * Method that imports a single Configurable Domain, with settings, from an Xml file.
+ *
+ * @param[in] strXmlFilePath absolute path to the xml file containing the domain
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importDomainFromFile(const std::string& strXmlFilePath, bool bOverwrite, std::string& strError);
+
+
+ /**
+ * Export an element object to an Xml destination.
+ *
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file.
+ * @param[in] xmlSerializingContext the serializing context
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[in] element object to be serialized.
+ * @param[out] strError is used as the error output.
+ *
+ * @return false if any error occurs, true otherwise.
+ */
+ bool serializeElement(std::string& strXmlDest, CXmlSerializingContext& xmlSerializingContext,
+ bool bToFile, const CElement& element, std::string& strError) const;
+
+ /**
* Method that exports Configurable Domains to an Xml destination.
- * If bToFile is false, the xml description from the xml document will be written
- * in strXmlDest. Otherwise it will be written in a file located at the path in strXmlDest
*
- * @param[in:out] strXmlDest a std::string containing an xml description or a path to an xml file
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
* @param[in] bWithSettings a boolean that determines if the settings should be used in the
* xml description
* @param[in] bToFile a boolean that determines if the destination is an xml description in
* strXmlDest or contained in a file. In that case strXmlDest is just the file path.
* @param[out] strError is used as the error output
*
- * @return false if any error occures
+ * @return false if any error occurs, true otherwise.
*/
bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile,
std::string& strError) const;
+ /**
+ * Method that exports a given Configurable Domain to an Xml destination.
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
+ * @param[in] strDomainName the name of the domain to be exported
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs, true otherwise.
+ */
+ bool exportSingleDomainXml(std::string& strXmlDest, const std::string& strDomainName,
+ bool bWithSettings, bool bToFile, std::string& strError) const;
+
// Binary Import/Export
bool importDomainsBinary(const std::string& strFileName, std::string& strError);
bool exportDomainsBinary(const std::string& strFileName, std::string& strError);
@@ -367,11 +423,12 @@ private:
CCommandHandler::CommandStatus importConfigurableDomainsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus exportConfigurableDomainsWithSettingsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainWithSettings command.
+ * Command handler method for getConfigurableDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -383,6 +440,18 @@ private:
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
+ * Command handler method for getConfigurableDomainWithSettings command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] strResult a string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus getConfigurableDomainWithSettingsXMLCommmandProcess(
+ const IRemoteCommand& remoteCommand, std::string& strResult);
+
+ /**
* Command handler method for setConfigurableDomainWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
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..11090b0
--- /dev/null
+++ b/parameter/XmlDomainImportContext.h
@@ -0,0 +1,85 @@
+/*
+ * 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 "SystemClass.h"
+
+#include <string>
+
+class CXmlDomainImportContext : public CXmlDomainSerializingContext
+{
+public:
+ 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(
+ 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;
+
+ // System Class
+ CSystemClass& _systemClass;
+
+ // 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;
};