OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_STRINGS_STRING_SPLIT_H_ | 5 #ifndef BASE_STRINGS_STRING_SPLIT_H_ |
6 #define BASE_STRINGS_STRING_SPLIT_H_ | 6 #define BASE_STRINGS_STRING_SPLIT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... | |
29 // Note: |c| must be in the ASCII range. | 29 // Note: |c| must be in the ASCII range. |
30 BASE_EXPORT void SplitString(const std::string& str, | 30 BASE_EXPORT void SplitString(const std::string& str, |
31 char c, | 31 char c, |
32 std::vector<std::string>* r); | 32 std::vector<std::string>* r); |
33 | 33 |
34 BASE_EXPORT bool SplitStringIntoKeyValues(const std::string& line, | 34 BASE_EXPORT bool SplitStringIntoKeyValues(const std::string& line, |
35 char key_value_delimiter, | 35 char key_value_delimiter, |
36 std::string* key, | 36 std::string* key, |
37 std::vector<std::string>* values); | 37 std::vector<std::string>* values); |
38 | 38 |
39 typedef std::vector<std::pair<std::string, std::string> > KeyValuePairs; | |
darin (slow to review)
2013/08/08 04:40:55
If I saw base::KeyValuePairs in code, it wouldn't
Mark P
2013/08/08 13:16:02
Yes, that's an improvement. Done.
| |
40 | |
39 BASE_EXPORT bool SplitStringIntoKeyValuePairs( | 41 BASE_EXPORT bool SplitStringIntoKeyValuePairs( |
40 const std::string& line, | 42 const std::string& line, |
41 char key_value_delimiter, | 43 char key_value_delimiter, |
42 char key_value_pair_delimiter, | 44 char key_value_pair_delimiter, |
43 std::vector<std::pair<std::string, std::string> >* kv_pairs); | 45 KeyValuePairs* kv_pairs); |
darin (slow to review)
2013/08/08 04:40:55
nit: while you are here, perhaps kv_pairs can be n
Mark P
2013/08/08 13:16:02
Okay. Done.
| |
44 | 46 |
45 // The same as SplitString, but use a substring delimiter instead of a char. | 47 // The same as SplitString, but use a substring delimiter instead of a char. |
46 BASE_EXPORT void SplitStringUsingSubstr(const string16& str, | 48 BASE_EXPORT void SplitStringUsingSubstr(const string16& str, |
47 const string16& s, | 49 const string16& s, |
48 std::vector<string16>* r); | 50 std::vector<string16>* r); |
49 BASE_EXPORT void SplitStringUsingSubstr(const std::string& str, | 51 BASE_EXPORT void SplitStringUsingSubstr(const std::string& str, |
50 const std::string& s, | 52 const std::string& s, |
51 std::vector<std::string>* r); | 53 std::vector<std::string>* r); |
52 | 54 |
53 // The same as SplitString, but don't trim white space. | 55 // The same as SplitString, but don't trim white space. |
(...skipping 18 matching lines...) Expand all Loading... | |
72 // characters defined by HTML 5). Each contiguous block of non-whitespace | 74 // characters defined by HTML 5). Each contiguous block of non-whitespace |
73 // characters is added to result. | 75 // characters is added to result. |
74 BASE_EXPORT void SplitStringAlongWhitespace(const string16& str, | 76 BASE_EXPORT void SplitStringAlongWhitespace(const string16& str, |
75 std::vector<string16>* result); | 77 std::vector<string16>* result); |
76 BASE_EXPORT void SplitStringAlongWhitespace(const std::string& str, | 78 BASE_EXPORT void SplitStringAlongWhitespace(const std::string& str, |
77 std::vector<std::string>* result); | 79 std::vector<std::string>* result); |
78 | 80 |
79 } // namespace base | 81 } // namespace base |
80 | 82 |
81 #endif // BASE_STRINGS_STRING_SPLIT_H_ | 83 #endif // BASE_STRINGS_STRING_SPLIT_H_ |
OLD | NEW |