1 #ifndef LIBFILEZILLA_GLUE_WX_HEADER
2 #define LIBFILEZILLA_GLUE_WX_HEADER
3 
4 /** \file
5  * \brief Glue to handle support wxString for some functions
6  */
7 
8 
9 #include "../private/defs.hpp"
10 #if FZ_WINDOWS
11 #include "windows.hpp"
12 #endif
13 
14 #include <wx/string.h>
15 
16 #include "../format.hpp"
17 #include "../string.hpp"
18 
19 namespace fz {
20 template<typename T, typename std::enable_if_t<std::is_same_v<wxString, typename std::decay_t<T>>, int> = 0>
to_wstring(T const & s)21 inline std::wstring to_wstring(T const& s) {
22 	return s.ToStdWstring();
23 }
24 
25 template<typename T, typename std::enable_if_t<std::is_same_v<wxString, typename std::decay_t<T>>, int> = 0>
to_native(T const & in)26 inline native_string to_native(T const& in)
27 {
28 	return to_native(in.ToStdWstring());
29 }
30 
31 template<typename T, typename std::enable_if_t<std::is_same_v<wxString, typename std::decay_t<T>>, int> = 0>
to_utf8(T const & s)32 inline std::string to_utf8(T const& s)
33 {
34 	return to_utf8(s.ToStdWstring());
35 }
36 
37 template<typename T, typename std::enable_if_t<std::is_same_v<wxString, typename std::decay_t<T>>, int> = 0, typename... Args>
sprintf(T const & fmt,Args &&...args)38 std::wstring sprintf(T const& fmt, Args&&... args)
39 {
40 	return sprintf(fmt.ToStdWstring(), std::forward<Args>(args)...);
41 }
42 
43 }
44 
45 #endif
46