JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
juce_EnumHelpers.h File Reference

Go to the source code of this file.

Namespaces

namespace  juce
 JUCE Namespace.
 

Macros

#define JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS(EnumType)
 Macro to enable bitwise operations for scoped enums (enum struct/class).
 

Functions

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
constexpr bool juce::hasBitValueSet (EnumType enumValue, EnumType valueToLookFor) noexcept
 
template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
constexpr EnumType juce::withBitValueSet (EnumType enumValue, EnumType valueToAdd) noexcept
 
template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
constexpr EnumType juce::withBitValueCleared (EnumType enumValue, EnumType valueToRemove) noexcept
 

Macro Definition Documentation

◆ JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS

#define JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS (   EnumType)

Macro to enable bitwise operations for scoped enums (enum struct/class).

To use this, add the line JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS (MyEnum) after your enum declaration at file scope level.

e.g.

enum class MyEnum
{
one = 1 << 0,
two = 1 << 1,
three = 1 << 2
};
MyEnum e = MyEnum::one | MyEnum::two;
bool hasTwo = (e & MyEnum::two) != MyEnum{}; // true
bool hasTwo = hasBitValueSet (e, MyEnum::two); // true
e = withBitValueCleared (e, MyEnum::two);
bool hasTwo = hasBitValueSet (e, MyEnum::two); // false
#define JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS(EnumType)
Macro to enable bitwise operations for scoped enums (enum struct/class).

Definition at line 52 of file juce_EnumHelpers.h.