miqt/qt/gen_qjsondocument.go

366 lines
11 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qjsondocument.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
2024-09-04 06:54:22 +00:00
type QJsonParseError__ParseError int
const (
2024-09-20 07:13:26 +00:00
QJsonParseError__NoError QJsonParseError__ParseError = 0
QJsonParseError__UnterminatedObject QJsonParseError__ParseError = 1
QJsonParseError__MissingNameSeparator QJsonParseError__ParseError = 2
QJsonParseError__UnterminatedArray QJsonParseError__ParseError = 3
QJsonParseError__MissingValueSeparator QJsonParseError__ParseError = 4
QJsonParseError__IllegalValue QJsonParseError__ParseError = 5
QJsonParseError__TerminationByNumber QJsonParseError__ParseError = 6
QJsonParseError__IllegalNumber QJsonParseError__ParseError = 7
QJsonParseError__IllegalEscapeSequence QJsonParseError__ParseError = 8
QJsonParseError__IllegalUTF8String QJsonParseError__ParseError = 9
QJsonParseError__UnterminatedString QJsonParseError__ParseError = 10
QJsonParseError__MissingObject QJsonParseError__ParseError = 11
QJsonParseError__DeepNesting QJsonParseError__ParseError = 12
QJsonParseError__DocumentTooLarge QJsonParseError__ParseError = 13
QJsonParseError__GarbageAtEnd QJsonParseError__ParseError = 14
2024-09-04 06:54:22 +00:00
)
type QJsonDocument__DataValidation int
const (
2024-09-20 07:13:26 +00:00
QJsonDocument__Validate QJsonDocument__DataValidation = 0
QJsonDocument__BypassValidation QJsonDocument__DataValidation = 1
2024-09-04 06:54:22 +00:00
)
type QJsonDocument__JsonFormat int
const (
2024-09-20 07:13:26 +00:00
QJsonDocument__Indented QJsonDocument__JsonFormat = 0
QJsonDocument__Compact QJsonDocument__JsonFormat = 1
2024-09-04 06:54:22 +00:00
)
type QJsonParseError struct {
2024-11-19 06:29:06 +00:00
h *C.QJsonParseError
isSubclass bool
}
func (this *QJsonParseError) cPointer() *C.QJsonParseError {
if this == nil {
return nil
}
return this.h
}
func (this *QJsonParseError) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQJsonParseError constructs the type using only CGO pointers.
func newQJsonParseError(h *C.QJsonParseError) *QJsonParseError {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QJsonParseError{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQJsonParseError constructs the type using only unsafe pointers.
func UnsafeNewQJsonParseError(h unsafe.Pointer) *QJsonParseError {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QJsonParseError{h: (*C.QJsonParseError)(h)}
}
func (this *QJsonParseError) ErrorString() string {
var _ms C.struct_miqt_string = C.QJsonParseError_ErrorString(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
// Delete this object from C++ memory.
func (this *QJsonParseError) Delete() {
2024-11-19 06:29:06 +00:00
C.QJsonParseError_Delete(this.h, C.bool(this.isSubclass))
}
// 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 *QJsonParseError) GoGC() {
runtime.SetFinalizer(this, func(this *QJsonParseError) {
this.Delete()
runtime.KeepAlive(this.h)
})
}
type QJsonDocument struct {
2024-11-19 06:29:06 +00:00
h *C.QJsonDocument
isSubclass bool
}
func (this *QJsonDocument) cPointer() *C.QJsonDocument {
if this == nil {
return nil
}
return this.h
}
func (this *QJsonDocument) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQJsonDocument constructs the type using only CGO pointers.
func newQJsonDocument(h *C.QJsonDocument) *QJsonDocument {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QJsonDocument{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQJsonDocument constructs the type using only unsafe pointers.
func UnsafeNewQJsonDocument(h unsafe.Pointer) *QJsonDocument {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QJsonDocument{h: (*C.QJsonDocument)(h)}
}
// NewQJsonDocument constructs a new QJsonDocument object.
func NewQJsonDocument() *QJsonDocument {
2024-11-19 06:29:06 +00:00
var outptr_QJsonDocument *C.QJsonDocument = nil
C.QJsonDocument_new(&outptr_QJsonDocument)
ret := newQJsonDocument(outptr_QJsonDocument)
ret.isSubclass = true
return ret
}
// NewQJsonDocument2 constructs a new QJsonDocument object.
func NewQJsonDocument2(object *QJsonObject) *QJsonDocument {
2024-11-19 06:29:06 +00:00
var outptr_QJsonDocument *C.QJsonDocument = nil
C.QJsonDocument_new2(object.cPointer(), &outptr_QJsonDocument)
ret := newQJsonDocument(outptr_QJsonDocument)
ret.isSubclass = true
return ret
}
// NewQJsonDocument3 constructs a new QJsonDocument object.
func NewQJsonDocument3(array *QJsonArray) *QJsonDocument {
2024-11-19 06:29:06 +00:00
var outptr_QJsonDocument *C.QJsonDocument = nil
C.QJsonDocument_new3(array.cPointer(), &outptr_QJsonDocument)
ret := newQJsonDocument(outptr_QJsonDocument)
ret.isSubclass = true
return ret
}
// NewQJsonDocument4 constructs a new QJsonDocument object.
func NewQJsonDocument4(other *QJsonDocument) *QJsonDocument {
2024-11-19 06:29:06 +00:00
var outptr_QJsonDocument *C.QJsonDocument = nil
C.QJsonDocument_new4(other.cPointer(), &outptr_QJsonDocument)
ret := newQJsonDocument(outptr_QJsonDocument)
ret.isSubclass = true
return ret
}
func (this *QJsonDocument) OperatorAssign(other *QJsonDocument) {
C.QJsonDocument_OperatorAssign(this.h, other.cPointer())
}
func (this *QJsonDocument) Swap(other *QJsonDocument) {
C.QJsonDocument_Swap(this.h, other.cPointer())
}
2024-08-29 07:01:51 +00:00
func QJsonDocument_FromRawData(data string, size int) *QJsonDocument {
data_Cstring := C.CString(data)
defer C.free(unsafe.Pointer(data_Cstring))
_ret := C.QJsonDocument_FromRawData(data_Cstring, (C.int)(size))
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
2024-08-29 07:01:51 +00:00
}
func (this *QJsonDocument) RawData(size *int) string {
_ret := C.QJsonDocument_RawData(this.h, (*C.int)(unsafe.Pointer(size)))
return C.GoString(_ret)
}
func QJsonDocument_FromBinaryData(data []byte) *QJsonDocument {
data_alias := C.struct_miqt_string{}
data_alias.data = (*C.char)(unsafe.Pointer(&data[0]))
data_alias.len = C.size_t(len(data))
_ret := C.QJsonDocument_FromBinaryData(data_alias)
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
2024-08-29 07:01:51 +00:00
}
func (this *QJsonDocument) ToBinaryData() []byte {
var _bytearray C.struct_miqt_string = C.QJsonDocument_ToBinaryData(this.h)
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
}
func QJsonDocument_FromVariant(variant *QVariant) *QJsonDocument {
_ret := C.QJsonDocument_FromVariant(variant.cPointer())
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) ToVariant() *QVariant {
_ret := C.QJsonDocument_ToVariant(this.h)
_goptr := newQVariant(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QJsonDocument_FromJson(json []byte) *QJsonDocument {
json_alias := C.struct_miqt_string{}
json_alias.data = (*C.char)(unsafe.Pointer(&json[0]))
json_alias.len = C.size_t(len(json))
_ret := C.QJsonDocument_FromJson(json_alias)
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) ToJson() []byte {
var _bytearray C.struct_miqt_string = C.QJsonDocument_ToJson(this.h)
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
}
func (this *QJsonDocument) ToJsonWithFormat(format QJsonDocument__JsonFormat) []byte {
var _bytearray C.struct_miqt_string = C.QJsonDocument_ToJsonWithFormat(this.h, (C.int)(format))
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
2024-08-29 07:01:51 +00:00
}
func (this *QJsonDocument) IsEmpty() bool {
return (bool)(C.QJsonDocument_IsEmpty(this.h))
}
func (this *QJsonDocument) IsArray() bool {
return (bool)(C.QJsonDocument_IsArray(this.h))
}
func (this *QJsonDocument) IsObject() bool {
return (bool)(C.QJsonDocument_IsObject(this.h))
}
func (this *QJsonDocument) Object() *QJsonObject {
_ret := C.QJsonDocument_Object(this.h)
_goptr := newQJsonObject(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) Array() *QJsonArray {
_ret := C.QJsonDocument_Array(this.h)
_goptr := newQJsonArray(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) SetObject(object *QJsonObject) {
C.QJsonDocument_SetObject(this.h, object.cPointer())
}
func (this *QJsonDocument) SetArray(array *QJsonArray) {
C.QJsonDocument_SetArray(this.h, array.cPointer())
}
func (this *QJsonDocument) OperatorSubscript(key string) *QJsonValue {
key_ms := C.struct_miqt_string{}
key_ms.data = C.CString(key)
key_ms.len = C.size_t(len(key))
defer C.free(unsafe.Pointer(key_ms.data))
_ret := C.QJsonDocument_OperatorSubscript(this.h, key_ms)
_goptr := newQJsonValue(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) OperatorSubscriptWithInt(i int) *QJsonValue {
_ret := C.QJsonDocument_OperatorSubscriptWithInt(this.h, (C.int)(i))
_goptr := newQJsonValue(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QJsonDocument) OperatorEqual(other *QJsonDocument) bool {
return (bool)(C.QJsonDocument_OperatorEqual(this.h, other.cPointer()))
}
func (this *QJsonDocument) OperatorNotEqual(other *QJsonDocument) bool {
return (bool)(C.QJsonDocument_OperatorNotEqual(this.h, other.cPointer()))
}
func (this *QJsonDocument) IsNull() bool {
return (bool)(C.QJsonDocument_IsNull(this.h))
}
2024-09-04 06:54:22 +00:00
func QJsonDocument_FromRawData3(data string, size int, validation QJsonDocument__DataValidation) *QJsonDocument {
2024-08-29 07:01:51 +00:00
data_Cstring := C.CString(data)
defer C.free(unsafe.Pointer(data_Cstring))
_ret := C.QJsonDocument_FromRawData3(data_Cstring, (C.int)(size), (C.int)(validation))
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
2024-08-29 07:01:51 +00:00
}
func QJsonDocument_FromBinaryData2(data []byte, validation QJsonDocument__DataValidation) *QJsonDocument {
data_alias := C.struct_miqt_string{}
data_alias.data = (*C.char)(unsafe.Pointer(&data[0]))
data_alias.len = C.size_t(len(data))
_ret := C.QJsonDocument_FromBinaryData2(data_alias, (C.int)(validation))
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
2024-08-29 07:01:51 +00:00
}
func QJsonDocument_FromJson2(json []byte, error *QJsonParseError) *QJsonDocument {
json_alias := C.struct_miqt_string{}
json_alias.data = (*C.char)(unsafe.Pointer(&json[0]))
json_alias.len = C.size_t(len(json))
_ret := C.QJsonDocument_FromJson2(json_alias, error.cPointer())
_goptr := newQJsonDocument(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
// Delete this object from C++ memory.
func (this *QJsonDocument) Delete() {
2024-11-19 06:29:06 +00:00
C.QJsonDocument_Delete(this.h, C.bool(this.isSubclass))
}
// 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 *QJsonDocument) GoGC() {
runtime.SetFinalizer(this, func(this *QJsonDocument) {
this.Delete()
runtime.KeepAlive(this.h)
})
}