123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef BASE_STRINGS_STRING_SPLIT_H_
- #define BASE_STRINGS_STRING_SPLIT_H_
- #include <string>
- #include <utility>
- #include <vector>
- #include "base/base_export.h"
- #include "base/strings/string16.h"
- #include "base/strings/string_piece.h"
- #include "build/build_config.h"
- namespace base {
- enum WhitespaceHandling {
- KEEP_WHITESPACE,
- TRIM_WHITESPACE,
- };
- enum SplitResult {
-
-
-
-
- SPLIT_WANT_ALL,
-
-
-
-
-
-
- SPLIT_WANT_NONEMPTY,
- };
- BASE_EXPORT std::vector<std::string> SplitString(StringPiece input,
- StringPiece separators,
- WhitespaceHandling whitespace,
- SplitResult result_type)
- WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<string16> SplitString(StringPiece16 input,
- StringPiece16 separators,
- WhitespaceHandling whitespace,
- SplitResult result_type)
- WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<StringPiece> SplitStringPiece(
- StringPiece input,
- StringPiece separators,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<StringPiece16> SplitStringPiece(
- StringPiece16 input,
- StringPiece16 separators,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- using StringPairs = std::vector<std::pair<std::string, std::string>>;
- BASE_EXPORT bool SplitStringIntoKeyValuePairs(StringPiece input,
- char key_value_delimiter,
- char key_value_pair_delimiter,
- StringPairs* key_value_pairs);
- BASE_EXPORT bool SplitStringIntoKeyValuePairsUsingSubstr(
- StringPiece input,
- char key_value_delimiter,
- StringPiece key_value_pair_delimiter,
- StringPairs* key_value_pairs);
- BASE_EXPORT std::vector<string16> SplitStringUsingSubstr(
- StringPiece16 input,
- StringPiece16 delimiter,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<std::string> SplitStringUsingSubstr(
- StringPiece input,
- StringPiece delimiter,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<StringPiece16> SplitStringPieceUsingSubstr(
- StringPiece16 input,
- StringPiece16 delimiter,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- BASE_EXPORT std::vector<StringPiece> SplitStringPieceUsingSubstr(
- StringPiece input,
- StringPiece delimiter,
- WhitespaceHandling whitespace,
- SplitResult result_type) WARN_UNUSED_RESULT;
- }
- #if defined(OS_WIN)
- #include "base/strings/string_split_win.h"
- #endif
- #endif
|