EASTL codecs for string_view and string
This commit is contained in:
@@ -9,7 +9,10 @@
|
|||||||
#include <Utils/TargetMacros.h>
|
#include <Utils/TargetMacros.h>
|
||||||
|
|
||||||
#if defined(BIGFOOT_NOT_OPTIMIZED)
|
#if defined(BIGFOOT_NOT_OPTIMIZED)
|
||||||
#include <quill/DeferredFormatCodec.h>
|
#include <quill/core/Codec.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <EASTL/string.h>
|
#include <EASTL/string.h>
|
||||||
@@ -46,11 +49,6 @@ struct fmtquill::formatter<eastl::string>
|
|||||||
return fmtquill::format_to(ctx.out(), "{}", p_string.c_str());
|
return fmtquill::format_to(ctx.out(), "{}", p_string.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
|
||||||
struct quill::Codec<eastl::string>: quill::DeferredFormatCodec<eastl::string>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// STRING_VIEW
|
// STRING_VIEW
|
||||||
@@ -84,8 +82,36 @@ struct fmtquill::formatter<eastl::string_view>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Bigfoot::Codec
|
||||||
|
{
|
||||||
|
template<class STRING>
|
||||||
|
struct string_view: quill::Codec<std::string_view>
|
||||||
|
{
|
||||||
|
using Base = quill::Codec<std::string_view>;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
static size_t compute_encoded_size(quill::detail::SizeCacheVector& p_cache, const STRING& p_arg) noexcept
|
||||||
|
{
|
||||||
|
return Base::compute_encoded_size(p_cache, std::string_view {p_arg.data(), p_arg.size()});
|
||||||
|
}
|
||||||
|
|
||||||
|
static void encode(std::byte*& p_buffer,
|
||||||
|
const quill::detail::SizeCacheVector& p_cache,
|
||||||
|
std::uint32_t& p_cacheIndex,
|
||||||
|
const STRING& p_arg) noexcept
|
||||||
|
{
|
||||||
|
Base::encode(p_buffer, p_cache, p_cacheIndex, std::string_view {p_arg.data(), p_arg.size()});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct quill::Codec<eastl::string_view>: quill::DeferredFormatCodec<eastl::string_view>
|
struct quill::Codec<eastl::string>: Bigfoot::Codec::string_view<eastl::string>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct quill::Codec<eastl::string_view>: Bigfoot::Codec::string_view<eastl::string_view>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user