Use fmt for string formatting (GTK client) (#3967)

This commit is contained in:
Mike Gelfand
2022-10-15 09:13:50 -07:00
committed by GitHub
parent 79068c512a
commit ae2dd5eba9
11 changed files with 70 additions and 79 deletions

View File

@@ -262,30 +262,6 @@ inline char const* sprintify(std::string const& arg)
} // namespace gtr_detail
template<typename... Ts>
inline Glib::ustring gtr_sprintf(char const* fmt, Ts const&... args)
{
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 62)
auto* const c_str = g_strdup_printf(fmt, gtr_detail::sprintify(args)...);
Glib::ustring ustr(c_str);
g_free(c_str);
return ustr;
#else
return Glib::ustring::sprintf(fmt, args...);
#endif
}
template<typename... Ts>
inline Glib::ustring gtr_sprintf(Glib::ustring const& fmt, Ts const&... args)
{
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 62)
return gtr_sprintf(fmt.c_str(), args...);
#else
return Glib::ustring::sprintf(fmt, args...);
#endif
}
template<typename T, typename U>
inline Glib::RefPtr<T> gtr_ptr_static_cast(Glib::RefPtr<U> const& ptr)
{