miqt/qt/gen_qcommandlineoption.go

280 lines
10 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qcommandlineoption.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
2024-09-04 06:54:22 +00:00
type QCommandLineOption__Flag int
const (
QCommandLineOption__Flag__HiddenFromHelp QCommandLineOption__Flag = 1
QCommandLineOption__Flag__ShortOptionStyle QCommandLineOption__Flag = 2
)
type QCommandLineOption struct {
h *C.QCommandLineOption
}
func (this *QCommandLineOption) cPointer() *C.QCommandLineOption {
if this == nil {
return nil
}
return this.h
}
func newQCommandLineOption(h *C.QCommandLineOption) *QCommandLineOption {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QCommandLineOption{h: h}
}
func newQCommandLineOption_U(h unsafe.Pointer) *QCommandLineOption {
return newQCommandLineOption((*C.QCommandLineOption)(h))
}
// NewQCommandLineOption constructs a new QCommandLineOption object.
func NewQCommandLineOption(name string) *QCommandLineOption {
name_ms := miqt_strdupg(name)
defer C.free(name_ms)
ret := C.QCommandLineOption_new((*C.struct_miqt_string)(name_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption2 constructs a new QCommandLineOption object.
func NewQCommandLineOption2(names []string) *QCommandLineOption {
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
names_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(names))))
defer C.free(unsafe.Pointer(names_CArray))
for i := range names {
single_ms := miqt_strdupg(names[i])
defer C.free(single_ms)
names_CArray[i] = (*C.struct_miqt_string)(single_ms)
}
names_ma := &C.struct_miqt_array{len: C.size_t(len(names)), data: unsafe.Pointer(names_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(names_ma))
ret := C.QCommandLineOption_new2(names_ma)
return newQCommandLineOption(ret)
}
// NewQCommandLineOption3 constructs a new QCommandLineOption object.
func NewQCommandLineOption3(name string, description string) *QCommandLineOption {
name_ms := miqt_strdupg(name)
defer C.free(name_ms)
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
ret := C.QCommandLineOption_new3((*C.struct_miqt_string)(name_ms), (*C.struct_miqt_string)(description_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption4 constructs a new QCommandLineOption object.
func NewQCommandLineOption4(names []string, description string) *QCommandLineOption {
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
names_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(names))))
defer C.free(unsafe.Pointer(names_CArray))
for i := range names {
single_ms := miqt_strdupg(names[i])
defer C.free(single_ms)
names_CArray[i] = (*C.struct_miqt_string)(single_ms)
}
names_ma := &C.struct_miqt_array{len: C.size_t(len(names)), data: unsafe.Pointer(names_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(names_ma))
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
ret := C.QCommandLineOption_new4(names_ma, (*C.struct_miqt_string)(description_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption5 constructs a new QCommandLineOption object.
func NewQCommandLineOption5(other *QCommandLineOption) *QCommandLineOption {
ret := C.QCommandLineOption_new5(other.cPointer())
return newQCommandLineOption(ret)
}
// NewQCommandLineOption6 constructs a new QCommandLineOption object.
func NewQCommandLineOption6(name string, description string, valueName string) *QCommandLineOption {
name_ms := miqt_strdupg(name)
defer C.free(name_ms)
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
valueName_ms := miqt_strdupg(valueName)
defer C.free(valueName_ms)
ret := C.QCommandLineOption_new6((*C.struct_miqt_string)(name_ms), (*C.struct_miqt_string)(description_ms), (*C.struct_miqt_string)(valueName_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption7 constructs a new QCommandLineOption object.
func NewQCommandLineOption7(name string, description string, valueName string, defaultValue string) *QCommandLineOption {
name_ms := miqt_strdupg(name)
defer C.free(name_ms)
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
valueName_ms := miqt_strdupg(valueName)
defer C.free(valueName_ms)
defaultValue_ms := miqt_strdupg(defaultValue)
defer C.free(defaultValue_ms)
ret := C.QCommandLineOption_new7((*C.struct_miqt_string)(name_ms), (*C.struct_miqt_string)(description_ms), (*C.struct_miqt_string)(valueName_ms), (*C.struct_miqt_string)(defaultValue_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption8 constructs a new QCommandLineOption object.
func NewQCommandLineOption8(names []string, description string, valueName string) *QCommandLineOption {
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
names_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(names))))
defer C.free(unsafe.Pointer(names_CArray))
for i := range names {
single_ms := miqt_strdupg(names[i])
defer C.free(single_ms)
names_CArray[i] = (*C.struct_miqt_string)(single_ms)
}
names_ma := &C.struct_miqt_array{len: C.size_t(len(names)), data: unsafe.Pointer(names_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(names_ma))
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
valueName_ms := miqt_strdupg(valueName)
defer C.free(valueName_ms)
ret := C.QCommandLineOption_new8(names_ma, (*C.struct_miqt_string)(description_ms), (*C.struct_miqt_string)(valueName_ms))
return newQCommandLineOption(ret)
}
// NewQCommandLineOption9 constructs a new QCommandLineOption object.
func NewQCommandLineOption9(names []string, description string, valueName string, defaultValue string) *QCommandLineOption {
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
names_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(names))))
defer C.free(unsafe.Pointer(names_CArray))
for i := range names {
single_ms := miqt_strdupg(names[i])
defer C.free(single_ms)
names_CArray[i] = (*C.struct_miqt_string)(single_ms)
}
names_ma := &C.struct_miqt_array{len: C.size_t(len(names)), data: unsafe.Pointer(names_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(names_ma))
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
valueName_ms := miqt_strdupg(valueName)
defer C.free(valueName_ms)
defaultValue_ms := miqt_strdupg(defaultValue)
defer C.free(defaultValue_ms)
ret := C.QCommandLineOption_new9(names_ma, (*C.struct_miqt_string)(description_ms), (*C.struct_miqt_string)(valueName_ms), (*C.struct_miqt_string)(defaultValue_ms))
return newQCommandLineOption(ret)
}
func (this *QCommandLineOption) OperatorAssign(other *QCommandLineOption) {
C.QCommandLineOption_OperatorAssign(this.h, other.cPointer())
}
func (this *QCommandLineOption) Swap(other *QCommandLineOption) {
C.QCommandLineOption_Swap(this.h, other.cPointer())
}
func (this *QCommandLineOption) Names() []string {
var _ma *C.struct_miqt_array = C.QCommandLineOption_Names(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 *QCommandLineOption) SetValueName(name string) {
name_ms := miqt_strdupg(name)
defer C.free(name_ms)
C.QCommandLineOption_SetValueName(this.h, (*C.struct_miqt_string)(name_ms))
}
func (this *QCommandLineOption) ValueName() string {
var _ms *C.struct_miqt_string = C.QCommandLineOption_ValueName(this.h)
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms))
return _ret
}
func (this *QCommandLineOption) SetDescription(description string) {
description_ms := miqt_strdupg(description)
defer C.free(description_ms)
C.QCommandLineOption_SetDescription(this.h, (*C.struct_miqt_string)(description_ms))
}
func (this *QCommandLineOption) Description() string {
var _ms *C.struct_miqt_string = C.QCommandLineOption_Description(this.h)
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms))
return _ret
}
func (this *QCommandLineOption) SetDefaultValue(defaultValue string) {
defaultValue_ms := miqt_strdupg(defaultValue)
defer C.free(defaultValue_ms)
C.QCommandLineOption_SetDefaultValue(this.h, (*C.struct_miqt_string)(defaultValue_ms))
}
func (this *QCommandLineOption) SetDefaultValues(defaultValues []string) {
// For the C ABI, malloc two C arrays; raw char* pointers and their lengths
defaultValues_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(defaultValues))))
defer C.free(unsafe.Pointer(defaultValues_CArray))
for i := range defaultValues {
single_ms := miqt_strdupg(defaultValues[i])
defer C.free(single_ms)
defaultValues_CArray[i] = (*C.struct_miqt_string)(single_ms)
}
defaultValues_ma := &C.struct_miqt_array{len: C.size_t(len(defaultValues)), data: unsafe.Pointer(defaultValues_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(defaultValues_ma))
C.QCommandLineOption_SetDefaultValues(this.h, defaultValues_ma)
}
func (this *QCommandLineOption) DefaultValues() []string {
var _ma *C.struct_miqt_array = C.QCommandLineOption_DefaultValues(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
}
2024-08-29 07:01:51 +00:00
func (this *QCommandLineOption) Flags() int {
_ret := C.QCommandLineOption_Flags(this.h)
return (int)(_ret)
2024-08-29 07:01:51 +00:00
}
func (this *QCommandLineOption) SetFlags(aflags int) {
C.QCommandLineOption_SetFlags(this.h, (C.int)(aflags))
}
func (this *QCommandLineOption) SetHidden(hidden bool) {
C.QCommandLineOption_SetHidden(this.h, (C.bool)(hidden))
}
func (this *QCommandLineOption) IsHidden() bool {
_ret := C.QCommandLineOption_IsHidden(this.h)
return (bool)(_ret)
}
// Delete this object from C++ memory.
func (this *QCommandLineOption) Delete() {
C.QCommandLineOption_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 *QCommandLineOption) GoGC() {
runtime.SetFinalizer(this, func(this *QCommandLineOption) {
this.Delete()
runtime.KeepAlive(this.h)
})
}