Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenberry committed Sep 17, 2024
1 parent ecf7910 commit eecdf5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
22 changes: 11 additions & 11 deletions include/glaze/core/refl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1639,17 +1639,17 @@ namespace glz::detail
return std::memchr(it, '"', size_t(end - it));
}
}

template <class T, auto HashInfo, hash_type Type>
struct decode_hash;

template <class T, auto HashInfo>
struct decode_hash<T, HashInfo, hash_type::unique_index>
{
static constexpr auto N = refl<T>.N;
static constexpr auto bsize = bucket_size(hash_type::unique_index, N);
static constexpr auto uindex = HashInfo.unique_index;

GLZ_ALWAYS_INLINE static constexpr size_t op(auto&& it, auto&& end) noexcept
{
if constexpr (HashInfo.sized_hash) {
Expand Down Expand Up @@ -1695,13 +1695,13 @@ namespace glz::detail
}
}
};

template <class T, auto HashInfo>
struct decode_hash<T, HashInfo, hash_type::three_element_unique_index>
{
static constexpr auto N = refl<T>.N;
static constexpr auto uindex = HashInfo.unique_index;

GLZ_ALWAYS_INLINE static constexpr size_t op(auto&& it, auto&& end) noexcept
{
if constexpr (uindex > 0) {
Expand All @@ -1720,13 +1720,13 @@ namespace glz::detail
}
}
};

template <class T, auto HashInfo>
struct decode_hash<T, HashInfo, hash_type::front_hash>
{
static constexpr auto N = refl<T>.N;
static constexpr auto bsize = bucket_size(hash_type::front_hash, N);

GLZ_ALWAYS_INLINE static constexpr size_t op(auto&& it, auto&& end) noexcept
{
if constexpr (HashInfo.front_hash_bytes == 2) {
Expand Down Expand Up @@ -1782,13 +1782,13 @@ namespace glz::detail
}
}
};

template <class T, auto HashInfo>
struct decode_hash<T, HashInfo, hash_type::unique_per_length>
{
static constexpr auto N = refl<T>.N;
static constexpr auto bsize = bucket_size(hash_type::unique_per_length, N);

GLZ_ALWAYS_INLINE static constexpr size_t op(auto&& it, auto&& end) noexcept
{
const auto* c = quote_memchr<HashInfo.min_length>(it, end);
Expand All @@ -1806,13 +1806,13 @@ namespace glz::detail
}
}
};

template <class T, auto HashInfo>
struct decode_hash<T, HashInfo, hash_type::full_flat>
{
static constexpr auto N = refl<T>.N;
static constexpr auto bsize = bucket_size(hash_type::full_flat, N);

GLZ_ALWAYS_INLINE static constexpr size_t op(auto&& it, auto&& end) noexcept
{
const auto* c = quote_memchr<HashInfo.min_length>(it, end);
Expand Down
8 changes: 5 additions & 3 deletions include/glaze/json/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ namespace glz

if constexpr ((num_members > 0) && (glaze_object_t<T> || reflectable<T>)) {
static constexpr auto HashInfo = hash_info<T>;

invoke_table<N>([&]<size_t I>() {
if (bool(ctx.error)) [[unlikely]] {
return;
Expand All @@ -1560,7 +1560,8 @@ namespace glz
dump<quoted_key>(b, ix);

static constexpr auto sub_partial = get<1>(group);
static constexpr auto index = decode_hash<T, HashInfo, HashInfo.type>::op(key.data(), key.data() + key.size());
static constexpr auto index =
decode_hash<T, HashInfo, HashInfo.type>::op(key.data(), key.data() + key.size());
static_assert(index < num_members, "Invalid key passed to partial write");
if constexpr (glaze_object_t<T>) {
static constexpr auto member = get<index>(refl<T>.values);
Expand All @@ -1571,7 +1572,8 @@ namespace glz
}
}
else {
write_partial<json>::op<sub_partial, Opts>(get_member(value, get<index>(to_tuple(value))), ctx, b, ix);
write_partial<json>::op<sub_partial, Opts>(get_member(value, get<index>(to_tuple(value))), ctx, b,
ix);
if constexpr (I != N - 1) {
write_object_entry_separator<Opts>(ctx, b, ix);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/json_test/json_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8133,7 +8133,7 @@ suite partial_write_tests = [] {
expect(!ec);
expect(s == R"({"animals":{"tiger":"Tiger"},"name":"My Awesome Zoo"})") << s;
};

"partial write const qualified"_test = [] {
static constexpr auto partial = glz::json_ptrs("/name", "/animals/tiger");

Expand All @@ -8143,7 +8143,7 @@ suite partial_write_tests = [] {
expect(!ec);
expect(s == R"({"animals":{"tiger":"Tiger"},"name":"My Awesome Zoo"})") << s;
};

"reflection partial write const qualified"_test = [] {
static constexpr auto partial = glz::json_ptrs("/name", "/animals/tiger");

Expand Down

0 comments on commit eecdf5c

Please sign in to comment.