--- lib/libfilezilla/string.hpp.orig 2024-10-15 12:59:21 UTC +++ lib/libfilezilla/string.hpp @@ -11,6 +11,39 @@ #include #include +template +class traits_cloner +{ +public: + using char_type = CharT; + + using base_type = BaseT; + using base_traits = std::char_traits; + + static std::size_t length(char_type const* s) { + return base_traits::length(reinterpret_cast(s)); + } + static int compare(char_type const* s1, char_type const* s2, std::size_t count) { + return base_traits::compare(reinterpret_cast(s1), reinterpret_cast(s2), count); + } + static char_type* copy(char_type* dest, char_type const* src, std::size_t count) { + return reinterpret_cast(base_traits::copy(reinterpret_cast(dest), reinterpret_cast(src), count)); + } + static void assign( char_type& c1, char_type const& c2 ) noexcept { + c1 = c2; + } + static char_type const* find(char_type const* ptr, std::size_t count, char_type const& ch) { + return reinterpret_cast(base_traits::find(reinterpret_cast(ptr), count, reinterpret_cast(ch))); + } + static bool eq(char_type a, char_type b) { + return base_traits::eq(static_cast(a), static_cast(b)); + } +}; + +template<> +class std::char_traits : public traits_cloner +{}; + /** \file * \brief String types and assorted functions. *