添加项目文件。
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#if defined(UTEXTCODEC_EXPORTS)
|
||||
#define UTEXTCODEC_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define UTEXTCODEC_EXPORT __declspec(dllimport)
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "../x64/Debug/UTextCodecd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "../x64/Release/UTextCodec.lib")
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define UTEXTCODEC_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
class UTEXTCODEC_EXPORT UTextCodec
|
||||
{
|
||||
public:
|
||||
// UTF-8 ⇄ UTF-16 (wstring)
|
||||
static std::wstring UTF8to16(const std::string& utf8);
|
||||
static std::string UTF16to8(const std::wstring& wstr);
|
||||
|
||||
// UTF-8 ⇄ UTF-32
|
||||
static std::u32string UTF8to32(const std::string& utf8);
|
||||
static std::string UTF32to8(const std::u32string& u32str);
|
||||
|
||||
// wstring ⇄ u32string
|
||||
static std::u32string WtoUTF32(const std::wstring& wstr);
|
||||
static std::wstring UTF32toW(const std::u32string& u32str);
|
||||
|
||||
// wstring ⇄ string
|
||||
static std::wstring StoW(const std::string& str);
|
||||
static std::string WtoS(const std::wstring& wstr);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows ANSI ⇄ UTF-16 (wstring)
|
||||
static std::wstring AtoW(const std::string& ansi, UINT codePage = CP_ACP);
|
||||
static std::string WtoA(const std::wstring& wstr, UINT codePage = CP_ACP);
|
||||
#endif
|
||||
|
||||
static std::string DetectEncoding();
|
||||
};
|
||||
Reference in New Issue
Block a user