move QString-formatting to helpers.hpp so fS works with it all the time

This commit is contained in:
Rasmus Karlsson 2017-12-22 14:07:58 +01:00
parent 86a9f194f9
commit 795deac727
2 changed files with 12 additions and 12 deletions

View file

@ -1,6 +1,6 @@
#pragma once
#include "fmt/format.h"
#include "util/helpers.hpp"
#include <QDebug>
#include <QTime>
@ -20,18 +20,8 @@ static void _log(const std::string &message)
template <typename... Args>
inline void Log(const std::string &formatString, Args &&... args)
{
detail::_log(fmt::format(formatString, std::forward<Args>(args)...));
detail::_log(fS(formatString, std::forward<Args>(args)...));
}
} // namespace debug
} // namespace chatterino
namespace fmt {
// format_arg for QString
inline void format_arg(BasicFormatter<char> &f, const char *&, const QString &v)
{
f.writer().write("\"{}\"", v.toStdString());
}
} // namespace fmt

View file

@ -11,3 +11,13 @@ auto fS(Args &&... args) -> decltype(fmt::format(std::forward<Args>(args)...))
}
} // namespace chatterino
namespace fmt {
// format_arg for QString
inline void format_arg(BasicFormatter<char> &f, const char *&, const QString &v)
{
f.writer().write("\"{}\"", v.toStdString());
}
} // namespace fmt