-
Notifications
You must be signed in to change notification settings - Fork 1
/
inifile.go
267 lines (225 loc) · 6.22 KB
/
inifile.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
264
265
266
267
//----------------------------------------
// The code is automatically generated by the GenlibLcl tool.
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package lcl
import (
. "github.com/energye/golcl/lcl/api"
. "github.com/energye/golcl/lcl/types"
"time"
"unsafe"
)
type TIniFile struct {
IObject
instance unsafe.Pointer
}
// NewIniFile
//
// 创建一个新的对象。
//
// Create a new object.
func NewIniFile(filename string) *TIniFile {
i := new(TIniFile)
i.instance = unsafe.Pointer(IniFile_Create(PascalStr(filename)))
setFinalizer(i, (*TIniFile).Free)
return i
}
// AsIniFile
//
// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsIniFile(obj interface{}) *TIniFile {
instance := getInstance(obj)
if instance == nullptr {
return nil
}
return &TIniFile{instance: instance}
}
// Free
//
// 释放对象。
//
// Free object.
func (i *TIniFile) Free() {
if i.instance != nullptr {
IniFile_Free(i._instance())
i.instance = nullptr
}
}
func (i *TIniFile) _instance() uintptr {
return uintptr(i.instance)
}
// Instance
//
// 返回对象实例指针。
//
// Return object instance pointer.
func (i *TIniFile) Instance() uintptr {
return i._instance()
}
// UnsafeAddr
//
// 获取一个不安全的地址。
//
// Get an unsafe address.
func (i *TIniFile) UnsafeAddr() unsafe.Pointer {
return i.instance
}
// IsValid
//
// 检测地址是否为空。
//
// Check if the address is empty.
func (i *TIniFile) IsValid() bool {
return i.instance != nullptr
}
// Is
//
// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (i *TIniFile) Is() TIs {
return TIs(i._instance())
}
// As
//
// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (i *TIniFile) As() TAs {
// return TAs(i._instance())
//}
// TIniFileClass
//
// 获取类信息指针。
//
// Get class information pointer.
func TIniFileClass() TClass {
return IniFile_StaticClassType()
}
func (i *TIniFile) ReadString(Section string, Ident string, Default string) string {
return IniFile_ReadString(i._instance(), Section, Ident, Default)
}
func (i *TIniFile) WriteString(Section string, Ident string, Value string) {
IniFile_WriteString(i._instance(), Section, Ident, Value)
}
func (i *TIniFile) ReadSections(Strings IStrings) {
IniFile_ReadSections(i._instance(), CheckPtr(Strings))
}
func (i *TIniFile) ReadSectionValues(Section string, Strings IStrings) {
IniFile_ReadSectionValues(i._instance(), Section, CheckPtr(Strings))
}
func (i *TIniFile) EraseSection(Section string) {
IniFile_EraseSection(i._instance(), Section)
}
func (i *TIniFile) DeleteKey(Section string, Ident string) {
IniFile_DeleteKey(i._instance(), Section, Ident)
}
func (i *TIniFile) UpdateFile() {
IniFile_UpdateFile(i._instance())
}
func (i *TIniFile) SectionExists(Section string) bool {
return IniFile_SectionExists(i._instance(), Section)
}
func (i *TIniFile) ReadInteger(Section string, Ident string, Default int32) int32 {
return IniFile_ReadInteger(i._instance(), Section, Ident, Default)
}
func (i *TIniFile) WriteInteger(Section string, Ident string, Value int32) {
IniFile_WriteInteger(i._instance(), Section, Ident, Value)
}
func (i *TIniFile) ReadBool(Section string, Ident string, Default bool) bool {
return IniFile_ReadBool(i._instance(), Section, Ident, Default)
}
func (i *TIniFile) WriteBool(Section string, Ident string, Value bool) {
IniFile_WriteBool(i._instance(), Section, Ident, Value)
}
func (i *TIniFile) ReadDate(Section string, Name string, Default time.Time) time.Time {
return IniFile_ReadDate(i._instance(), Section, Name, Default)
}
func (i *TIniFile) ReadDateTime(Section string, Name string, Default time.Time) time.Time {
return IniFile_ReadDateTime(i._instance(), Section, Name, Default)
}
func (i *TIniFile) ReadFloat(Section string, Name string, Default float64) float64 {
return IniFile_ReadFloat(i._instance(), Section, Name, Default)
}
func (i *TIniFile) ReadTime(Section string, Name string, Default time.Time) time.Time {
return IniFile_ReadTime(i._instance(), Section, Name, Default)
}
func (i *TIniFile) WriteDate(Section string, Name string, Value time.Time) {
IniFile_WriteDate(i._instance(), Section, Name, Value)
}
func (i *TIniFile) WriteDateTime(Section string, Name string, Value time.Time) {
IniFile_WriteDateTime(i._instance(), Section, Name, Value)
}
func (i *TIniFile) WriteFloat(Section string, Name string, Value float64) {
IniFile_WriteFloat(i._instance(), Section, Name, Value)
}
func (i *TIniFile) WriteTime(Section string, Name string, Value time.Time) {
IniFile_WriteTime(i._instance(), Section, Name, Value)
}
func (i *TIniFile) ValueExists(Section string, Ident string) bool {
return IniFile_ValueExists(i._instance(), Section, Ident)
}
// ClassType
//
// 获取类的类型信息。
//
// Get class type information.
func (i *TIniFile) ClassType() TClass {
return IniFile_ClassType(i._instance())
}
// ClassName
//
// 获取当前对象类名称。
//
// Get the current object class name.
func (i *TIniFile) ClassName() string {
return IniFile_ClassName(i._instance())
}
// InstanceSize
//
// 获取当前对象实例大小。
//
// Get the current object instance size.
func (i *TIniFile) InstanceSize() int32 {
return IniFile_InstanceSize(i._instance())
}
// InheritsFrom
//
// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (i *TIniFile) InheritsFrom(AClass TClass) bool {
return IniFile_InheritsFrom(i._instance(), AClass)
}
// Equals
//
// 与一个对象进行比较。
//
// Compare with an object.
func (i *TIniFile) Equals(Obj IObject) bool {
return IniFile_Equals(i._instance(), CheckPtr(Obj))
}
// GetHashCode
//
// 获取类的哈希值。
//
// Get the hash value of the class.
func (i *TIniFile) GetHashCode() int32 {
return IniFile_GetHashCode(i._instance())
}
// ToString
//
// 文本类信息。
//
// Text information.
func (i *TIniFile) ToString() string {
return IniFile_ToString(i._instance())
}
func (i *TIniFile) FileName() string {
return IniFile_GetFileName(i._instance())
}