libfilezilla
wx.hpp
Go to the documentation of this file.
1 #ifndef LIBFILEZILLA_GLUE_WX_HEADER
2 #define LIBFILEZILLA_GLUE_WX_HEADER
3 
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>
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>
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>
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>
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
The namespace used by libfilezilla.
Definition: apply.hpp:17
std::wstring to_wstring(std::string_view const &in)
Converts from std::string in system encoding into std::wstring.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition: string.hpp:34
std::string sprintf(std::string_view const &fmt, Args &&... args)
A simple type-safe sprintf replacement.
Definition: format.hpp:456
std::string to_utf8(std::string_view const &in)
Converts from std::string in native encoding into std::string in UTF-8.
native_string to_native(std::string_view const &in)
Converts std::string to native_string.