Enumeration (enum) used as a set of bit flags

enum IFilterFlags {
    IFILTER_FLAG_AUTOROTATE     = (1 << 0),
    IFILTER_FLAG_REINIT         = (1 << 1),
    IFILTER_FLAG_CFR            = (1 << 2),
    IFILTER_FLAG_CROP           = (1 << 3),
    IFILTER_FLAG_DROPCHANGED    = (1 << 4),
};

This creates a group of named constants. Each constant represents a flag that can be turned on/off.

Why (1 << n) is used

Each value is defined like:

(1 << n)

This means bit shifting:

1 << 0 → 00001 → decimal 1 1 << 1 → 00010 → decimal 2 1 << 2 → 00100 → decimal 4 1 << 3 → 01000 → decimal 8 1 << 4 → 10000 → decimal 16

So each flag occupies a different bit.

The flags defined

IFILTER_FLAG_AUTOROTATE  = 1   // bit 0
IFILTER_FLAG_REINIT      = 2   // bit 1
IFILTER_FLAG_CFR         = 4   // bit 2
IFILTER_FLAG_CROP        = 8   // bit 3
IFILTER_FLAG_DROPCHANGED = 16  // bit 4

Why use bit flags instead of normal numbers

Because you can combine multiple flags in one variable using bitwise OR (|):

int flags = IFILTER_FLAG_AUTOROTATE | IFILTER_FLAG_CROP;

This sets both bits at once.

How to check a flag

Use bitwise AND (&):

if (flags & IFILTER_FLAG_CROP) {
    // crop is enabled
}

How to add/remove flags

Add:

flags |= IFILTER_FLAG_REINIT;

Remove:

flags &= ~IFILTER_FLAG_REINIT;

This enum is a bitmask configuration system:

Each constant = one bit Multiple options can be stored in one integer Efficient and common in systems programming (like multimedia libraries, OS code, etc.)