|
|
|
@ -52,8 +52,8 @@ namespace PT
|
|
|
|
|
(need to be tested)
|
|
|
|
|
*/
|
|
|
|
|
// need to be tested
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
bool UTF8ToWide(const char * utf8, size_t utf8_len, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear, int mode)
|
|
|
|
|
template<typename StreamType>
|
|
|
|
|
bool UTF8ToWide(const char * utf8, size_t utf8_len, StreamType & res, bool clear, int mode)
|
|
|
|
|
{
|
|
|
|
|
if( clear )
|
|
|
|
|
res.clear();
|
|
|
|
@ -68,8 +68,8 @@ bool UTF8ToWide(const char * utf8, size_t utf8_len, TextStreamBase<wchar_t, stac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
bool UTF8ToWide(const char * utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear, int mode)
|
|
|
|
|
template<typename StreamType>
|
|
|
|
|
bool UTF8ToWide(const char * utf8, StreamType & res, bool clear, int mode)
|
|
|
|
|
{
|
|
|
|
|
size_t utf8_len = 0;
|
|
|
|
|
|
|
|
|
@ -81,8 +81,8 @@ return UTF8ToWide(utf8, utf8_len, res, clear, mode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
bool UTF8ToWide(const std::string & utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear, int mode)
|
|
|
|
|
template<typename StreamType>
|
|
|
|
|
bool UTF8ToWide(const std::string & utf8, StreamType & res, bool clear, int mode)
|
|
|
|
|
{
|
|
|
|
|
return UTF8ToWide(utf8.c_str(), utf8.size(), res, clear, mode);
|
|
|
|
|
}
|
|
|
|
@ -90,8 +90,8 @@ bool UTF8ToWide(const std::string & utf8, TextStreamBase<wchar_t, stack_size, he
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// need to be tested
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
bool UTF8ToWide(std::istream & utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear, int mode)
|
|
|
|
|
template<typename StreamType>
|
|
|
|
|
bool UTF8ToWide(std::istream & utf8, StreamType & res, bool clear, int mode)
|
|
|
|
|
{
|
|
|
|
|
int z;
|
|
|
|
|
bool correct, was_error = false;
|
|
|
|
@ -238,8 +238,8 @@ bool WideToUTF8(const std::wstring & wide_string, StreamType & utf8, int mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, std::string & utf8, bool clear, int mode)
|
|
|
|
|
template<typename StreamType>
|
|
|
|
|
void WideStreamToUTF8(StreamType & buffer, std::string & utf8, bool clear, int mode)
|
|
|
|
|
{
|
|
|
|
|
if( clear )
|
|
|
|
|
utf8.clear();
|
|
|
|
@ -251,8 +251,8 @@ void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// not tested
|
|
|
|
|
template<size_t stack_size, size_t heap_block_size>
|
|
|
|
|
void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, std::ostream & utf8, int mode)
|
|
|
|
|
template<typename StreamTypeIn, typename StreamTypeOut>
|
|
|
|
|
void WideStreamToUTF8(StreamTypeIn & buffer, StreamTypeOut & utf8, int mode)
|
|
|
|
|
{
|
|
|
|
|
private_namespace::WideToUTF8Generic(buffer, mode, [&utf8](const char * utf8_buffer, std::size_t buffer_len){
|
|
|
|
|
utf8.write(utf8_buffer, buffer_len);
|
|
|
|
|