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.
파일 보기 프로젝트 열기: prime31/Nez

공개 메소드들

메소드 설명
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