parameter-framework: improvements and corrections

BZ: 6721

- Bug correction concerning selection criteria display (inclusive type)
- Adapted XML format to allow for only on parameter to be associated to
  a domain
- Removed unused files in parameter project

Change-Id: I9f42d08ff8cb60354714fe3d6b0f0b321ad0a7bf
Orig-Change-Id: I837e553070f5acf2d275082c986ba29433493e31
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/16878
Reviewed-by: Mahe, Erwan <erwan.mahe@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/parameter/SelectionCriterionRule.cpp b/parameter/SelectionCriterionRule.cpp
index 4b5956c..e43c9e8 100644
--- a/parameter/SelectionCriterionRule.cpp
+++ b/parameter/SelectionCriterionRule.cpp
@@ -32,13 +32,16 @@
 #include "SelectionCriterion.h"
 #include "XmlDomainSerializingContext.h"
 #include "SelectionCriteriaDefinition.h"
+#include "SelectionCriterionTypeInterface.h"
 #include <assert.h>
 
 #define base CRule
 
-const char* CSelectionCriterionRule::_apcMatchesWhen[CSelectionCriterionRule::ENbMatchesWhen] = {
-    "Is",
-    "Contains"
+CSelectionCriterionRule::SMatchingRuleDescription CSelectionCriterionRule::_astMatchesWhen[CSelectionCriterionRule::ENbMatchesWhen] = {
+    { "Is", false },
+    { "IsNot", false },
+    { "Includes", true },
+    { "Excludes", true }
 };
 
 CSelectionCriterionRule::CSelectionCriterionRule() : _pSelectionCriterion(NULL), _eMatchesWhen(CSelectionCriterionRule::EIs), _iMatchValue(0)
@@ -58,9 +61,13 @@
 
     switch(_eMatchesWhen) {
     case EIs:
-        return _pSelectionCriterion->equals(_iMatchValue);
-    case EContains:
-        return _pSelectionCriterion->contains(_iMatchValue);
+        return _pSelectionCriterion->is(_iMatchValue);
+    case EIsNot:
+        return _pSelectionCriterion->isNot(_iMatchValue);
+    case EIncludes:
+        return _pSelectionCriterion->includes(_iMatchValue);
+    case EExcludes:
+        return _pSelectionCriterion->excludes(_iMatchValue);
     default:
         assert(0);
         return false;
@@ -88,10 +95,11 @@
 
     // Get MatchesWhen
     string strMatchesWhen = xmlElement.getAttributeString("MatchesWhen");
+    string strError;
 
-    if (!setMatchesWhen(strMatchesWhen)) {
+    if (!setMatchesWhen(strMatchesWhen, strError)) {
 
-        xmlDomainSerializingContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath());
+        xmlDomainSerializingContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath() + ": " + strError);
 
         return false;
     }
@@ -121,7 +129,7 @@
     xmlElement.setAttributeString("SelectionCriterion", _pSelectionCriterion->getName());
 
     // Set MatchesWhen
-    xmlElement.setAttributeString("MatchesWhen", _apcMatchesWhen[_eMatchesWhen]);
+    xmlElement.setAttributeString("MatchesWhen", _astMatchesWhen[_eMatchesWhen].pcMatchesWhen);
 
     // Set Value
     string strValue;
@@ -132,19 +140,37 @@
 }
 
 // XML MatchesWhen attribute parsing
-bool CSelectionCriterionRule::setMatchesWhen(const string& strMatchesWhen)
+bool CSelectionCriterionRule::setMatchesWhen(const string& strMatchesWhen, string& strError)
 {
     uint32_t uiMatchesWhen;
 
     for (uiMatchesWhen = 0; uiMatchesWhen < ENbMatchesWhen; uiMatchesWhen++) {
 
-        if (strMatchesWhen == _apcMatchesWhen[uiMatchesWhen]) {
+        const SMatchingRuleDescription* pstMatchingRuleDescription = &_astMatchesWhen[uiMatchesWhen];
+
+        if (strMatchesWhen == pstMatchingRuleDescription->pcMatchesWhen) {
 
             // Found it!
+
+            // Get Type
+            const ISelectionCriterionTypeInterface* pSelectionCriterionType = _pSelectionCriterion->getCriterionType();
+
+            // Check compatibility if relevant
+            if (pSelectionCriterionType->isTypeInclusive() && !pstMatchingRuleDescription->bInclusiveTypeCompatible) {
+
+                strError = "Value incompatible with inclusive kind of type";
+
+                return false;
+            }
+
+            // Store
             _eMatchesWhen = (MatchesWhen)uiMatchesWhen;
 
             return true;
         }
     }
+
+    strError = "Value not found";
+
     return false;
 }