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

pull/4/head
Tomasz Sowa 2 years ago
parent f65d934e8c
commit 4ef8f5a884

@ -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(std::istream & utf8, std::wstring & res, bool clear = true, int mode = 1);
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 = true, int mode = 1); // need to be tested
template<typename StreamType>
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>
bool UTF8ToWide(const char * utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested
template<typename StreamType>
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>
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
template<typename StreamType>
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>
bool UTF8ToWide(std::istream & utf8, TextStreamBase<wchar_t, stack_size, heap_block_size> & res, bool clear = true, int mode = 1); // need to be tested
template<typename StreamType>
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);
// implement template<typename StreamType>
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 = true, int mode = 1); // not tested
template<typename StreamType>
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>
void WideToUTF8(TextStreamBase<wchar_t, stack_size, heap_block_size> & buffer, std::ostream & utf8, int mode = 1); // not tested
template<typename StreamTypeIn, typename StreamTypeOut>
void WideStreamToUTF8(StreamTypeIn & buffer, StreamTypeOut & utf8, int mode = 1); // not tested

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

@ -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);

Loading…
Cancel
Save