Flutter Windows Embedder
wchar_util.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 
5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_
7 
8 #include <string>
9 
10 namespace flutter {
11 
12 //------------------------------------------------------------------------------
13 /// @brief Convert a null terminated wchar_t buffer to a std::string using
14 /// Windows utilities.
15 ///
16 /// The reliance on wchar_t buffers is problematic on C++20 since
17 /// their interop with standard library components has been
18 /// deprecated/removed.
19 ///
20 /// @param[in] wstr The null terminated buffer.
21 ///
22 /// @return The converted string if conversion is possible. Empty string
23 /// otherwise.
24 ///
25 std::string WCharBufferToString(const wchar_t* wstr);
26 
27 } // namespace flutter
28 
29 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_
std::string WCharBufferToString(const wchar_t *wstr)
Convert a null terminated wchar_t buffer to a std::string using Windows utilities.
Definition: wchar_util.cc:11