summaryrefslogtreecommitdiffstats
path: root/parameter/SubsystemObject.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2012-03-06 14:54:07 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:07 +0100
commitc3fe14faa97348f4452b471f35b1a18088630e01 (patch)
treefcb2fabd4bbac9050a3baeb979c379fc41d54c31 /parameter/SubsystemObject.cpp
parent74edbc8e72f0fbca441fe7840ebeb090ef93a0e6 (diff)
downloadexternal_parameter-framework-c3fe14faa97348f4452b471f35b1a18088630e01.zip
external_parameter-framework-c3fe14faa97348f4452b471f35b1a18088630e01.tar.gz
external_parameter-framework-c3fe14faa97348f4452b471f35b1a18088630e01.tar.bz2
PFW: Allow multiple amend in mapping field
BZ: 25744 The fonction that amends is now able to handle multiple amends. Change-Id: Ia4f62d6fee32f401e4ce90f5e75a150771d1921d Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/37733 Reviewed-by: De Chivre, RenaudX <renaudx.de.chivre@intel.com> Reviewed-by: M, Arulselvan <arulselvan.m@intel.com> Tested-by: M, Arulselvan <arulselvan.m@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/SubsystemObject.cpp')
-rw-r--r--parameter/SubsystemObject.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index 1eaffba..0d7a5b4 100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
@@ -182,6 +182,7 @@ void CSubsystemObject::log(const string& strMessage, ...) const
string CSubsystemObject::formatMappingValue(const string& strMappingValue, uint32_t uiFirstAmendKey, uint32_t uiNbAmendKeys, const CMappingContext& context)
{
string strFormattedValue = strMappingValue;
+
// Search for amendment (only one supported for now)
size_t uiPercentPos = strFormattedValue.find('%', 0);
@@ -202,11 +203,16 @@ string CSubsystemObject::formatMappingValue(const string& strMappingValue, uint3
// Set?
if (context.iSet(uiAmendType)) {
- // Get Amend value
+ // Make the amendment on the part of the string after the current Amend
+ string strEndOfLine = strFormattedValue.substr(uiPercentPos + 2, strFormattedValue.size() - uiPercentPos - 2);
+ string strEndOfLineAmended = formatMappingValue(strEndOfLine, uiFirstAmendKey, uiNbAmendKeys, context);
+
+ // Get current Amend value
string strAmendValue = context.getItem(uiAmendType);
// Make the amendment
- strFormattedValue = strFormattedValue.substr(0, uiPercentPos) + strAmendValue + strFormattedValue.substr(uiPercentPos + 2, strFormattedValue.size() - uiPercentPos - 2);
+ strFormattedValue = strFormattedValue.substr(0, uiPercentPos) + strAmendValue + strEndOfLineAmended;
+
}
}
}