feat(reflect-cpp): Switched from glaze -> reflect cpp

A bug was discovered in glaze which prevented valid toml output. We have
switched to toml++ and reflect-cpp. The interface has remained the same
so this should not break any code
This commit is contained in:
2025-12-06 10:55:46 -05:00
parent 2b5abeae58
commit ec13264050
365 changed files with 63946 additions and 357 deletions

View File

@@ -0,0 +1,38 @@
#ifndef RFL_INTERNAL_TUPLE_ACCUMULATE_SIZES_HPP_
#define RFL_INTERNAL_TUPLE_ACCUMULATE_SIZES_HPP_
#include <array>
namespace rfl::internal::tuple {
template <class T>
struct SizeWrapper {};
template <unsigned long _last, unsigned long... _is>
struct Sizes {
static consteval auto to_array() {
return std::array<unsigned long, sizeof...(_is) + 1>({_is..., _last});
}
};
template <class T, unsigned long _last, unsigned long... _is>
consteval auto operator+(const Sizes<_last, _is...>& /*_sizes*/,
const SizeWrapper<T>& /*_w*/) {
if constexpr (_last % alignof(T) == 0) {
constexpr auto last_new = _last + sizeof(T);
return Sizes<last_new, _is..., _last>{};
} else {
constexpr auto last_corrected = _last + alignof(T) - (_last % alignof(T));
constexpr auto last_new = last_corrected + sizeof(T);
return Sizes<last_new, _is..., last_corrected>{};
}
}
template <class... Types>
consteval auto accumulate_sizes() {
return (Sizes<0>{} + ... + SizeWrapper<Types>{}).to_array();
}
} // namespace rfl::internal::tuple
#endif

View File

@@ -0,0 +1,30 @@
#ifndef RFL_INTERNAL_TUPLE_APPLY_HPP_
#define RFL_INTERNAL_TUPLE_APPLY_HPP_
#include <utility>
#include "../../Tuple.hpp"
namespace rfl::internal::tuple {
template <class F, class... Types, int... _is>
auto apply(F&& _f, const rfl::Tuple<Types...>& _tup,
std::integer_sequence<int, _is...>) {
return _f(rfl::get<_is>(_tup)...);
}
template <class F, class... Types, int... _is>
auto apply(F&& _f, rfl::Tuple<Types...>& _tup,
std::integer_sequence<int, _is...>) {
return _f(rfl::get<_is>(_tup)...);
}
template <class F, class... Types, int... _is>
auto apply(F&& _f, rfl::Tuple<Types...>&& _tup,
std::integer_sequence<int, _is...>) {
return _f(std::move(rfl::get<_is>(_tup))...);
}
} // namespace rfl::internal::tuple
#endif

View File

@@ -0,0 +1,38 @@
#ifndef RFL_INTERNAL_TUPLE_CALCULATE_POSITIONS_HPP_
#define RFL_INTERNAL_TUPLE_CALCULATE_POSITIONS_HPP_
#include <array>
namespace rfl::internal::tuple {
template <class T>
struct PositionWrapper {};
template <unsigned long _last, unsigned long... _is>
struct Positions {
static consteval auto to_array() {
return std::array<unsigned long, sizeof...(_is) + 1>({_is..., _last});
}
};
template <class T, unsigned long _last, unsigned long... _is>
consteval auto operator+(const Positions<_last, _is...>&,
const PositionWrapper<T>&) {
if constexpr (_last % alignof(T) == 0) {
constexpr auto last_new = _last + sizeof(T);
return Positions<last_new, _is..., _last>{};
} else {
constexpr auto last_corrected = _last + alignof(T) - (_last % alignof(T));
constexpr auto last_new = last_corrected + sizeof(T);
return Positions<last_new, _is..., last_corrected>{};
}
}
template <class... Types>
consteval auto calculate_positions() {
return (Positions<0>{} + ... + PositionWrapper<Types>{}).to_array();
}
} // namespace rfl::internal::tuple
#endif

View File

@@ -0,0 +1,56 @@
#ifndef RFL_INTERNAL_TUPLE_CONCAT_HPP_
#define RFL_INTERNAL_TUPLE_CONCAT_HPP_
#include <utility>
#include "../../Tuple.hpp"
namespace rfl::internal::tuple {
template <class... Types>
struct TupleWrapper {
rfl::Tuple<Types...> tuple_;
};
template <class... Types>
auto wrap_tuple(const rfl::Tuple<Types...>& _tuple) {
return TupleWrapper<Types...>{_tuple};
}
template <class... Types>
auto wrap_tuple(rfl::Tuple<Types...>&& _tuple) {
return TupleWrapper<Types...>{std::forward<rfl::Tuple<Types...> >(_tuple)};
}
template <class... Types1, class... Types2, int... _is, int... _js>
auto concat_two(rfl::Tuple<Types1...>&& _t1, rfl::Tuple<Types2...>&& _t2,
std::integer_sequence<int, _is...>,
std::integer_sequence<int, _js...>) {
return rfl::Tuple<Types1..., Types2...>(std::move(rfl::get<_is>(_t1))...,
std::move(rfl::get<_js>(_t2))...);
}
template <class... Types1, class... Types2>
auto operator+(TupleWrapper<Types1...>&& _t1, TupleWrapper<Types2...>&& _t2) {
return TupleWrapper<Types1..., Types2...>{
.tuple_ =
concat_two(std::move(_t1.tuple_), std::move(_t2.tuple_),
std::make_integer_sequence<int, sizeof...(Types1)>(),
std::make_integer_sequence<int, sizeof...(Types2)>())};
}
template <class Head, class... Tail>
auto concat(const Head& _head, const Tail&... _tail) {
return (wrap_tuple(_head) + ... + wrap_tuple(_tail));
}
template <class Head, class... Tail>
auto concat(Head&& _head, Tail&&... _tail) {
return (wrap_tuple(std::forward<Head>(_head)) + ... +
wrap_tuple(std::forward<Tail>(_tail)))
.tuple_;
}
} // namespace rfl::internal::tuple
#endif

View File

@@ -0,0 +1,24 @@
#ifndef RFL_INTERNAL_TUPLE_MAKE_FROM_TUPLE_HPP_
#define RFL_INTERNAL_TUPLE_MAKE_FROM_TUPLE_HPP_
#include <utility>
#include "../../Tuple.hpp"
namespace rfl::internal::tuple {
template <class T, class... Types, int... _is>
T make_from_tuple(const rfl::Tuple<Types...>& _t1,
std::integer_sequence<int, _is...>) {
return T{rfl::get<_is>(_t1)...};
}
template <class T, class... Types, int... _is>
T make_from_tuple(rfl::Tuple<Types...>&& _t1,
std::integer_sequence<int, _is...>) {
return T{std::move(rfl::get<_is>(_t1))...};
}
} // namespace rfl::internal::tuple
#endif