Template Struct flags#

Struct Documentation#

template<typename TEnum>
struct flags#

Generic flags type class based on flags defined in an enum.

Template Parameters:

TEnum – The enum type that is used to define flags.

Public Types

using enum_type = std::underlying_type_t<TEnum>#

The enum base type.

Public Functions

flags() = default#

Default constructor.

flags(const flags &rflags) = default#

Copy constructor.

Parameters:

rflags[in] Reference to the flags to copy from.

inline flags(flags &&rflags)#

Move constructor.

Parameters:

rflags[in] Reference to the flags to move from.

inline explicit flags(enum_type tValue)#

Constructor with flags value assignment.

Parameters:

tValue[in] The flags value to assign.

inline flags(TEnum eValue)#

Constructor with single value assignment.

Parameters:

eValue[in] The single value to assign.

inline flags(std::initializer_list<TEnum> init)#

Constructor with initializer list.

Parameters:

init[in] The initializer list.

flags &operator=(const flags &rflags) = default#

Flags class assignment.

Parameters:

rflags[in] Reference to the flags to copy from.

Returns:

Returns a reference to this class.

inline flags &operator=(flags &&rflags)#

Flags move assignment.

Parameters:

rflags[in] Reference to the flags to move from.

Returns:

Returns a reference to this class.

inline flags &operator=(enum_type tValue)#

Flags value assignment.

Parameters:

tValue[in] The flags value to assign.

Returns:

Returns a reference to this class.

inline flags &operator=(TEnum eValue)#

Single value assignment.

Parameters:

eValue[in] The single value to assign.

Returns:

Returns a reference to this class.

inline operator enum_type() const#

Cast operator.

Returns:

The flags value.

inline flags &operator+=(TEnum eValue)#

Add a flag.

Parameters:

eValue[in] The flag value to set.

Returns:

Reference to this class.

inline flags &operator-=(TEnum eValue)#

Remove a flag.

Parameters:

eValue[in] The flag value to remove.

Returns:

Reference to this class.

inline flags operator+(TEnum eValue)#

Add a flag to a value copy.

Parameters:

eValue[in] The flag value to set.

Returns:

The result flags.

inline flags operator-(TEnum eValue)#

Remove a flag from a value copy.

Parameters:

eValue[in] The flag value to remove.

Returns:

The result flags.

inline bool operator&(TEnum eValue) const#

Check the flags for the availability of the flag.

Parameters:

eValue[in] The flag to check for.

Returns:

Returns whether the flag was set or not.

inline enum_type get() const#

Return the flags value.

Returns:

The flags value.

inline void add(TEnum eValue)#

Add a flag.

Parameters:

eValue[in] The flag value to set.

inline void remove(TEnum eValue)#

Remove a flag.

Parameters:

eValue[in] The flag value to remove.

inline bool check(TEnum eValue) const#

Check the flags for the availability of the flag.

Parameters:

eValue[in] The flag to check for.

Returns:

Returns whether the flag was set or not.

inline bool check_any(flags flagsValue) const#

Check the flags for the availability of at least one flag.

Parameters:

flagsValue[in] The flags to use for the check.

Returns:

Returns whether at least one flag was set.

inline bool check_all(flags flagsValue) const#

Check the flags for the availability of all supplied flags.

Remark

Check for the supplied flags. Additional flags might also be set, but have no influence on the outcome.

Parameters:

flagsValue[in] The flags to use for the check.

Returns:

Returns whether all supplied flags were set.

Public Members

enum_type _tValue = 0#

The flag value.