C# Класс Nez.Flags

utility class to assist with dealing with bitmasks. All methods except isFlagSet expect the flag parameter to be a non-shifted flag. This lets you use plain old ints (0, 1, 2, 3, etc) to set/unset your flags.
Показать файл Открыть проект

Открытые методы

Метод Описание
binaryStringRepresentation ( this self, int leftPadWidth = 10 ) : string

prints the binary representation of the int. Handy for debugging int flag overlaps visually.

invertFlags ( int &self ) : void

inverts the set bits of the int

isFlagSet ( this self, int flag ) : bool

checks to see if the bit flag is set in the int. This check expects flag to be shifted already!

isUnshiftedFlagSet ( this self, int flag ) : bool

checks to see if the bit flag is set in the int

setFlag ( int &self, int flag ) : void

sets the flag bit of the int

setFlagExclusive ( int &self, int flag ) : void

sets the flag bit of the int removing any already set flags

unsetFlag ( int &self, int flag ) : void

unsets the flag bit of the int

Описание методов

binaryStringRepresentation() публичный статический Метод

prints the binary representation of the int. Handy for debugging int flag overlaps visually.
public static binaryStringRepresentation ( this self, int leftPadWidth = 10 ) : string
self this Self.
leftPadWidth int Left pad width.
Результат string

invertFlags() публичный статический Метод

inverts the set bits of the int
public static invertFlags ( int &self ) : void
self int Self.
Результат void

isFlagSet() публичный статический Метод

checks to see if the bit flag is set in the int. This check expects flag to be shifted already!
public static isFlagSet ( this self, int flag ) : bool
self this Self.
flag int Flag.
Результат bool

isUnshiftedFlagSet() публичный статический Метод

checks to see if the bit flag is set in the int
public static isUnshiftedFlagSet ( this self, int flag ) : bool
self this Self.
flag int Flag.
Результат bool

setFlag() публичный статический Метод

sets the flag bit of the int
public static setFlag ( int &self, int flag ) : void
self int Self.
flag int Flag.
Результат void

setFlagExclusive() публичный статический Метод

sets the flag bit of the int removing any already set flags
public static setFlagExclusive ( int &self, int flag ) : void
self int Self.
flag int Flag.
Результат void

unsetFlag() публичный статический Метод

unsets the flag bit of the int
public static unsetFlag ( int &self, int flag ) : void
self int Self.
flag int Flag.
Результат void