libcmo21/LibCmo/VTEncoding.hpp
yyc12345 f870d4dde3 refactor: update project
- add documentation CMake build script. re-organise document layout for future changes.
- move LIBCMO_EXPORT to BMap and rename it to BMAP_EXPORT because only BMap need to use this macro.
- fully refactor VTEncoding to make it more like Python
	- Now language name is platform independent.
	- Hide implementation detail as possible as I can.
	- Language mapping are still work in progress.
- add code gen for new added universal encoding feature to generate language name mapping in Windows and Iconv respectively.
- remove old code of CMake build script.
- update VTUtils for new requirement.
	- remove useless functions.
	- create LibCmo specific custom exception classes.
2024-08-16 22:07:23 +08:00

25 lines
928 B
C++

#pragma once
#include "VTUtils.hpp"
#include <string>
#include <string_view>
namespace LibCmo::EncodingHelper {
using EncodingToken = void*;
constexpr EncodingToken INVALID_ENCODING_TOKEN = nullptr;
EncodingToken CreateEncodingToken(const std::u8string_view& enc_name);
void DestroyEncodingToken(EncodingToken token);
bool ToOrdinary(const std::u8string_view& src, std::string& dst, EncodingToken token);
bool ToOrdinary(const char8_t* src, std::string& dst, EncodingToken token);
std::string ToOrdinary(const std::u8string_view& src, EncodingToken token);
std::string ToOrdinary(const char8_t* src, EncodingToken token);
bool ToUTF8(const std::string_view& src, std::u8string& dst, EncodingToken token);
bool ToUTF8(const char* src, std::u8string& dst, EncodingToken token);
std::u8string ToUTF8(const std::string_view& src, EncodingToken token);
std::u8string ToUTF8(const char* src, EncodingToken token);
}