EnumFlags

EnumFlags<T>(Int)

package haxe

Available on all platforms

A typed interface for bit flags. This is not a real object, only a typed interface for an actual Int. Each flag can be tested/set with the corresponding enum instance. Up to 32 flags can be stored that way.

Enum constructor indices are preserved from Haxe syntax, so the first declared is index 0, the next index 1 etc. The methods are optimized if the enum instance is passed directly, e.g. as has(EnumCtor). Otherwise Type.enumIndex() reflection is used.

Constructor

inline new (i:Int = 0)

Initializes the bitflags to i.

Methods

inline has (v:T ):Bool

Checks if the index of enum instance v is set.

This method is optimized if v is an enum instance expression such as SomeEnum.SomeCtor.

If v is null, the result is unspecified.

inline set (v:T ):Void

Sets the index of enum instance v.

This method is optimized if v is an enum instance expression such as SomeEnum.SomeCtor.

If v is null, the result is unspecified.

inline toInt ():Int

Convert the typed bitflag into the corresponding int value (this is a no-op, it doesn't have any impact on speed).

inline unset (v:T ):Void

Unsets the index of enum instance v.

This method is optimized if v is an enum instance expression such as SomeEnum.SomeCtor.

If v is null, the result is unspecified.

Static methods

static inline ofInt<T> (i:Int):EnumFlags<T>

Convert a integer bitflag into a typed one (this is a no-op, it does not have any impact on speed).

© 2005–2016 Haxe Foundation
Licensed under a MIT license.
http://api.haxe.org/haxe/EnumFlags.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部