libqi-api
2.8.7.4
|
#include <flags.hpp>
Public Types | |
using | type = Type |
using | underlying_type = ka::Decay< decltype(underlying(std::declval< Type >()))> |
Public Member Functions | |
Flags () | |
Flags (std::initializer_list< Type > values) | |
std::bit_or ())) | |
Flags (const Type &t) | |
bool | test (const Type &t) const |
Flags & | set (const Type &t) |
Flags & | reset (const Type &t) |
Public Attributes | |
underlying_type {} | |
Friends | |
const underlying_type & | underlying (const Flags &f) |
Flags | operator& (const Flags &a, const Flags &b) |
Flags | operator| (const Flags &a, const Flags &b) |
Flags | operator^ (const Flags &a, const Flags &b) |
Flags | operator~ (const Flags &a) |
Flags & | operator|= (Flags &a, const Flags &b) |
Flags & | operator&= (Flags &a, const Flags &b) |
Flags & | operator^= (Flags &a, const Flags &b) |
Class providing type-safe flags semantics for bitwise combinable types.
Example: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ enum class BehaviorOption { MoveAround, MoveArms, Speak, }; using Opt = BehaviorOption; using F = Flags<Opt>; F flags = F({Opt::MoveAround, Opt::Speak});
// or
F flags; flags.set(Opt::MoveArms).set(Opt::MoveAround);
// or
F flags1 = F{Opt::MoveAround}; F flags2 = F{Opt::MoveArms}; F flags3 = flags2; F flags = ( flags1 | flags2 ) & flags3; // flags == flags2
// ... startBehavior(flags); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
HasUnderlying<BitmaskType> Type
using qi::Flags< Type >::underlying_type = ka::Decay<decltype(underlying(std::declval<Type>()))> |
|
inline |
|
inline |
|
friend |
qi::Flags< Type >::underlying_type {} |