Native: add .alloc(value) for primitive types to interop runtime
^KT-50312 Fixed
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
package kotlinx.cinterop
|
||||
|
||||
//
|
||||
// NOTE: THIS FILE IS AUTO-GENERATED by the generators/nativeInteropRuntime/NativeInteropRuntimeGenerator.kt
|
||||
//
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Boolean> NativePlacement.alloc(value: T): BooleanVarOf<T> =
|
||||
alloc<BooleanVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Byte> NativePlacement.alloc(value: T): ByteVarOf<T> =
|
||||
alloc<ByteVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Short> NativePlacement.alloc(value: T): ShortVarOf<T> =
|
||||
alloc<ShortVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Int> NativePlacement.alloc(value: T): IntVarOf<T> =
|
||||
alloc<IntVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Long> NativePlacement.alloc(value: T): LongVarOf<T> =
|
||||
alloc<LongVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : UByte> NativePlacement.alloc(value: T): UByteVarOf<T> =
|
||||
alloc<UByteVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : UShort> NativePlacement.alloc(value: T): UShortVarOf<T> =
|
||||
alloc<UShortVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : UInt> NativePlacement.alloc(value: T): UIntVarOf<T> =
|
||||
alloc<UIntVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : ULong> NativePlacement.alloc(value: T): ULongVarOf<T> =
|
||||
alloc<ULongVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Float> NativePlacement.alloc(value: T): FloatVarOf<T> =
|
||||
alloc<FloatVarOf<T>> { this.value = value }
|
||||
|
||||
/**
|
||||
* Allocates variable with given value type and initializes it with given value.
|
||||
*/
|
||||
@Suppress("FINAL_UPPER_BOUND")
|
||||
public fun <T : Double> NativePlacement.alloc(value: T): DoubleVarOf<T> =
|
||||
alloc<DoubleVarOf<T>> { this.value = value }
|
||||
|
||||
Reference in New Issue
Block a user