diff options
Diffstat (limited to 'parameter/MappingData.cpp')
-rw-r--r-- | parameter/MappingData.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/parameter/MappingData.cpp b/parameter/MappingData.cpp index a577439..4ec58e3 100644 --- a/parameter/MappingData.cpp +++ b/parameter/MappingData.cpp @@ -42,10 +42,26 @@ bool CMappingData::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext while (!(strMappingElement = mappingTok.next()).empty()) { - Tokenizer keyValueTok(strMappingElement, ":"); + string::size_type iFistDelimiterOccurrence = strMappingElement.find_first_of(':'); - string strKey = keyValueTok.next(); - string strValue = keyValueTok.next(); + string strKey, strValue; + + if (iFistDelimiterOccurrence == string::npos) { + + // There is no delimiter in the mapping field, + // it means that no value has been provided + strKey = strMappingElement; + strValue = ""; + + } else { + + // Get mapping key + strKey = strMappingElement.substr(0, iFistDelimiterOccurrence); + + // Get mapping value + strValue = strMappingElement.substr(iFistDelimiterOccurrence + 1); + + } if (!addValue(strKey, strValue)) { |