energy/cef/cef-string-multi-map.go

88 lines
2.6 KiB
Go
Raw Normal View History

2022-10-04 13:21:05 +08:00
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
2022-10-04 13:21:05 +08:00
//
//----------------------------------------
2023-02-20 14:42:17 +08:00
// CEF 多值MAP类型
2022-10-04 13:21:05 +08:00
package cef
import (
"github.com/energye/energy/common/imports"
2022-10-04 13:21:05 +08:00
"github.com/energye/golcl/lcl/api"
"unsafe"
)
2023-02-20 14:42:17 +08:00
// ICefStringMultiMap 实例
2022-10-04 13:21:05 +08:00
type ICefStringMultiMap struct {
instance uintptr
ptr unsafe.Pointer
}
2023-02-20 14:42:17 +08:00
// GetSize 大小
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) GetSize() int {
return cefHeaderMap_GetSize(m.instance)
}
2023-02-20 14:42:17 +08:00
// FindCount key值数量
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) FindCount(key string) int {
return cefHeaderMap_FindCount(m.instance, key)
}
2023-02-20 14:42:17 +08:00
// GetEnumerate 根据key & index获取枚举
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) GetEnumerate(key string, valueIndex int) string {
2022-12-03 21:56:51 +08:00
return api.GoStr(cefHeaderMap_GetEnumerate(m.instance, key, valueIndex))
2022-10-04 13:21:05 +08:00
}
2023-02-20 14:42:17 +08:00
// GetKey 根据 index 获取key
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) GetKey(index int) string {
2022-12-03 21:56:51 +08:00
return api.GoStr(cefHeaderMap_GetKey(m.instance, index))
2022-10-04 13:21:05 +08:00
}
2023-02-20 14:42:17 +08:00
// GetValue 根据 index 获取value
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) GetValue(index int) string {
2022-12-03 21:56:51 +08:00
return api.GoStr(cefHeaderMap_GetValue(m.instance, index))
2022-10-04 13:21:05 +08:00
}
2023-02-20 14:42:17 +08:00
// Append 给key追加值
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) Append(key, value string) bool {
2022-12-03 21:56:51 +08:00
return api.GoBool(cefHeaderMap_Append(m.instance, key, value))
2022-10-04 13:21:05 +08:00
}
2023-02-20 14:42:17 +08:00
// Clear 清空
2022-10-04 13:21:05 +08:00
func (m *ICefStringMultiMap) Clear() {
cefHeaderMap_Clear(m.instance)
}
func cefHeaderMap_GetSize(instance uintptr) int {
r1, _, _ := imports.Proc(internale_cefHeaderMap_GetSize).Call(instance)
2022-10-04 13:21:05 +08:00
return int(r1)
}
func cefHeaderMap_FindCount(instance uintptr, key string) int {
r1, _, _ := imports.Proc(internale_cefHeaderMap_FindCount).Call(instance, api.PascalStr(key))
2022-10-04 13:21:05 +08:00
return int(r1)
}
func cefHeaderMap_GetEnumerate(instance uintptr, key string, valueIndex int) uintptr {
r1, _, _ := imports.Proc(internale_cefHeaderMap_GetEnumerate).Call(instance, api.PascalStr(key), uintptr(valueIndex))
2022-10-04 13:21:05 +08:00
return r1
}
func cefHeaderMap_GetKey(instance uintptr, index int) uintptr {
r1, _, _ := imports.Proc(internale_cefHeaderMap_GetKey).Call(instance, uintptr(index))
2022-10-04 13:21:05 +08:00
return r1
}
func cefHeaderMap_GetValue(instance uintptr, index int) uintptr {
r1, _, _ := imports.Proc(internale_cefHeaderMap_GetValue).Call(instance, uintptr(index))
2022-10-04 13:21:05 +08:00
return r1
}
func cefHeaderMap_Append(instance uintptr, key, value string) uintptr {
r1, _, _ := imports.Proc(internale_cefHeaderMap_Append).Call(instance, api.PascalStr(key), api.PascalStr(value))
2022-10-04 13:21:05 +08:00
return r1
}
func cefHeaderMap_Clear(instance uintptr) {
imports.Proc(internale_cefHeaderMap_Clear).Call(instance)
2022-10-04 13:21:05 +08:00
}