libcmo21/LibCmo/VTEncoding.hpp

48 lines
960 B
C++
Raw Normal View History

2023-02-10 16:17:17 +08:00
#pragma once
2023-02-11 15:29:51 +08:00
#include "VTUtils.hpp"
2023-02-10 16:17:17 +08:00
#include <string>
#if defined(LIBCMO_OS_WIN32)
#include <Windows.h>
2023-02-12 21:03:36 +08:00
#include <fileapi.h>
2023-02-10 16:17:17 +08:00
#else
#include <iconv.h>
#endif
namespace LibCmo {
namespace Encoding {
#pragma region assist functions
#if defined(LIBCMO_OS_WIN32)
2023-02-11 15:29:51 +08:00
bool GetWindowsCodePage(const char* u8_encoding_spec, UINT* result);
2023-02-10 16:17:17 +08:00
2023-02-11 15:29:51 +08:00
bool WcharToChar(const wchar_t* src, std::string& dest, UINT codepage);
bool WcharToChar(std::wstring& src, std::string& dest, UINT codepage);
2023-02-10 16:17:17 +08:00
2023-02-11 15:29:51 +08:00
bool CharToWchar(const char* src, std::wstring& dest, UINT codepage);
bool CharToWchar(std::string& src, std::wstring& dest, UINT codepage);
2023-02-10 16:17:17 +08:00
2023-02-11 15:29:51 +08:00
#else
#error NO IMPLEMENTATION FOR LINUX ENCODING!
2023-02-10 16:17:17 +08:00
#endif
#pragma endregion
#pragma region core functions
#if defined(LIBCMO_OS_WIN32)
2023-02-11 15:29:51 +08:00
void GetUtf8VirtoolsName(std::string& native_name, std::string& u8_name, const char* u8_encoding_spec);
2023-02-10 16:17:17 +08:00
#else
#error NO IMPLEMENTATION FOR LINUX ENCODING!
#endif
#pragma endregion
}
}