14#include <egt/detail/enum.h>
15#include <egt/detail/meta.h>
16#include <egt/detail/string.h>
17#include <egt/signal.h>
28template<
class T>
class BitFields;
44 constexpr BitField(uint32_t mask, uint32_t value) noexcept
129 return !(*
this == rhs);
137 EGT_NODISCARD
constexpr bool is_set(
const T& field)
const noexcept
139 const auto& f =
static_cast<const BitField&
>(field);
146 const auto& f =
static_cast<const BitField&
>(field);
153 const auto& f =
static_cast<const BitField&
>(field);
179 std::ostringstream ss;
183 const auto container =
get(*
this);
184 for (
const auto& item : container)
204 std::vector<std::string> tokens;
206 for (
const auto& field : tokens)
Definition bitfields.h:31
uint32_t m_value
Definition bitfields.h:55
constexpr bool operator==(const BitField &rhs) const noexcept
Definition bitfields.h:38
constexpr BitField(uint32_t bit) noexcept
Definition bitfields.h:49
constexpr BitField operator|(const BitField &rhs) const noexcept
Definition bitfields.h:33
constexpr BitField(uint32_t mask, uint32_t value) noexcept
Definition bitfields.h:44
uint32_t m_mask
Definition bitfields.h:54
Definition bitfields.h:65
EGT_NODISCARD constexpr bool is_set(const T &field) const noexcept
Definition bitfields.h:137
BitFields & operator=(const BitFields &rhs)
Assignment operator.
Definition bitfields.h:107
constexpr BitFields< T > operator|(const T &field) const noexcept
Or operator.
Definition bitfields.h:164
static constexpr const char BITFIELDS_DELIMITER
Delimiter used to separate bit-fields in string representation.
Definition bitfields.h:172
bool clear(const T &field)
Clear a single bit-field.
Definition bitfields.h:151
void from_string(const std::string &str)
Convert from string.
Definition bitfields.h:201
bool empty() const
Definition bitfields.h:132
EGT_NODISCARD std::string to_string() const
Convert the bit-fields to strings.
Definition bitfields.h:177
bool update(uint32_t new_word)
Definition bitfields.h:212
Signal on_change
Event signal.
Definition bitfields.h:74
constexpr BitFields(const T &field)
Definition bitfields.h:93
BitFields(BitFields &&) noexcept=default
constexpr BitFields() noexcept=default
bool clear()
Clear all bit-fields.
Definition bitfields.h:158
constexpr BitFields(const BitFields &rhs) noexcept
Copy constructor.
Definition bitfields.h:99
BitFields(const char *str)
Definition bitfields.h:88
bool operator!=(const BitFields &rhs) const
Definition bitfields.h:127
uint32_t m_word
Definition bitfields.h:222
bool set(const T &field)
Set a single bit-field.
Definition bitfields.h:144
Signal class used for defining a signal and dispatching events.
Definition signal.h:30
void invoke(Args... args)
Invoke all handlers with the specified args.
Definition signal.h:85
EGT_API std::string trim(const std::string &source, const std::string &t=" \t\n\r")
Trim delimiters off both sides of a std::string.
EGT_API void tokenize(const std::string &str, char delimiter, std::vector< std::string > &tokens)
Tokenize a std::string.
constexpr bool change_if_diff(T &old, const T &to)
Utility to test and change a value if it is different.
Definition meta.h:194
constexpr const char * enum_to_string(T const &e)
Convert an enum to a string.
Definition enum.h:55
std::list< T > get(const BitFields< T > &fields)
EGT framework namespace.
Definition animation.h:24