From c3fe14faa97348f4452b471f35b1a18088630e01 Mon Sep 17 00:00:00 2001 From: Patrick Benavoli Date: Tue, 6 Mar 2012 14:54:07 +0100 Subject: PFW: Allow multiple amend in mapping field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BZ: 25744 The fonction that amends is now able to handle multiple amends. Change-Id: Ia4f62d6fee32f401e4ce90f5e75a150771d1921d Signed-off-by: Frédéric Boisnard Reviewed-on: http://android.intel.com:8080/37733 Reviewed-by: De Chivre, RenaudX Reviewed-by: M, Arulselvan Tested-by: M, Arulselvan Reviewed-by: buildbot Tested-by: buildbot --- parameter/SubsystemObject.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'parameter/SubsystemObject.cpp') 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; + } } } -- cgit v1.1