Windows takes care of internal converter state in MultiByteToWideChar
and WideCharToMultiByte and keeps them thread-safe. On other platforms,
iconv requires user to setup and keep converter state for thread-safe
conversions. This sounds time consuming for every string conversion,
therefore the concept of string converter (or converter state) has been
extended to Windows too, allowing uniform client code. On Windows, using
charset_encoder has no performance benefit, where on Linux and macOS,
there should be. To be measured...
Signed-off-by: Simon Rozman <simon@rozman.si>
I am aware of the std::filesystem::path::preferred_separator, but we
are targeting C++14 and we need this as a precompiler macro to allow
concatenation of the path strings in precompile stage.
Signed-off-by: Simon Rozman <simon@rozman.si>
"sys_char" sticks out of "wchar_t", "char32_t", "uint32_t"...
Likewise, "sys_string" out of "string", "wstring", "u16string",
"u32string"...
Signed-off-by: Simon Rozman <simon@rozman.si>
Not that we would like to promote the use of C locale_t over C++
std::locale, but we need former for sprintf and we need decent support
for it.
Signed-off-by: Simon Rozman <simon@rozman.si>
We had to introduce out-of-order construction for those classes, but we
forgot to implement out-of-order destruction. File gets closed first
by cached_file::m_source destructor, then inherited destructor
cache::~cache() which flushes the cache is called.
Signed-off-by: Simon Rozman <simon@rozman.si>
Previous implementation had only strcat-class conversion using vague
function names. This commit makes function names more explicit by adding
"cat" and deprecating previous function variants.
Since many situation required strcpy variant, the move above made space
to add strcpy variants too.
Signed-off-by: Simon Rozman <simon@rozman.si>
Reusing same class instance for different files reused cache content
as well.
Reported-by: Peter Holozan <peter.holozan@amebis.si>
Signed-off-by: Simon Rozman <simon@rozman.si>
Our test program runs 15 minutes using our streams vs. 25 minutes using
std::iostream derived streams.
Streams were ported from Amebis AOsn project.
Signed-off-by: Simon Rozman <simon@rozman.si>