C# Class 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.
Afficher le fichier Open project: prime31/Nez

Méthodes publiques

Méthode Description
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

Method Details

binaryStringRepresentation() public static méthode

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.
Résultat string

invertFlags() public static méthode

inverts the set bits of the int
public static invertFlags ( int &self ) : void
self int Self.
Résultat void

isFlagSet() public static méthode

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.
Résultat bool

isUnshiftedFlagSet() public static méthode

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.
Résultat bool

setFlag() public static méthode

sets the flag bit of the int
public static setFlag ( int &self, int flag ) : void
self int Self.
flag int Flag.
Résultat void

setFlagExclusive() public static méthode

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.
Résultat void

unsetFlag() public static méthode

unsets the flag bit of the int
public static unsetFlag ( int &self, int flag ) : void
self int Self.
flag int Flag.
Résultat void