• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_STRINGS_STRCAT_WIN_H_
6 #define BASE_STRINGS_STRCAT_WIN_H_
7 
8 #include <initializer_list>
9 #include <string>
10 
11 #include "base/base_export.h"
12 #include "base/containers/span.h"
13 #include "base/strings/string_piece.h"
14 
15 namespace base {
16 
17 // The following section contains overloads of the cross-platform APIs for
18 // std::wstring and base::WStringPiece.
19 BASE_EXPORT void StrAppend(std::wstring* dest, span<const WStringPiece> pieces);
20 BASE_EXPORT void StrAppend(std::wstring* dest, span<const std::wstring> pieces);
21 
StrAppend(std::wstring * dest,std::initializer_list<WStringPiece> pieces)22 inline void StrAppend(std::wstring* dest,
23                       std::initializer_list<WStringPiece> pieces) {
24   StrAppend(dest, make_span(pieces));
25 }
26 
27 [[nodiscard]] BASE_EXPORT std::wstring StrCat(span<const WStringPiece> pieces);
28 [[nodiscard]] BASE_EXPORT std::wstring StrCat(span<const std::wstring> pieces);
29 
StrCat(std::initializer_list<WStringPiece> pieces)30 inline std::wstring StrCat(std::initializer_list<WStringPiece> pieces) {
31   return StrCat(make_span(pieces));
32 }
33 
34 }  // namespace base
35 
36 #endif  // BASE_STRINGS_STRCAT_WIN_H_
37