Handle key names in mapping context

BZ: 126002

Mapping context only allows to retrieve a mapping value from its
corresponding key ID. We also want to do the same using its key
as a string.

This patch adds key name handling in context mapping. It also adds
an API to retieve a mapping value from its corresponding key name.

Note: it also removes an unused argument from handleMappingContext
function.

Change-Id: I5a18ad624a69272ea2796090692f2bfa8b373a52
Signed-off-by: Renaud de Chivre <renaud.de.chivre@intel.com>
Reviewed-on: http://android.intel.com:8080/131571
Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp
index c776065..221b27a 100644
--- a/parameter/Subsystem.cpp
+++ b/parameter/Subsystem.cpp
@@ -335,21 +335,20 @@
 // Mapping generic context handling
 bool CSubsystem::handleMappingContext(
         const CInstanceConfigurableElement* pInstanceConfigurableElement,
-        const vector<string>& contextMappingKeyArray,
         CMappingContext& context,
         string& strError) const
 {
     // Feed context with found mapping data
     uint32_t uiItem;
 
-    for (uiItem = 0; uiItem < contextMappingKeyArray.size(); uiItem++) {
+    for (uiItem = 0; uiItem < _contextMappingKeyArray.size(); uiItem++) {
 
-        string strKey = contextMappingKeyArray[uiItem];
+        const string& strKey = _contextMappingKeyArray[uiItem];
         const string* pStrValue;
 
         if (pInstanceConfigurableElement->getMappingData(strKey, pStrValue)) {
             // Assign item to context
-            if (!context.setItem(uiItem, pStrValue)) {
+            if (!context.setItem(uiItem, &strKey, pStrValue)) {
 
                 strError = getMappingError(strKey, "Already set", pInstanceConfigurableElement);
 
@@ -438,7 +437,7 @@
     CMappingContext context = _contextStack.top();
 
     // Add mapping in context
-    if (!handleMappingContext(pInstanceConfigurableElement, _contextMappingKeyArray, context,
+    if (!handleMappingContext(pInstanceConfigurableElement, context,
                               strError)) {
 
         return false;