string_split_win.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_STRINGS_STRING_SPLIT_WIN_H_
  5. #define BASE_STRINGS_STRING_SPLIT_WIN_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/base_export.h"
  9. #include "base/compiler_specific.h"
  10. #include "base/strings/string16.h"
  11. #include "base/strings/string_piece.h"
  12. #include "base/strings/string_split.h"
  13. namespace base {
  14. // The following section contains overloads of the cross-platform APIs for
  15. // std::wstring and base::WStringPiece. These are only enabled if std::wstring
  16. // and base::string16 are distinct types, as otherwise this would result in an
  17. // ODR violation.
  18. // TODO(crbug.com/911896): Remove those guards once base::string16 is
  19. // std::u16string.
  20. #if defined(BASE_STRING16_IS_STD_U16STRING)
  21. BASE_EXPORT std::vector<std::wstring> SplitString(WStringPiece input,
  22. WStringPiece separators,
  23. WhitespaceHandling whitespace,
  24. SplitResult result_type)
  25. WARN_UNUSED_RESULT;
  26. BASE_EXPORT std::vector<WStringPiece> SplitStringPiece(
  27. WStringPiece input,
  28. WStringPiece separators,
  29. WhitespaceHandling whitespace,
  30. SplitResult result_type) WARN_UNUSED_RESULT;
  31. BASE_EXPORT std::vector<std::wstring> SplitStringUsingSubstr(
  32. WStringPiece input,
  33. WStringPiece delimiter,
  34. WhitespaceHandling whitespace,
  35. SplitResult result_type) WARN_UNUSED_RESULT;
  36. BASE_EXPORT std::vector<WStringPiece> SplitStringPieceUsingSubstr(
  37. WStringPiece input,
  38. WStringPiece delimiter,
  39. WhitespaceHandling whitespace,
  40. SplitResult result_type) WARN_UNUSED_RESULT;
  41. #endif
  42. } // namespace base
  43. #endif // BASE_STRINGS_STRING_SPLIT_WIN_H_