updated build system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2024-08-05 19:38:13 -05:00
parent 760a1e4322
commit dca0752189
13 changed files with 910 additions and 337 deletions

View File

@ -24,6 +24,8 @@
#include "utils/config.hpp"
#include "utils/string.hpp"
namespace repertory::utils::collection {
template <typename col_t>
[[nodiscard]] inline auto
@ -94,21 +96,6 @@ inline auto remove_element(col_t &collection,
return collection;
}
template <typename col_t, typename string_t>
[[nodiscard]] inline auto to_hex_string_t(const col_t &collection) -> string_t {
static_assert(sizeof(typename col_t::value_type) == 1U,
"value_type must be 1 byte in size");
static constexpr const auto mask = 0xFF;
std::basic_stringstream<typename string_t::value_type> stream{};
for (auto &&val : collection) {
stream << std::setfill('0') << std::setw(2) << std::hex
<< (static_cast<std::uint32_t>(val) & mask);
}
return stream.str();
}
template <typename val_t>
inline auto from_hex_string(std::string_view str, val_t &val) -> bool {
return from_hex_string_t<val_t, std::string>(str, val);
@ -121,12 +108,22 @@ inline auto from_hex_string(std::wstring_view str, val_t &val) -> bool {
template <typename col_t>
inline auto to_hex_string(const col_t &collection) -> std::string {
return to_hex_string_t<col_t, std::string>(collection);
static_assert(sizeof(typename col_t::value_type) == 1U,
"value_type must be 1 byte in size");
static constexpr const auto mask = 0xFF;
std::stringstream stream{};
for (auto &&val : collection) {
stream << std::setfill('0') << std::setw(2) << std::hex
<< (static_cast<std::uint32_t>(val) & mask);
}
return stream.str();
}
template <typename col_t>
inline auto to_hex_wstring(const col_t &collection) -> std::wstring {
return to_hex_string_t<col_t, std::wstring>(collection);
return utils::string::from_utf8(to_hex_string<col_t>(collection));
}
} // namespace repertory::utils::collection