void WindowFeatures::parseDialogFeatures(const String& string, DialogFeaturesMap& map) { Vector<String> vector; string.split(';', vector); size_t size = vector.size(); for (size_t i = 0; i < size; ++i) { const String& featureString = vector[i]; size_t separatorPosition = featureString.find('='); size_t colonPosition = featureString.find(':'); if (separatorPosition != kNotFound && colonPosition != kNotFound) continue; // ignore strings that have both = and : if (separatorPosition == kNotFound) separatorPosition = colonPosition; String key = featureString.left(separatorPosition).stripWhiteSpace().lower(); // Null string for value indicates key without value. String value; if (separatorPosition != kNotFound) { value = featureString.substring(separatorPosition + 1).stripWhiteSpace().lower(); value = value.left(value.find(' ')); } map.set(key, value); } }
static DialogFeaturesMap parseDialogFeaturesMap(const String& string) { // FIXME: Not clear why we take such a different approach to parsing dialog features // as opposed to window features (using a map, different parsing quirks). DialogFeaturesMap features; Vector<String> vector; string.split(';', vector); for (auto& featureString : vector) { size_t separatorPosition = featureString.find('='); size_t colonPosition = featureString.find(':'); if (separatorPosition != notFound && colonPosition != notFound) continue; // ignore strings that have both = and : if (separatorPosition == notFound) separatorPosition = colonPosition; String key = featureString.left(separatorPosition).stripWhiteSpace(); // Null string for value indicates key without value. String value; if (separatorPosition != notFound) { value = featureString.substring(separatorPosition + 1).stripWhiteSpace(); value = value.left(value.find(' ')); } features.set(key, value); } return features; }