mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
328 lines
8.8 KiB
Go
328 lines
8.8 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qregexp.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QRegExp__PatternSyntax int
|
|
|
|
const (
|
|
QRegExp__PatternSyntax__RegExp QRegExp__PatternSyntax = 0
|
|
QRegExp__PatternSyntax__Wildcard QRegExp__PatternSyntax = 1
|
|
QRegExp__PatternSyntax__FixedString QRegExp__PatternSyntax = 2
|
|
QRegExp__PatternSyntax__RegExp2 QRegExp__PatternSyntax = 3
|
|
QRegExp__PatternSyntax__WildcardUnix QRegExp__PatternSyntax = 4
|
|
QRegExp__PatternSyntax__W3CXmlSchema11 QRegExp__PatternSyntax = 5
|
|
)
|
|
|
|
type QRegExp__CaretMode int
|
|
|
|
const (
|
|
QRegExp__CaretMode__CaretAtZero QRegExp__CaretMode = 0
|
|
QRegExp__CaretMode__CaretAtOffset QRegExp__CaretMode = 1
|
|
QRegExp__CaretMode__CaretWontMatch QRegExp__CaretMode = 2
|
|
)
|
|
|
|
type QRegExp struct {
|
|
h *C.QRegExp
|
|
}
|
|
|
|
func (this *QRegExp) cPointer() *C.QRegExp {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQRegExp(h *C.QRegExp) *QRegExp {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QRegExp{h: h}
|
|
}
|
|
|
|
func newQRegExp_U(h unsafe.Pointer) *QRegExp {
|
|
return newQRegExp((*C.QRegExp)(h))
|
|
}
|
|
|
|
// NewQRegExp constructs a new QRegExp object.
|
|
func NewQRegExp() *QRegExp {
|
|
ret := C.QRegExp_new()
|
|
return newQRegExp(ret)
|
|
}
|
|
|
|
// NewQRegExp2 constructs a new QRegExp object.
|
|
func NewQRegExp2(pattern string) *QRegExp {
|
|
pattern_ms := miqt_strdupg(pattern)
|
|
defer C.free(pattern_ms)
|
|
ret := C.QRegExp_new2((*C.struct_miqt_string)(pattern_ms))
|
|
return newQRegExp(ret)
|
|
}
|
|
|
|
// NewQRegExp3 constructs a new QRegExp object.
|
|
func NewQRegExp3(rx *QRegExp) *QRegExp {
|
|
ret := C.QRegExp_new3(rx.cPointer())
|
|
return newQRegExp(ret)
|
|
}
|
|
|
|
// NewQRegExp4 constructs a new QRegExp object.
|
|
func NewQRegExp4(pattern string, cs CaseSensitivity) *QRegExp {
|
|
pattern_ms := miqt_strdupg(pattern)
|
|
defer C.free(pattern_ms)
|
|
ret := C.QRegExp_new4((*C.struct_miqt_string)(pattern_ms), (C.uintptr_t)(cs))
|
|
return newQRegExp(ret)
|
|
}
|
|
|
|
// NewQRegExp5 constructs a new QRegExp object.
|
|
func NewQRegExp5(pattern string, cs CaseSensitivity, syntax QRegExp__PatternSyntax) *QRegExp {
|
|
pattern_ms := miqt_strdupg(pattern)
|
|
defer C.free(pattern_ms)
|
|
ret := C.QRegExp_new5((*C.struct_miqt_string)(pattern_ms), (C.uintptr_t)(cs), (C.uintptr_t)(syntax))
|
|
return newQRegExp(ret)
|
|
}
|
|
|
|
func (this *QRegExp) OperatorAssign(rx *QRegExp) {
|
|
C.QRegExp_OperatorAssign(this.h, rx.cPointer())
|
|
}
|
|
|
|
func (this *QRegExp) Swap(other *QRegExp) {
|
|
C.QRegExp_Swap(this.h, other.cPointer())
|
|
}
|
|
|
|
func (this *QRegExp) OperatorEqual(rx *QRegExp) bool {
|
|
_ret := C.QRegExp_OperatorEqual(this.h, rx.cPointer())
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) OperatorNotEqual(rx *QRegExp) bool {
|
|
_ret := C.QRegExp_OperatorNotEqual(this.h, rx.cPointer())
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) IsEmpty() bool {
|
|
_ret := C.QRegExp_IsEmpty(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) IsValid() bool {
|
|
_ret := C.QRegExp_IsValid(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) Pattern() string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Pattern(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) SetPattern(pattern string) {
|
|
pattern_ms := miqt_strdupg(pattern)
|
|
defer C.free(pattern_ms)
|
|
C.QRegExp_SetPattern(this.h, (*C.struct_miqt_string)(pattern_ms))
|
|
}
|
|
|
|
func (this *QRegExp) CaseSensitivity() CaseSensitivity {
|
|
_ret := C.QRegExp_CaseSensitivity(this.h)
|
|
return (CaseSensitivity)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) SetCaseSensitivity(cs CaseSensitivity) {
|
|
C.QRegExp_SetCaseSensitivity(this.h, (C.uintptr_t)(cs))
|
|
}
|
|
|
|
func (this *QRegExp) PatternSyntax() QRegExp__PatternSyntax {
|
|
_ret := C.QRegExp_PatternSyntax(this.h)
|
|
return (QRegExp__PatternSyntax)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) SetPatternSyntax(syntax QRegExp__PatternSyntax) {
|
|
C.QRegExp_SetPatternSyntax(this.h, (C.uintptr_t)(syntax))
|
|
}
|
|
|
|
func (this *QRegExp) IsMinimal() bool {
|
|
_ret := C.QRegExp_IsMinimal(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) SetMinimal(minimal bool) {
|
|
C.QRegExp_SetMinimal(this.h, (C.bool)(minimal))
|
|
}
|
|
|
|
func (this *QRegExp) ExactMatch(str string) bool {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_ExactMatch(this.h, (*C.struct_miqt_string)(str_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) IndexIn(str string) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_IndexIn(this.h, (*C.struct_miqt_string)(str_ms))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) LastIndexIn(str string) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_LastIndexIn(this.h, (*C.struct_miqt_string)(str_ms))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) MatchedLength() int {
|
|
_ret := C.QRegExp_MatchedLength(this.h)
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) CaptureCount() int {
|
|
_ret := C.QRegExp_CaptureCount(this.h)
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) CapturedTexts() []string {
|
|
var _ma *C.struct_miqt_array = C.QRegExp_CapturedTexts(this.h)
|
|
_ret := make([]string, int(_ma.len))
|
|
_outCast := (*[0xffff]*C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_ret[i] = C.GoStringN(&_outCast[i].data, C.int(int64(_outCast[i].len)))
|
|
C.free(unsafe.Pointer(_outCast[i])) // free the inner miqt_string*
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) CapturedTexts2() []string {
|
|
var _ma *C.struct_miqt_array = C.QRegExp_CapturedTexts2(this.h)
|
|
_ret := make([]string, int(_ma.len))
|
|
_outCast := (*[0xffff]*C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_ret[i] = C.GoStringN(&_outCast[i].data, C.int(int64(_outCast[i].len)))
|
|
C.free(unsafe.Pointer(_outCast[i])) // free the inner miqt_string*
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) Cap() string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Cap(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) Cap2() string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Cap2(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) Pos() int {
|
|
_ret := C.QRegExp_Pos(this.h)
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) Pos2() int {
|
|
_ret := C.QRegExp_Pos2(this.h)
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) ErrorString() string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_ErrorString(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) ErrorString2() string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_ErrorString2(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QRegExp_Escape(str string) string {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Escape((*C.struct_miqt_string)(str_ms))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) IndexIn2(str string, offset int) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_IndexIn2(this.h, (*C.struct_miqt_string)(str_ms), (C.int)(offset))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) IndexIn3(str string, offset int, caretMode QRegExp__CaretMode) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_IndexIn3(this.h, (*C.struct_miqt_string)(str_ms), (C.int)(offset), (C.uintptr_t)(caretMode))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) LastIndexIn2(str string, offset int) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_LastIndexIn2(this.h, (*C.struct_miqt_string)(str_ms), (C.int)(offset))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) LastIndexIn3(str string, offset int, caretMode QRegExp__CaretMode) int {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
_ret := C.QRegExp_LastIndexIn3(this.h, (*C.struct_miqt_string)(str_ms), (C.int)(offset), (C.uintptr_t)(caretMode))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) Cap1(nth int) string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Cap1(this.h, (C.int)(nth))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) Cap1WithNth(nth int) string {
|
|
var _ms *C.struct_miqt_string = C.QRegExp_Cap1WithNth(this.h, (C.int)(nth))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QRegExp) Pos1(nth int) int {
|
|
_ret := C.QRegExp_Pos1(this.h, (C.int)(nth))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QRegExp) Pos1WithNth(nth int) int {
|
|
_ret := C.QRegExp_Pos1WithNth(this.h, (C.int)(nth))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QRegExp) Delete() {
|
|
C.QRegExp_Delete(this.h)
|
|
}
|
|
|
|
// 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 *QRegExp) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QRegExp) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|