| 998 | } |
| 999 | |
| 1000 | bool SplitStringIntoKeyValuePairs(const string& line, |
| 1001 | const string& key_value_delimiters, |
| 1002 | const string& key_value_pair_delimiters, |
| 1003 | vector<pair<string, string> >* kv_pairs) { |
| 1004 | kv_pairs->clear(); |
| 1005 | |
| 1006 | vector<string> pairs; |
| 1007 | SplitStringUsing(line, key_value_pair_delimiters.c_str(), &pairs); |
| 1008 | |
| 1009 | bool success = true; |
| 1010 | for (const auto& pair : pairs) { |
| 1011 | string key; |
| 1012 | vector<string> value; |
| 1013 | if (!SplitStringIntoKeyValues(pair, |
| 1014 | key_value_delimiters, |
| 1015 | "", &key, &value)) { |
| 1016 | // Don't return here, to allow for keys without associated |
| 1017 | // values; just record that our split failed. |
| 1018 | success = false; |
| 1019 | } |
| 1020 | // we expect atmost one value because we passed in an empty vsep to |
| 1021 | // SplitStringIntoKeyValues |
| 1022 | DCHECK_LE(value.size(), 1); |
| 1023 | kv_pairs->push_back(make_pair(key, value.empty()? "" : value[0])); |
| 1024 | } |
| 1025 | return success; |
| 1026 | } |
| 1027 | |
| 1028 | // ---------------------------------------------------------------------- |
| 1029 | // SplitLeadingDec32Values() |
nothing calls this directly
no test coverage detected