2022-10-04 13:21:05 +08:00
|
|
|
//----------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
//
|
2023-02-19 23:21:47 +08:00
|
|
|
// 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-27 09:15:37 +08:00
|
|
|
// CEF 多值MAP类型 StringMultiMapRef.New
|
2022-10-04 13:21:05 +08:00
|
|
|
package cef
|
|
|
|
|
|
|
|
import (
|
2023-02-13 21:25:35 +08:00
|
|
|
"github.com/energye/energy/common/imports"
|
2022-10-04 13:21:05 +08:00
|
|
|
"github.com/energye/golcl/lcl/api"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2023-02-27 09:15:37 +08:00
|
|
|
// StringMultiMapRef -> ICefStringMultiMap
|
|
|
|
var StringMultiMapRef stringMultiMap
|
|
|
|
|
|
|
|
// stringMultiMap
|
|
|
|
type stringMultiMap uintptr
|
|
|
|
|
|
|
|
// New 创建一个新的 StringMultiMap
|
|
|
|
func (m *stringMultiMap) New() *ICefStringMultiMap {
|
|
|
|
var result uintptr
|
|
|
|
imports.Proc(internale_StringMultimapRef_Create).Call(uintptr(unsafe.Pointer(&result)))
|
|
|
|
return &ICefStringMultiMap{instance: unsafe.Pointer(result)}
|
2023-02-26 23:21:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Instance 实例
|
|
|
|
func (m *ICefStringMultiMap) Instance() uintptr {
|
|
|
|
if m == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return uintptr(m.instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
2023-02-27 11:33:00 +08:00
|
|
|
func (m *ICefStringMultiMap) IsValid() bool {
|
|
|
|
if m == nil || m.instance == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2023-02-20 14:42:17 +08:00
|
|
|
// GetSize 大小
|
2023-02-27 19:42:50 +08:00
|
|
|
func (m *ICefStringMultiMap) GetSize() uint32 {
|
2023-02-26 23:21:44 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_GetSize).Call(m.Instance())
|
2023-02-27 19:42:50 +08:00
|
|
|
return uint32(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2023-02-20 14:42:17 +08:00
|
|
|
|
|
|
|
// FindCount key值数量
|
2023-02-27 19:42:50 +08:00
|
|
|
func (m *ICefStringMultiMap) FindCount(key string) uint32 {
|
2023-02-26 23:21:44 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_FindCount).Call(m.Instance(), api.PascalStr(key))
|
2023-02-27 19:42:50 +08:00
|
|
|
return uint32(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2023-02-20 14:42:17 +08:00
|
|
|
|
2023-02-26 23:21:44 +08:00
|
|
|
// GetEnumerate 根据 key and index 获取
|
2023-02-27 19:42:50 +08:00
|
|
|
func (m *ICefStringMultiMap) GetEnumerate(key string, index uint32) string {
|
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_GetEnumerate).Call(m.Instance(), api.PascalStr(key), uintptr(index))
|
2023-02-26 23:21:44 +08:00
|
|
|
return api.GoStr(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2023-02-20 14:42:17 +08:00
|
|
|
|
|
|
|
// GetKey 根据 index 获取key
|
2023-02-27 19:42:50 +08:00
|
|
|
func (m *ICefStringMultiMap) GetKey(index uint32) string {
|
2023-02-26 23:21:44 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_GetKey).Call(m.Instance(), uintptr(index))
|
|
|
|
return api.GoStr(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2023-02-20 14:42:17 +08:00
|
|
|
|
|
|
|
// GetValue 根据 index 获取value
|
2023-02-27 19:42:50 +08:00
|
|
|
func (m *ICefStringMultiMap) GetValue(index uint32) string {
|
2023-02-28 09:55:20 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_GetValue).Call(m.Instance(), uintptr(index))
|
|
|
|
return api.GoStr(r1)
|
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 {
|
2023-02-26 23:21:44 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_StringMultimap_Append).Call(m.Instance(), api.PascalStr(key), api.PascalStr(value))
|
|
|
|
return api.GoBool(r1)
|
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() {
|
2023-02-26 23:21:44 +08:00
|
|
|
imports.Proc(internale_StringMultimap_Clear).Call(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|