libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
Type-safe container for enum-based bitfields. More...
Public Types | |
using | Type = std::underlying_type_t< E > |
The underlying data type of the enum. | |
Public Member Functions | |
constexpr | Flags () |
Construct a Flags instance with a zero value. | |
constexpr | Flags (E flag) |
Construct a Flags instance storing the flag. More... | |
constexpr Flags & | operator|= (E flag) |
Store the bitwise OR of this Flags and the flag in this Flags. More... | |
constexpr Flags & | operator|= (Flags other) |
Store the bitwise OR of this Flags and the other Flags in this Flags. More... | |
constexpr Flags & | operator^= (E flag) |
Store the bitwise XOR of this Flags and the flag in this Flags. More... | |
constexpr Flags & | operator^= (Flags other) |
Store the bitwise XOR of this Flags and the other Flags in this Flags. More... | |
constexpr bool | operator== (E flag) |
Compare flags for equality. More... | |
constexpr bool | operator== (Flags other) |
Compare flags for equality. More... | |
constexpr bool | operator!= (E flag) |
Compare flags for non-equality. More... | |
constexpr bool | operator!= (Flags other) |
Compare flags for non-equality. More... | |
constexpr | operator Type () const |
Convert the Flags to the underlying integer type. More... | |
constexpr | operator bool () const |
Convert the Flags to a boolean. More... | |
constexpr Flags | operator| (E flag) const |
Compute the bitwise OR of this Flags and the flag. More... | |
constexpr Flags | operator| (Flags other) const |
Compute the bitwise OR of this Flags and the other Flags. More... | |
constexpr Flags | operator^ (E flag) const |
Compute the bitwise XOR of this Flags and the flag. More... | |
constexpr Flags | operator^ (Flags other) const |
Compute the bitwise XOR of this Flags and the other Flags. More... | |
constexpr Flags | operator~ () const |
Compute the bitwise NOT of this Flags. More... | |
constexpr bool | operator! () const |
Check if flags are set. More... | |
Type-safe container for enum-based bitfields.
The Flags template class provides type-safe bitwise operators on enum values. It allows using enum types for bitfields, while preventing unsafe casts from integer types and mixing of flags from different enum types.
To use the Flags class, declare an enum containing the desired bit flags, and use the Flags<enum> class to store bitfields based on the enum. If bitwise operators on the underlying enum are also desired, they can be enabled with the LIBCAMERA_FLAGS_ENABLE_OPERATORS(enum) macro.
|
inline |
Construct a Flags instance storing the flag.
[in] | flag | The initial value |
|
inlineexplicit |
Convert the Flags to a boolean.
|
inlineexplicit |
|
inline |
Check if flags are set.
|
inline |
Compare flags for non-equality.
[in] | flag | The second operand |
|
inline |
Compare flags for non-equality.
[in] | other | The second operand |
|
inline |
Compare flags for equality.
[in] | flag | The second operand |
|
inline |
Compare flags for equality.
[in] | other | The second operand |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |