1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-19 19:39:41 +00:00

Merge branch 'simplify_log' into 'master'

Remove redundant operator<< overloads from Log

See merge request OpenMW/openmw!2689
This commit is contained in:
psi29a 2023-02-06 23:10:03 +00:00
commit b90f3f8c14
2 changed files with 5 additions and 46 deletions

View file

@ -39,22 +39,6 @@ Log::~Log()
sLock.unlock();
}
Log& Log::operator<<(const std::filesystem::path&& rhs)
{
if (mShouldLog)
std::cout << Files::pathToUnicodeString(std::move(rhs));
return *this;
}
Log& Log::operator<<(std::filesystem::path&& rhs)
{
if (mShouldLog)
std::cout << Files::pathToUnicodeString(std::move(rhs));
return *this;
}
Log& Log::operator<<(const std::filesystem::path& rhs)
{
if (mShouldLog)
@ -63,26 +47,10 @@ Log& Log::operator<<(const std::filesystem::path& rhs)
return *this;
}
Log& Log::operator<<(std::filesystem::path& rhs)
Log& Log::operator<<(const std::u8string& rhs)
{
if (mShouldLog)
std::cout << Files::pathToUnicodeString(rhs);
return *this;
}
Log& Log::operator<<(const std::u8string&& rhs)
{
if (mShouldLog)
std::cout << Misc::StringUtils::u8StringToString(std::move(rhs));
return *this;
}
Log& Log::operator<<(std::u8string&& rhs)
{
if (mShouldLog)
std::cout << Misc::StringUtils::u8StringToString(std::move(rhs));
std::cout << Misc::StringUtils::u8StringToString(rhs);
return *this;
}

View file

@ -27,27 +27,18 @@ public:
explicit Log(Debug::Level level);
~Log();
// Perfect forwarding wrappers to give the chain of objects to cout
template <typename T>
Log& operator<<(T&& rhs)
Log& operator<<(const T& rhs)
{
if (mShouldLog)
std::cout << std::forward<T>(rhs);
std::cout << rhs;
return *this;
}
Log& operator<<(const std::filesystem::path&& rhs);
Log& operator<<(std::filesystem::path&& rhs);
Log& operator<<(const std::filesystem::path& rhs);
Log& operator<<(std::filesystem::path& rhs);
Log& operator<<(const std::u8string&& rhs);
Log& operator<<(std::u8string&& rhs);
Log& operator<<(const std::u8string& rhs);
Log& operator<<(std::u8string_view rhs);