Remove extra " characters when a StringProperty is set by a string

This commit is contained in:
Alexander Bock
2015-07-06 19:40:20 +02:00
parent 8f76f8adc6
commit 74fb051246
+9 -1
View File
@@ -42,7 +42,15 @@ REGISTER_TEMPLATEPROPERTY_SOURCE(StringProperty, std::string, "",
return true;
},
[](std::string value, bool& success) -> std::string {
success = true;
// An incoming string is of the form
// "value"
// so we want to remove the leading and trailing " characters
if (value.size() > 2 && (value[0] == '"' && value[value.size() - 1] == '"')) {
// Removing the first and last "
success = true;
return value.substr(1, value.size() - 2);
}
success = false;
return value;
},
[](std::string& outValue, std::string inValue) -> bool {