aboutsummaryrefslogtreecommitdiff
path: root/src/zencore
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-08-11 16:39:45 +0200
committerGitHub <[email protected]>2023-08-11 16:39:45 +0200
commitbf4738df5cad0eaa61f4e24b8db7611e378f9f80 (patch)
tree6f0ada74fc5c49b71b64f7731c0681ef544bea65 /src/zencore
parent0.2.16-pre0 (diff)
downloadzen-bf4738df5cad0eaa61f4e24b8db7611e378f9f80.tar.xz
zen-bf4738df5cad0eaa61f4e24b8db7611e378f9f80.zip
update vcpkg dependencies (#356)
* bump vcpkg version * fmt lib 10 fixes * xmake dependencies (with linux workarounds) * changelog
Diffstat (limited to 'src/zencore')
-rw-r--r--src/zencore/include/zencore/fmtutils.h11
-rw-r--r--src/zencore/include/zencore/string.h32
-rw-r--r--src/zencore/thread.cpp1
3 files changed, 43 insertions, 1 deletions
diff --git a/src/zencore/include/zencore/fmtutils.h b/src/zencore/include/zencore/fmtutils.h
index 5c5169cd6..a927df866 100644
--- a/src/zencore/include/zencore/fmtutils.h
+++ b/src/zencore/include/zencore/fmtutils.h
@@ -2,6 +2,7 @@
#pragma once
+#include <zencore/filesystem.h>
#include <zencore/guid.h>
#include <zencore/iohash.h>
#include <zencore/string.h>
@@ -11,7 +12,6 @@ ZEN_THIRD_PARTY_INCLUDES_START
#include <fmt/format.h>
ZEN_THIRD_PARTY_INCLUDES_END
-#include <filesystem>
#include <string_view>
// Custom formatting for some zencore types
@@ -63,3 +63,12 @@ struct fmt::formatter<std::filesystem::path> : formatter<string_view>
return fmt::formatter<string_view>::format(String.ToView(), ctx);
}
};
+
+template<typename T>
+struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::PathBuilderBase, T>::value, char>> : fmt::formatter<std::string_view>
+{
+ auto format(const zen::PathBuilderBase& a, format_context& ctx) const
+ {
+ return fmt::formatter<std::string_view>::format(a.ToView(), ctx);
+ }
+};
diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h
index 7a44bf781..b26407005 100644
--- a/src/zencore/include/zencore/string.h
+++ b/src/zencore/include/zencore/string.h
@@ -17,6 +17,10 @@
#include <type_traits>
+ZEN_THIRD_PARTY_INCLUDES_START
+#include <fmt/format.h>
+ZEN_THIRD_PARTY_INCLUDES_END
+
namespace zen {
//////////////////////////////////////////////////////////////////////////
@@ -302,6 +306,16 @@ public:
return AppendAscii(Str);
}
+#if defined(__clang__) && !defined(__APPLE__)
+ /* UE Toolchain Clang has different types for int64_t and long long so an override is
+ needed here. Without it, Clang can't disambiguate integer overloads */
+ inline StringBuilderImpl& operator<<(long long n)
+ {
+ IntNum Str(n);
+ return AppendAscii(Str);
+ }
+#endif
+
inline StringBuilderImpl& operator<<(const char* str) { return AppendAscii(str); }
inline StringBuilderImpl& operator<<(const std::string_view str) { return AppendAscii(str); }
inline StringBuilderImpl& operator<<(const std::u8string_view str) { return AppendAscii(str); }
@@ -1112,3 +1126,21 @@ private:
void string_forcelink(); // internal
} // namespace zen
+
+template<typename T>
+struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::StringBuilderBase, T>::value, char>> : fmt::formatter<std::string_view>
+{
+ auto format(const zen::StringBuilderBase& a, format_context& ctx) const
+ {
+ return fmt::formatter<std::string_view>::format(a.ToView(), ctx);
+ }
+};
+
+template<typename T>
+struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::NiceBase, T>::value, char>> : fmt::formatter<std::string_view>
+{
+ auto format(const zen::NiceBase& a, format_context& ctx) const
+ {
+ return fmt::formatter<std::string_view>::format(std::string_view(a), ctx);
+ }
+};
diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp
index b225c8aff..d95f5d542 100644
--- a/src/zencore/thread.cpp
+++ b/src/zencore/thread.cpp
@@ -4,6 +4,7 @@
#include <zencore/except.h>
#include <zencore/filesystem.h>
+#include <zencore/fmtutils.h>
#include <zencore/scopeguard.h>
#include <zencore/string.h>
#include <zencore/testing.h>