blob: 5a6cb93998dee4547561cee8e8b5a650155d562a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include <Corrade/Containers/StringView.h>
namespace floormat::entities::erased_constraints {
struct range final
{
using U = std::size_t;
using I = std::make_signed_t<U>;
enum type_ : unsigned char { type_none, type_float, type_uint, type_int, };
union element {
float f;
U u;
I i;
};
element min {.i = 0}, max {.i = 0};
type_ type = type_none;
template<typename T> std::pair<T, T> convert() const;
friend bool operator==(const range& a, const range& b);
};
struct max_length final {
std::size_t value = std::size_t(-1);
constexpr operator std::size_t() const { return value; }
};
struct group final {
StringView group_name;
constexpr operator StringView() const { return group_name; }
constexpr group() = default;
constexpr group(StringView name) : group_name{name} {}
};
} // namespace floormat::entities::erased_constraints
|