-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.go
More file actions
87 lines (72 loc) · 2.07 KB
/
value.go
File metadata and controls
87 lines (72 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Code generated by jnigen. DO NOT EDIT.
package jni
import (
"unsafe"
"github.com/AndroidGoLab/jni/capi"
)
// Value wraps a JNI jvalue union. Use the typed constructors (IntValue,
// LongValue, ObjectValue, etc.) to create values for method call arguments.
type Value struct {
val capi.Jvalue
}
// Raw returns the underlying capi.Jvalue for interop.
func (v Value) Raw() capi.Jvalue {
return v.val
}
// BooleanValue creates a Value holding a uint8.
func BooleanValue(v uint8) Value {
var val capi.Jvalue
*(*capi.Jboolean)(unsafe.Pointer(&val)) = capi.Jboolean(v)
return Value{val: val}
}
// ByteValue creates a Value holding a int8.
func ByteValue(v int8) Value {
var val capi.Jvalue
*(*capi.Jbyte)(unsafe.Pointer(&val)) = capi.Jbyte(v)
return Value{val: val}
}
// CharValue creates a Value holding a uint16.
func CharValue(v uint16) Value {
var val capi.Jvalue
*(*capi.Jchar)(unsafe.Pointer(&val)) = capi.Jchar(v)
return Value{val: val}
}
// ShortValue creates a Value holding a int16.
func ShortValue(v int16) Value {
var val capi.Jvalue
*(*capi.Jshort)(unsafe.Pointer(&val)) = capi.Jshort(v)
return Value{val: val}
}
// IntValue creates a Value holding a int32.
func IntValue(v int32) Value {
var val capi.Jvalue
*(*capi.Jint)(unsafe.Pointer(&val)) = capi.Jint(v)
return Value{val: val}
}
// LongValue creates a Value holding a int64.
func LongValue(v int64) Value {
var val capi.Jvalue
*(*capi.Jlong)(unsafe.Pointer(&val)) = capi.Jlong(v)
return Value{val: val}
}
// FloatValue creates a Value holding a float32.
func FloatValue(v float32) Value {
var val capi.Jvalue
*(*capi.Jfloat)(unsafe.Pointer(&val)) = capi.Jfloat(v)
return Value{val: val}
}
// DoubleValue creates a Value holding a float64.
func DoubleValue(v float64) Value {
var val capi.Jvalue
*(*capi.Jdouble)(unsafe.Pointer(&val)) = capi.Jdouble(v)
return Value{val: val}
}
// ObjectValue creates a Value holding an Object reference.
func ObjectValue(v *Object) Value {
var val capi.Jvalue
if v != nil {
*(*capi.Object)(unsafe.Pointer(&val)) = v.ref
}
return Value{val: val}
}
var _ = unsafe.Pointer(nil)