change clang-format
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
497f96a574
commit
f925d90d6b
33 changed files with 217 additions and 254 deletions
|
|
@ -2,16 +2,14 @@
|
|||
|
||||
#include <ranges>
|
||||
|
||||
#include <cppbase/templates.hpp>
|
||||
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
#include <cppbase/templates.hpp>
|
||||
|
||||
template<typename V>
|
||||
typename V::DataType const * ikarus_value_base_get(V * value, size_t idx) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
return &(*data)[idx];
|
||||
}
|
||||
|
|
@ -22,9 +20,7 @@ typename V::DataType const * ikarus_value_base_get(V * value, size_t idx) {
|
|||
template<typename V>
|
||||
size_t ikarus_value_base_get_size(V const * value) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
return data->size();
|
||||
}
|
||||
|
|
@ -35,9 +31,7 @@ size_t ikarus_value_base_get_size(V const * value) {
|
|||
template<typename V>
|
||||
void ikarus_value_base_set(V * value, size_t idx, typename V::DataType new_data) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
(*data)[idx] = new_data;
|
||||
}
|
||||
|
|
@ -46,9 +40,7 @@ void ikarus_value_base_set(V * value, size_t idx, typename V::DataType new_data)
|
|||
template<typename V>
|
||||
void ikarus_value_base_remove(V * value, size_t idx) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
data->erase(data->begin() + idx);
|
||||
}
|
||||
|
|
@ -57,9 +49,7 @@ void ikarus_value_base_remove(V * value, size_t idx) {
|
|||
template<typename V>
|
||||
void ikarus_value_base_insert(V * value, size_t idx, typename V::DataType new_data) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
data->insert(data->begin() + idx, new_data);
|
||||
}
|
||||
|
|
@ -68,9 +58,7 @@ void ikarus_value_base_insert(V * value, size_t idx, typename V::DataType new_da
|
|||
template<typename V>
|
||||
void ikarus_value_base_clear(V * value) {
|
||||
if (auto * data =
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(
|
||||
&value->data
|
||||
);
|
||||
boost::variant2::get_if<boost::container::small_vector<typename V::DataType, IkarusValue::SMALL_VEC_VALUE_SIZE>>(&value->data);
|
||||
data != nullptr) {
|
||||
data->clear();
|
||||
}
|
||||
|
|
@ -93,10 +81,9 @@ void ikarus_value_base_set_undefined(V * value, bool undefined) {
|
|||
template<typename V, std::invocable<typename V::DataType> F>
|
||||
char const * ikarus_value_base_to_string(V const * value, F transformer) {
|
||||
return boost::variant2::visit(
|
||||
cppbase::overloaded {
|
||||
[](boost::variant2::monostate const&) -> char const * { return nullptr; },
|
||||
[&transformer](auto const& data
|
||||
) -> char const * {
|
||||
cppbase::overloaded{
|
||||
[](boost::variant2::monostate const &) -> char const * { return nullptr; },
|
||||
[&transformer](auto const & data) -> char const * {
|
||||
auto buffer = fmt::memory_buffer{};
|
||||
|
||||
fmt::format_to(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue