Package de.justjanne.bitflags

Types

Flag
Link copied to clipboard
interface Flag<T>
Interface for a single flag which can be part of a bitfield
Flags
Link copied to clipboard
interface Flags<T, U : Flag<T>, Enum<U>>
Interface for a helper object for a type of flag

Functions

none
Link copied to clipboard
inline fun <T : Flag<*>, Enum<T>> Flags<*, T>.none(): EnumSet<T>
Function to obtain an empty bitfield for a certain flag type
of
Link copied to clipboard
inline fun <T : Flag<*>, Enum<T>> Flags<*, T>.of(vararg values: T): EnumSet<T>
Construct a bitfield out of discrete flags
inline fun <T : Flag<*>, Enum<T>> Flags<*, T>.of(values: Collection<T>): EnumSet<T>
Construct a bitfield out of a collection of flags
inline fun <T : Flag<Byte>, Enum<T>> Flags<Byte, T>.of(value: Byte?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<Int>, Enum<T>> Flags<Int, T>.of(value: Int?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<Long>, Enum<T>> Flags<Long, T>.of(value: Long?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<Short>, Enum<T>> Flags<Short, T>.of(value: Short?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<UByte>, Enum<T>> Flags<UByte, T>.of(value: UByte?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<UInt>, Enum<T>> Flags<UInt, T>.of(value: UInt?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<ULong>, Enum<T>> Flags<ULong, T>.of(value: ULong?): EnumSet<T>
Construct a bitfield out of a binary value
inline fun <T : Flag<UShort>, Enum<T>> Flags<UShort, T>.of(value: UShort?): EnumSet<T>
Construct a bitfield out of a binary value
toBits
Link copied to clipboard
@JvmName(name = toByteFlag)
fun Set<Flag<Byte>>?.toBits(): Byte
Obtain the binary value of the bitfield
@JvmName(name = toIntFlag)
fun Set<Flag<Int>>?.toBits(): Int
Obtain the binary value of the bitfield
@JvmName(name = toLongFlag)
fun Set<Flag<Long>>?.toBits(): Long
Obtain the binary value of the bitfield
@JvmName(name = toShortFlag)
fun Set<Flag<Short>>?.toBits(): Short
Obtain the binary value of the bitfield
@JvmName(name = toUByteFlag)
fun Set<Flag<UByte>>?.toBits(): UByte
Obtain the binary value of the bitfield
@JvmName(name = toUIntFlag)
fun Set<Flag<UInt>>?.toBits(): UInt
Obtain the binary value of the bitfield
@JvmName(name = toULongFlag)
fun Set<Flag<ULong>>?.toBits(): ULong
Obtain the binary value of the bitfield
@JvmName(name = toUShortFlag)
fun Set<Flag<UShort>>?.toBits(): UShort
Obtain the binary value of the bitfield
toEnumSet
Link copied to clipboard
inline fun <T : Enum<T>> Array<out T>.toEnumSet(): EnumSet<T>
Conversion from collection of flags to a bitfield
inline fun <T : Enum<T>> Collection<T>.toEnumSet(): EnumSet<T>
Conversion from collection of flags to a bitfield
validValues
Link copied to clipboard
@JvmName(name = validValuesByte)
inline fun <T : Flag<Byte>, Enum<T>> Flags<Byte, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesInt)
inline fun <T : Flag<Int>, Enum<T>> Flags<Int, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesLong)
inline fun <T : Flag<Long>, Enum<T>> Flags<Long, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesShort)
inline fun <T : Flag<Short>, Enum<T>> Flags<Short, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesUByte)
inline fun <T : Flag<UByte>, Enum<T>> Flags<UByte, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesUInt)
inline fun <T : Flag<UInt>, Enum<T>> Flags<UInt, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesULong)
inline fun <T : Flag<ULong>, Enum<T>> Flags<ULong, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield
@JvmName(name = validValuesUShort)
inline fun <T : Flag<UShort>, Enum<T>> Flags<UShort, T>.validValues(): EnumSet<T>
Obtain all discrete valid values for the bitfield