Skip to content

Commit

Permalink
Fix plog and QString
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed May 21, 2021
1 parent 60fd9a4 commit 51f6eb8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
17 changes: 0 additions & 17 deletions 3rdparty/plog/include/plog/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,6 @@ namespace plog
return *this;
}

#ifdef QT_VERSION
Record& operator<<(const QString& data)
{
# ifdef _WIN32
return *this << data.toStdWString();
# else
return *this << data.toStdString();
# endif
}

Record& operator<<(const QStringRef& data)
{
QString qstr;
return *this << qstr.append(data);
}
#endif

template<typename T>
Record& operator<<(const T& data)
{
Expand Down
16 changes: 16 additions & 0 deletions src/utils/include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <chrono>

#include <QLatin1String>
#include <QtGlobal>

#include <optional>

Expand Down Expand Up @@ -85,6 +86,21 @@ inline Record& operator<<( Record& r, const QLatin1String s )
return r << s.data();
}

inline Record& operator<<( Record& r, const QString& data )
{
#ifdef Q_OS_WIN
return r << data.toStdWString();
#else
return r << data.toStdString();
#endif
}

inline Record& operator<<( Record& r, const QStringRef& data )
{
QString qstr;
return r << qstr.append( data );
}

inline Record& operator<<( Record& r, const std::chrono::milliseconds& duration )
{
return r << static_cast<float>( duration.count() ) / 1000.f << " ms";
Expand Down

0 comments on commit 51f6eb8

Please sign in to comment.