use a char32_t character in the base Stream class

Add an operator<<(char32_t) to the Stream class, char32_t will be used
as a main character instead of a wchar_t (this is needed on systems
where sizeof(wchar_t) is equal to 2).

while here:
- add to utf8:
  size_t wide_to_int(const Stream & stream, size_t stream_index, int & res, bool & correct)
  template<typename StreamType, typename OutputFunction> bool wide_to_output_function(StreamType & buffer, OutputFunction output_function, int mode = 1)
  template<typename OutputFunction> bool wide_to_output_function_by_index(const Stream & stream, OutputFunction output_function, int mode)
- add to convert/misc:
  bool try_esc_to_tex(char32_t c, pt::Stream & out)
  bool try_esc_to_html(char32_t c, pt::Stream & out)
This commit is contained in:
2024-05-31 23:11:11 +02:00
parent 2689c9fece
commit c0838de3a4
10 changed files with 365 additions and 46 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2018-2022, Tomasz Sowa
* Copyright (c) 2018-2024, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -274,6 +274,17 @@ Log & Log::operator<<(wchar_t val)
}
Log & Log::operator<<(char32_t val)
{
if( buffer && file_log && current_level <= file_log->get_log_level() )
{
(*buffer) << val;
}
return *this;
}
Log & Log::operator<<(bool val)
{
if( can_put_log() )

View File

@@ -100,6 +100,7 @@ public:
Log & operator<<(char val);
Log & operator<<(unsigned char val);
Log & operator<<(wchar_t val);
Log & operator<<(char32_t val);
Log & operator<<(bool val);
Log & operator<<(short val);
Log & operator<<(int s);