cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
Loading...
Searching...
No Matches
unicode.hpp
Go to the documentation of this file.
1
2/*
3* cpp-terminal
4* C++ library for writing multi-platform terminal applications.
5*
6* SPDX-FileCopyrightText: 2019-2024 cpp-terminal
7*
8* SPDX-License-Identifier: MIT
9*/
10
11#pragma once
12
13#include <string>
14
15namespace Term
16{
17namespace Private
18{
19
20// utf16 is useless and wstring too so utf16 inside wstring is useless^2 but windows use it so define this functions to deal with it and less the user forget it.
21#if defined(_WIN32)
22std::string to_narrow(const std::wstring& wstr);
23std::wstring to_wide(const std::string& str);
24#endif
25
34std::string utf32_to_utf8(const char32_t& codepoint, const bool& exception = false);
35
44std::string utf32_to_utf8(const std::u32string& str, const bool& exception = false);
45
46} // namespace Private
47} // namespace Term
std::wstring to_wide(const std::string &str)
Definition unicode.cpp:40
std::string utf32_to_utf8(const char32_t &codepoint, const bool &exception=false)
Encode a codepoint using UTF-8 std::string .
Definition unicode.cpp:55
std::string to_narrow(const std::wstring &wstr)
Definition unicode.cpp:26
Definition args.cpp:13