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 23a76d4 commit 33b9ef3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
42 changes: 22 additions & 20 deletions include/glaze/mustache/mustache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,43 +46,45 @@ namespace glz
}

sv key{s, size_t(it - s)};

static constexpr auto N = refl<T>.N;
static constexpr auto HashInfo = detail::hash_info<T>;

const auto index =
detail::decode_hash<T, HashInfo, HashInfo.type>::op(key.data(), key.data() + key.size());

if (index >= N) [[unlikely]] {
ctx.error = error_code::unknown_key;
return unexpected(
error_ctx{ctx.error, ctx.custom_error_message, size_t(it - start), ctx.includer_error});
}
else {
static thread_local std::string temp{};
detail::jump_table<N>([&]<size_t I>() {
static constexpr auto TargetKey = get<I>(refl<T>.keys);
static constexpr auto Length = TargetKey.size();
if (((s + Length) < end) && compare<Length>(TargetKey.data(), s)) [[likely]] {
if constexpr (detail::reflectable<T> && N > 0) {
std::ignore =
write<opt_true<Opts, &opts::raw>>(detail::get_member(value, get<I>(detail::to_tuple(value))), temp, ctx);
detail::jump_table<N>(
[&]<size_t I>() {
static constexpr auto TargetKey = get<I>(refl<T>.keys);
static constexpr auto Length = TargetKey.size();
if (((s + Length) < end) && compare<Length>(TargetKey.data(), s)) [[likely]] {
if constexpr (detail::reflectable<T> && N > 0) {
std::ignore = write<opt_true<Opts, &opts::raw>>(
detail::get_member(value, get<I>(detail::to_tuple(value))), temp, ctx);
}
else if constexpr (detail::glaze_object_t<T> && N > 0) {
std::ignore = write<opt_true<Opts, &opts::raw>>(
detail::get_member(value, get<I>(refl<T>.values)), temp, ctx);
}
}
else if constexpr (detail::glaze_object_t<T> && N > 0) {
std::ignore =
write<opt_true<Opts, &opts::raw>>(detail::get_member(value, get<I>(refl<T>.values)), temp, ctx);
else {
ctx.error = error_code::unknown_key;
}
}
else {
ctx.error = error_code::unknown_key;
}
}, index);

},
index);

if (bool(ctx.error)) [[unlikely]] {
return unexpected(
error_ctx{ctx.error, ctx.custom_error_message, size_t(it - start), ctx.includer_error});
}

result.append(temp);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/mustache_test/mustache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

#define UT_RUN_TIME_ONLY

#include "glaze/glaze.hpp"
#include "glaze/mustache/mustache.hpp"

#include "glaze/glaze.hpp"
#include "glaze/mustache/stencilcount.hpp"
#include "ut/ut.hpp"

Expand Down

0 comments on commit 33b9ef3

Please sign in to comment.