template<size_t stack_size, size_t heap_block_size> changed to template<typename StreamType>

This commit is contained in:
Tomasz Sowa 2021-03-15 20:09:23 +01:00
parent f65d934e8c
commit 4ef8f5a884
3 changed files with 26 additions and 26 deletions

View File

@ -92,17 +92,17 @@ bool UTF8ToWide(const char * utf8, std::wstring & res, bool cle
bool UTF8ToWide(const std::string & utf8, std::wstring & res, bool clear = true, int mode = 1); bool UTF8ToWide(const std::string & utf8, std::wstring & res, bool clear = true, int mode = 1);
bool UTF8ToWide(std::istream & utf8, std::wstring & res, bool clear = true, int mode = 1); bool UTF8ToWide(std::istream & utf8, std::wstring & res, bool clear = true, int mode = 1);
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
bool UTF8ToWide(const char * utf8, size_t utf8_len, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested bool UTF8ToWide(const char * utf8, size_t utf8_len, StreamType & res, bool clear = true, int mode = 1); // need to be tested
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
bool UTF8ToWide(const char * utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested bool UTF8ToWide(const char * utf8, StreamType & res, bool clear = true, int mode = 1); // need to be tested
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
bool UTF8ToWide(const std::string & utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested bool UTF8ToWide(const std::string & utf8, StreamType & res, bool clear = true, int mode = 1); // need to be tested
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
bool UTF8ToWide(std::istream & utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested bool UTF8ToWide(std::istream & utf8, StreamType & res, bool clear = true, int mode = 1); // need to be tested
@ -156,11 +156,11 @@ bool WideToUTF8(const wchar_t * wide_string, char * utf8, siz
bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_len, int mode = 1); bool WideToUTF8(const std::wstring & wide_string, char * utf8, size_t utf8_len, int mode = 1);
// implement template<typename StreamType> // implement template<typename StreamType>
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, std::string & utf8, bool clear = true, int mode = 1); // not tested void WideStreamToUTF8(StreamType & buffer, std::string & utf8, bool clear = true, int mode = 1); // not tested
template<size_t stack_size, size_t heap_block_size> template<typename StreamTypeIn, typename StreamTypeOut>
void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, std::ostream & utf8, int mode = 1); // not tested void WideStreamToUTF8(StreamTypeIn & buffer, StreamTypeOut & utf8, int mode = 1); // not tested

View File

@ -162,8 +162,8 @@ return !was_error;
template<size_t stack_size, size_t heap_block_size> template<typename StreamType>
void IntToWide(int c, TextStreamBase<wchar_t, stack_size, heap_block_size> & res) void IntToWide(int c, StreamType & res)
{ {
if( sizeof(wchar_t)==2 && c>0xffff ) if( sizeof(wchar_t)==2 && c>0xffff )
{ {

View File

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