The enum_flags class template is used to store OR-combinations of enum values in a type-safe way. More...
#include <enum_flags.h>
Public Types | |
using | enum_type = detail::conditional_t< std::is_signed< typename std::underlying_type< Enum >::type >::value, int32_t, uint32_t > |
using | type = Enum |
using | zero = enum_type * |
Public Member Functions | |
constexpr | enum_flags (zero=nullptr) noexcept |
Creates an enum_flags object with no flags set. More... | |
constexpr | enum_flags (Enum flag) noexcept |
Creates a enum_flags object with the given flag flag . More... | |
constexpr | enum_flags (detail::enum_flag v) noexcept |
Creates an enum_flags object initialized with the given integer value value . More... | |
constexpr | operator enum_type () const noexcept |
Performs a bitwise XOR operation with f and store the result in this object. More... | |
constexpr bool | operator! () const noexcept |
This will test whether a flag was set or not. More... | |
constexpr enum_flags | operator& (Enum f) const noexcept |
Performs a bitwise AND operation on this object and f and return the result as new enum_flags object. More... | |
constexpr enum_flags | operator& (int mask) const noexcept |
Performs a bitwise AND operation on this object and mask and return the result as new enum_flags object. More... | |
constexpr enum_flags | operator& (uint32_t mask) const noexcept |
Performs a bitwise AND operation on this object and mask and return the result as new enum_flags object. More... | |
constexpr enum_flags & | operator&= (int mask) noexcept |
Performs a bitwise AND operation with mask and store the result in this object. More... | |
constexpr enum_flags & | operator&= (uint32_t mask) noexcept |
Performs a bitwise AND operation with mask and store the result in this object. More... | |
constexpr enum_flags & | operator&= (Enum mask) noexcept |
Performs a bitwise AND operation with mask and store the result in this object. More... | |
constexpr enum_flags | operator^ (Enum f) const noexcept |
Performs a bitwise XOR operation on this object and f and return the result as new enum_flags object. More... | |
constexpr enum_flags | operator^ (enum_flags f) const noexcept |
Performs a bitwise XOR operation on this object and f and return the result as new enum_flags object. More... | |
constexpr enum_flags & | operator^= (enum_flags f) noexcept |
Performs a bitwise XOR operation with f and store the result in this object. More... | |
constexpr enum_flags & | operator^= (Enum f) noexcept |
Performs a bitwise XOR operation with f and store the result in this object. More... | |
constexpr enum_flags | operator| (Enum f) const noexcept |
Performs a bitwise OR operation on this object and f and return the result as new enum_flags object. More... | |
constexpr enum_flags | operator| (enum_flags f) const noexcept |
Performs a bitwise OR operation on this object and f and return the result as new enum_flags object. More... | |
constexpr enum_flags & | operator|= (enum_flags f) noexcept |
Performs a bitwise OR operation with f and store the result in this object. More... | |
constexpr enum_flags & | operator|= (Enum f) noexcept |
Performs a bitwise OR operation with f and store the result in this object. More... | |
constexpr enum_flags | operator~ () const noexcept |
Performs a bitwise negation of the current object and return the result as new enum_flags object. More... | |
constexpr bool | test_flag (Enum flag) const noexcept |
This will test whether the given flag flag was set. More... | |
Detailed Description
template<typename Enum>
class rttr::enum_flags< Enum >
The enum_flags class template is used to store OR-combinations of enum values in a type-safe way.
The values are stored internally inside an integer (unsigned or signed, depending on the underlying type of the enum). Using values from other enums or raw integer (except 0) with this class will result in a compile time error.
In order to use this class with your own enum, use RTTR_DECLARE_FLAGS() and RTTR_DECLARE_ENUM_FLAGS_OPERATORS().
Typical Usage
Member Typedef Documentation
using rttr::enum_flags< Enum >::enum_type = detail::conditional_t<std::is_signed<typename std::underlying_type<Enum>::type>::value, int32_t, uint32_t> |
using rttr::enum_flags< Enum >::type = Enum |
using rttr::enum_flags< Enum >::zero = enum_type* |
Constructor & Destructor Documentation
|
noexcept |
Creates an enum_flags object with no flags set.
|
noexcept |
Creates a enum_flags object with the given flag flag
.
|
noexcept |
Creates an enum_flags object initialized with the given integer value value
.
- Remarks
- enum_flag is a wrapper class around an integer to avoid creation of enum_flags object from enum values.
Member Function Documentation
|
noexcept |
Performs a bitwise XOR
operation with f
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
This will test whether a flag was set or not.
- Returns
true
, when no flag is set, otherwisefalse
.
|
noexcept |
Performs a bitwise AND
operation on this object and f
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
AND
operation on this object andf
.
|
noexcept |
Performs a bitwise AND
operation on this object and mask
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
AND
operation on this object andmask
.
|
noexcept |
Performs a bitwise AND
operation on this object and mask
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
AND
operation on this object andmask
.
|
noexcept |
Performs a bitwise AND
operation with mask
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise AND
operation with mask
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise AND
operation with mask
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise XOR
operation on this object and f
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
XOR
operation on this object andf
.
|
noexcept |
Performs a bitwise XOR
operation on this object and f
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
XOR
operation on this object andf
.
|
noexcept |
Performs a bitwise XOR
operation with f
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise XOR
operation with f
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise OR
operation on this object and f
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
OR
operation on this object andf
.
|
noexcept |
Performs a bitwise OR
operation on this object and f
and return the result as new enum_flags object.
- Returns
- A enum_flags object containing the result of the bitwise
OR
operation on this object andf
.
|
noexcept |
Performs a bitwise OR
operation with f
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise OR
operation with f
and store the result in this object.
- Returns
- A reference to this object.
|
noexcept |
Performs a bitwise negation of the current object and return the result as new enum_flags object.
- Returns
- A enum_flags object that contains the bitwise negation of this object.
|
noexcept |
This will test whether the given flag flag
was set.
- Returns
true
, when the flag is set, otherwisefalse
.
The documentation for this class was generated from the following file: