/
memorystream.go
264 lines (228 loc) · 5.35 KB
/
memorystream.go
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
//----------------------------------------
// The code is automatically generated by the GenlibLcl tool.
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package vcl
import (
. "github.com/ying32/govcl/vcl/api"
. "github.com/ying32/govcl/vcl/types"
"unsafe"
)
type TMemoryStream struct {
IStream
instance unsafe.Pointer
}
// NewMemoryStream
//
// 创建一个新的对象。
//
// Create a new object.
func NewMemoryStream() *TMemoryStream {
m := new(TMemoryStream)
m.instance = unsafe.Pointer(MemoryStream_Create())
setFinalizer(m, (*TMemoryStream).Free)
return m
}
// AsMemoryStream
//
// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsMemoryStream(obj interface{}) *TMemoryStream {
instance := getInstance(obj)
if instance == nullptr { return nil }
return &TMemoryStream{instance: instance}
}
// Free
//
// 释放对象。
//
// Free object.
func (m *TMemoryStream) Free() {
if m.instance != nullptr {
MemoryStream_Free(m._instance())
m.instance = nullptr
}
}
func (m *TMemoryStream) _instance() uintptr {
return uintptr(m.instance)
}
// Instance
//
// 返回对象实例指针。
//
// Return object instance pointer.
func (m *TMemoryStream) Instance() uintptr {
return m._instance()
}
// UnsafeAddr
//
// 获取一个不安全的地址。
//
// Get an unsafe address.
func (m *TMemoryStream) UnsafeAddr() unsafe.Pointer {
return m.instance
}
// IsValid
//
// 检测地址是否为空。
//
// Check if the address is empty.
func (m *TMemoryStream) IsValid() bool {
return m.instance != nullptr
}
// Is
//
// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (m *TMemoryStream) Is() TIs {
return TIs(m._instance())
}
// As
//
// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (m *TMemoryStream) As() TAs {
// return TAs(m._instance())
//}
// TMemoryStreamClass
//
// 获取类信息指针。
//
// Get class information pointer.
func TMemoryStreamClass() TClass {
return MemoryStream_StaticClassType()
}
// Clear
//
// 清除。
func (m *TMemoryStream) Clear() {
MemoryStream_Clear(m._instance())
}
// LoadFromStream
//
// 文件流加载。
func (m *TMemoryStream) LoadFromStream(Stream IStream) {
MemoryStream_LoadFromStream(m._instance(), CheckPtr(Stream))
}
// LoadFromFile
//
// 从文件加载。
func (m *TMemoryStream) LoadFromFile(FileName string) {
MemoryStream_LoadFromFile(m._instance(), FileName)
}
// Seek
//
// 移动流指针位置。
func (m *TMemoryStream) Seek(Offset int64, Origin TSeekOrigin) int64 {
return MemoryStream_Seek(m._instance(), Offset , Origin)
}
// SaveToStream
//
// 保存至流。
func (m *TMemoryStream) SaveToStream(Stream IStream) {
MemoryStream_SaveToStream(m._instance(), CheckPtr(Stream))
}
// SaveToFile
//
// 保存至文件。
func (m *TMemoryStream) SaveToFile(FileName string) {
MemoryStream_SaveToFile(m._instance(), FileName)
}
// CopyFrom
//
// 从指定流中复制。
func (m *TMemoryStream) CopyFrom(Source IStream, Count int64) int64 {
return MemoryStream_CopyFrom(m._instance(), CheckPtr(Source), Count)
}
// ClassType
//
// 获取类的类型信息。
//
// Get class type information.
func (m *TMemoryStream) ClassType() TClass {
return MemoryStream_ClassType(m._instance())
}
// ClassName
//
// 获取当前对象类名称。
//
// Get the current object class name.
func (m *TMemoryStream) ClassName() string {
return MemoryStream_ClassName(m._instance())
}
// InstanceSize
//
// 获取当前对象实例大小。
//
// Get the current object instance size.
func (m *TMemoryStream) InstanceSize() int32 {
return MemoryStream_InstanceSize(m._instance())
}
// InheritsFrom
//
// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (m *TMemoryStream) InheritsFrom(AClass TClass) bool {
return MemoryStream_InheritsFrom(m._instance(), AClass)
}
// Equals
//
// 与一个对象进行比较。
//
// Compare with an object.
func (m *TMemoryStream) Equals(Obj IObject) bool {
return MemoryStream_Equals(m._instance(), CheckPtr(Obj))
}
// GetHashCode
//
// 获取类的哈希值。
//
// Get the hash value of the class.
func (m *TMemoryStream) GetHashCode() int32 {
return MemoryStream_GetHashCode(m._instance())
}
// ToString
//
// 文本类信息。
//
// Text information.
func (m *TMemoryStream) ToString() string {
return MemoryStream_ToString(m._instance())
}
// Memory
//
// 获取内存指针。
func (m *TMemoryStream) Memory() uintptr {
return MemoryStream_GetMemory(m._instance())
}
// Position
//
// 获取流指针位置。
func (m *TMemoryStream) Position() int64 {
return MemoryStream_GetPosition(m._instance())
}
// SetPosition
//
// 设置流指针位置。
func (m *TMemoryStream) SetPosition(value int64) {
MemoryStream_SetPosition(m._instance(), value)
}
// Size
//
// 获取流的大小。
func (m *TMemoryStream) Size() int64 {
return MemoryStream_GetSize(m._instance())
}
// SetSize
//
// 设置流的大小。
func (m *TMemoryStream) SetSize(value int64) {
MemoryStream_SetSize(m._instance(), value)
}