2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qstringmatcher.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QStringMatcher struct {
|
|
|
|
h *C.QStringMatcher
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) cPointer() *C.QStringMatcher {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QStringMatcher) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQStringMatcher(h *C.QStringMatcher) *QStringMatcher {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QStringMatcher{h: h}
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQStringMatcher(h unsafe.Pointer) *QStringMatcher {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQStringMatcher((*C.QStringMatcher)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher constructs a new QStringMatcher object.
|
|
|
|
func NewQStringMatcher() *QStringMatcher {
|
|
|
|
ret := C.QStringMatcher_new()
|
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher2 constructs a new QStringMatcher object.
|
2024-08-29 07:01:51 +00:00
|
|
|
func NewQStringMatcher2(pattern string) *QStringMatcher {
|
2024-10-18 23:53:33 +00:00
|
|
|
pattern_ms := C.struct_miqt_string{}
|
|
|
|
pattern_ms.data = C.CString(pattern)
|
|
|
|
pattern_ms.len = C.size_t(len(pattern))
|
|
|
|
defer C.free(unsafe.Pointer(pattern_ms.data))
|
|
|
|
ret := C.QStringMatcher_new2(pattern_ms)
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher3 constructs a new QStringMatcher object.
|
|
|
|
func NewQStringMatcher3(uc *QChar, lenVal int) *QStringMatcher {
|
|
|
|
ret := C.QStringMatcher_new3(uc.cPointer(), (C.int)(lenVal))
|
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher4 constructs a new QStringMatcher object.
|
|
|
|
func NewQStringMatcher4(other *QStringMatcher) *QStringMatcher {
|
|
|
|
ret := C.QStringMatcher_new4(other.cPointer())
|
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher5 constructs a new QStringMatcher object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQStringMatcher5(pattern string, cs CaseSensitivity) *QStringMatcher {
|
2024-10-18 23:53:33 +00:00
|
|
|
pattern_ms := C.struct_miqt_string{}
|
|
|
|
pattern_ms.data = C.CString(pattern)
|
|
|
|
pattern_ms.len = C.size_t(len(pattern))
|
|
|
|
defer C.free(unsafe.Pointer(pattern_ms.data))
|
|
|
|
ret := C.QStringMatcher_new5(pattern_ms, (C.int)(cs))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStringMatcher6 constructs a new QStringMatcher object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQStringMatcher6(uc *QChar, lenVal int, cs CaseSensitivity) *QStringMatcher {
|
2024-09-18 00:12:02 +00:00
|
|
|
ret := C.QStringMatcher_new6(uc.cPointer(), (C.int)(lenVal), (C.int)(cs))
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQStringMatcher(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) OperatorAssign(other *QStringMatcher) {
|
|
|
|
C.QStringMatcher_OperatorAssign(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) SetPattern(pattern string) {
|
2024-10-18 23:53:33 +00:00
|
|
|
pattern_ms := C.struct_miqt_string{}
|
|
|
|
pattern_ms.data = C.CString(pattern)
|
|
|
|
pattern_ms.len = C.size_t(len(pattern))
|
|
|
|
defer C.free(unsafe.Pointer(pattern_ms.data))
|
|
|
|
C.QStringMatcher_SetPattern(this.h, pattern_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QStringMatcher) SetCaseSensitivity(cs CaseSensitivity) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QStringMatcher_SetCaseSensitivity(this.h, (C.int)(cs))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringMatcher) IndexIn(str string) int {
|
2024-10-18 23:53:33 +00:00
|
|
|
str_ms := C.struct_miqt_string{}
|
|
|
|
str_ms.data = C.CString(str)
|
|
|
|
str_ms.len = C.size_t(len(str))
|
|
|
|
defer C.free(unsafe.Pointer(str_ms.data))
|
|
|
|
return (int)(C.QStringMatcher_IndexIn(this.h, str_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) IndexIn2(str *QChar, length int) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringMatcher_IndexIn2(this.h, str.cPointer(), (C.int)(length)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) Pattern() string {
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QStringMatcher_Pattern(this.h)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QStringMatcher) CaseSensitivity() CaseSensitivity {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (CaseSensitivity)(C.QStringMatcher_CaseSensitivity(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringMatcher) IndexIn22(str string, from int) int {
|
2024-10-18 23:53:33 +00:00
|
|
|
str_ms := C.struct_miqt_string{}
|
|
|
|
str_ms.data = C.CString(str)
|
|
|
|
str_ms.len = C.size_t(len(str))
|
|
|
|
defer C.free(unsafe.Pointer(str_ms.data))
|
|
|
|
return (int)(C.QStringMatcher_IndexIn22(this.h, str_ms, (C.int)(from)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringMatcher) IndexIn3(str *QChar, length int, from int) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringMatcher_IndexIn3(this.h, str.cPointer(), (C.int)(length), (C.int)(from)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringMatcher) Delete() {
|
|
|
|
C.QStringMatcher_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QStringMatcher) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QStringMatcher) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|