From Esenthel
- if enum has "_FLAG" in it's name, it means it's a "flag" enum
- flags are used to specify multiple options in one variable (most commonly UInt), where each option is assigned to a certain bit
- having such options like FLAG_1, FLAG_2, FLAG_3 you can do the following:
x = (FLAG_1 | FLAG_2); // assign to x FLAG_1 and FLAG_2 enabled
x |= FLAG_3; // enable FLAG_3
x ^= FLAG_3; // toggle FLAG_3
x &= ~FLAG_3; // disable FLAG_3
if( x&FLAG_3 ); // check if FLAG_3 is enabled
if( !(x&FLAG_3) ); // check if FLAG_3 is disabled
- If you're not familiar with bitwise operations, you can use following functions:
- FlagTest - check if a flag is enabled
- FlagEnable - enable a flag
- FlagDisable - disable a flag
- FlagToggle - toggle flag
- FlagSet - set if flag should be enabled or disabled