From f1ba68bd61d35f084bf42db123c6667e170b981d Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Tue, 4 Jul 2023 00:23:27 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/wina?= =?UTF-8?q?pi-utf8@5df6c58501383d82eff71e89e02957837258481c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utf8_8hpp_source.html | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 utf8_8hpp_source.html (limited to 'utf8_8hpp_source.html') diff --git a/utf8_8hpp_source.html b/utf8_8hpp_source.html new file mode 100644 index 0000000..0438297 --- /dev/null +++ b/utf8_8hpp_source.html @@ -0,0 +1,118 @@ + + + + + + + +winapi_utf8: include/winapi/utf8.hpp Source File + + + + + + + + + +
+
+ + + + + + +
+
winapi_utf8 +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
utf8.hpp
+
+
+Go to the documentation of this file.
1 // Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
+
2 // This file is part of the "winapi-utf8" project.
+
3 // For details, see https://github.com/egor-tensin/winapi-utf8.
+
4 // Distributed under the MIT License.
+
5 
+
11 #pragma once
+
12 
+
13 #include <cstddef>
+
14 #include <memory>
+
15 #include <string>
+
16 #include <vector>
+
17 
+
18 namespace winapi {
+
19 
+
20 /* sizeof(wchar_t) == 4 on Linux, we don't care about that. */
+
21 static_assert(sizeof(wchar_t) == 2, "This is Windows, right?");
+
22 
+
24 std::wstring widen(const std::string&);
+
25 
+
31 std::wstring widen(const void* src, std::size_t nb);
+
32 
+
37 template <typename T, typename Alloc = std::allocator<T>>
+
38 std::wstring widen(const std::vector<T, Alloc>& src) {
+
39  return widen(src.data(), src.size() * sizeof(T));
+
40 }
+
41 
+
43 std::string narrow(const std::wstring&);
+
44 
+
46 std::string narrow(const std::u16string&);
+
47 
+
53 std::string narrow(const void* src, std::size_t nb);
+
54 
+
59 template <typename T, typename Alloc = std::allocator<T>>
+
60 std::string narrow(const std::vector<T, Alloc>& src) {
+
61  return narrow(src.data(), src.size() * sizeof(T));
+
62 }
+
63 
+
64 } // namespace winapi
+
std::wstring widen(const std::string &)
Definition: convert.cpp:99
+
std::string narrow(const std::wstring &)
Definition: convert.cpp:128
+
+ + + + -- cgit v1.2.3