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>
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 @@
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 @@
// 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;
+
}
}
}