-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEncoding.h
42 lines (30 loc) · 1.33 KB
/
Encoding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** $VER: Encoding.h (2024.05.18) P. Stuer **/
#pragma once
#include "framework.h"
std::string WideToUTF8(const wchar_t * wide, size_t size) noexcept;
std::wstring TextToWide(const char * text, size_t size = 0) noexcept;
std::wstring CodePageToWide(uint32_t codePage, const char * text, size_t size) noexcept;
std::string CodePageToUTF8(uint32_t codePage, const char * text, size_t size) noexcept;
std::string TextToUTF8(const char * text, size_t size = 0) noexcept;
inline std::wstring UTF8ToWide(const char * text, size_t size) noexcept
{
return CodePageToWide(CP_UTF8, text, size);
}
inline std::string WideToUTF8(const std::wstring & text) noexcept
{
return ::WideToUTF8(text.c_str(), text.length());
}
inline std::wstring CodePageToWide(uint32_t codePage, const std::string & text) noexcept
{
return CodePageToWide(codePage, text.c_str(), text.length());
}
inline std::wstring UTF8ToWide(const std::string & text) noexcept
{
return CodePageToWide(CP_UTF8, text.c_str(), text.length());
}
std::string FormatText(const char * format, ...) noexcept;
std::wstring FormatText(const wchar_t * format, ...) noexcept;
bool IsEUCJP(const char * text, size_t size) noexcept;
bool IsShiftJIS(const char * text, size_t size) noexcept;
bool IsUTF8(const char * text, size_t size) noexcept;
bool IsASCII(const char * text, size_t size) noexcept;