mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 07:36:23 +00:00
feat(Deps/Fmt): update fmt lib to 10.1.1 (#17643)
This commit is contained in:
@@ -68,13 +68,13 @@ public:
|
||||
bool SetLogLevel(std::string const& name, int32 level, bool isLogger = true);
|
||||
|
||||
template<typename... Args>
|
||||
inline void outMessage(std::string const& filter, LogLevel const level, std::string_view fmt, Args&&... args)
|
||||
inline void outMessage(std::string const& filter, LogLevel const level, Acore::FormatString<Args...> fmt, Args&&... args)
|
||||
{
|
||||
_outMessage(filter, level, Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void outCommand(uint32 account, std::string_view fmt, Args&&... args)
|
||||
void outCommand(uint32 account, Acore::FormatString<Args...> fmt, Args&&... args)
|
||||
{
|
||||
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
|
||||
{
|
||||
@@ -176,4 +176,4 @@ private:
|
||||
#define LOG_GM(accountId__, ...) \
|
||||
sLog->outCommand(accountId__, __VA_ARGS__)
|
||||
|
||||
#endif // _LOG_H__
|
||||
#endif // _LOG_H__
|
||||
@@ -39,17 +39,20 @@ namespace Acore
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
using FormatString = fmt::format_string<Args...>;
|
||||
|
||||
// Default string format function.
|
||||
template<typename... Args>
|
||||
inline std::string StringFormatFmt(std::string_view fmt, Args&&... args)
|
||||
inline std::string StringFormatFmt(FormatString<Args...> fmt, Args&&... args)
|
||||
{
|
||||
try
|
||||
{
|
||||
return fmt::format(fmt, std::forward<Args>(args)...);
|
||||
}
|
||||
catch (const fmt::format_error& formatError)
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
return fmt::format("An error occurred formatting string \"{}\": {}", fmt, formatError.what());
|
||||
return fmt::format("Wrong format occurred ({}). Fmt string: '{}'", e.what(), fmt.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +79,9 @@ namespace Acore::String
|
||||
AC_COMMON_API std::string AddSuffixIfNotExists(std::string str, const char suffix);
|
||||
}
|
||||
|
||||
#endif
|
||||
// Add support enum for fmt
|
||||
//template <typename T, std::enable_if_t<std::is_enum_v<T>, int> = 0>
|
||||
template <typename T, FMT_ENABLE_IF(std::is_enum_v<T>)>
|
||||
auto format_as(T f) { return fmt::underlying(f); }
|
||||
|
||||
#endif
|
||||
@@ -633,8 +633,11 @@ namespace lfg
|
||||
bool m_Testing;
|
||||
};
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_enum_v<T>)>
|
||||
auto format_as(T f) { return fmt::underlying(f); }
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
#define sLFGMgr lfg::LFGMgr::instance()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -19,6 +19,7 @@
|
||||
#define PacketUtilities_h__
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Tuples.h"
|
||||
#include <string_view>
|
||||
|
||||
@@ -295,4 +296,13 @@ namespace WorldPackets
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PacketUtilities_h__
|
||||
template<std::size_t MaxBytesWithoutNullTerminator, typename... Validators>
|
||||
struct fmt::formatter<WorldPackets::String<MaxBytesWithoutNullTerminator, Validators...>> : fmt::formatter<std::string_view>
|
||||
{
|
||||
auto format(WorldPackets::String<MaxBytesWithoutNullTerminator, Validators...> const& str, format_context& ctx) const
|
||||
{
|
||||
return fmt::formatter<std::string_view>::format(std::string_view(str), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PacketUtilities_h__
|
||||
Reference in New Issue
Block a user