W3cubDocs

/Haxe C#

Flags<T>(T)

package cs

from T to T

Available on cs

Use this type to have access to the bitwise operators of C# enums that have a cs.system.FlagsAttribute attribute.

Usage example:

	import cs.system.reflection.BindingFlags;
	var binding = new Flags(BindingFlags.Public) | BindingFlags.Static | BindingFlags.NonPublic;

Constructor

@:impl @:extern inline new (?initial:Null<T>)

Creates a new Flags type with an optional initial value. If no initial value was specified, the default enum value for an empty flags attribute is specified

Methods

@:impl @:op(A | B) @:extern inline add (this:T ):Flags<T>

Accessible through the bitwise OR operator (` ). Returns a new Flags` type with the flags

passed at flags added to it.

@:impl @:op(A & B) @:extern inline bitAnd (this:T ):Flags<T>

Accessible through the bitwise AND operator (&). Returns a new Flags type with the flags that are set on both this and flags

@:impl @:op(~A) @:extern inline bitNeg ():Flags<T>

Accesible through the bitwise negation operator (~). Returns a new Flags type with all unset flags as set - but the ones that are set already.

@:impl @:op(A ^ B) @:extern inline bitXor (this:T ):Flags<T>

Accessible through the bitwise XOR operator (^).

@:impl @:extern inline has (this:T ):Bool

Returns whether flag is present on this type

@:impl @:extern inline hasAll (this:T ):Bool

Returns whether this type has all flags set by flags also set

@:impl @:extern inline hasAny (this:T ):Bool

Returns whether this type has any flag set by flags also set

@:impl @:extern inline remove (this:T ):Flags<T>

Returns a new Flags type with all flags set by flags unset

Static methods

@:impl @:extern static inline new (?initial:Null<T>)

Creates a new Flags type with an optional initial value. If no initial value was specified, the default enum value for an empty flags attribute is specified

@:impl @:op(A | B) @:extern static inline add (this:T ):Flags<T>

Accessible through the bitwise OR operator (` ). Returns a new Flags` type with the flags

passed at flags added to it.

@:impl @:op(A & B) @:extern static inline bitAnd (this:T ):Flags<T>

Accessible through the bitwise AND operator (&). Returns a new Flags type with the flags that are set on both this and flags

@:impl @:op(~A) @:extern static inline bitNeg ():Flags<T>

Accesible through the bitwise negation operator (~). Returns a new Flags type with all unset flags as set - but the ones that are set already.

@:impl @:op(A ^ B) @:extern static inline bitXor (this:T ):Flags<T>

Accessible through the bitwise XOR operator (^).

@:impl @:extern static inline has (this:T ):Bool

Returns whether flag is present on this type

@:impl @:extern static inline hasAll (this:T ):Bool

Returns whether this type has all flags set by flags also set

@:impl @:extern static inline hasAny (this:T ):Bool

Returns whether this type has any flag set by flags also set

@:impl @:extern static inline remove (this:T ):Flags<T>

Returns a new Flags type with all flags set by flags unset

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/cs/Flags.html