xref: /aosp_15_r20/external/cronet/base/strings/strcat_win.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #include <string_view>
11 
12 #include "base/base_export.h"
13 #include "base/containers/span.h"
14 
15 namespace base {
16 
17 // The following section contains overloads of the cross-platform APIs for
18 // std::wstring and std::wstring_view.
19 BASE_EXPORT void StrAppend(std::wstring* dest,
20                            span<const std::wstring_view> pieces);
21 BASE_EXPORT void StrAppend(std::wstring* dest, span<const std::wstring> pieces);
22 
StrAppend(std::wstring * dest,std::initializer_list<std::wstring_view> pieces)23 inline void StrAppend(std::wstring* dest,
24                       std::initializer_list<std::wstring_view> pieces) {
25   StrAppend(dest, make_span(pieces));
26 }
27 
28 [[nodiscard]] BASE_EXPORT std::wstring StrCat(
29     span<const std::wstring_view> pieces);
30 [[nodiscard]] BASE_EXPORT std::wstring StrCat(span<const std::wstring> pieces);
31 
StrCat(std::initializer_list<std::wstring_view> pieces)32 inline std::wstring StrCat(std::initializer_list<std::wstring_view> pieces) {
33   return StrCat(make_span(pieces));
34 }
35 
36 }  // namespace base
37 
38 #endif  // BASE_STRINGS_STRCAT_WIN_H_
39