package qt6

/*

#include "gen_qstringconverter_base.h"
#include <stdlib.h>

*/
import "C"

import (
	"runtime"
	"unsafe"
)

type QStringConverterBase__Flag int

const (
	QStringConverterBase__Default              QStringConverterBase__Flag = 0
	QStringConverterBase__Stateless            QStringConverterBase__Flag = 1
	QStringConverterBase__ConvertInvalidToNull QStringConverterBase__Flag = 2
	QStringConverterBase__WriteBom             QStringConverterBase__Flag = 4
	QStringConverterBase__ConvertInitialBom    QStringConverterBase__Flag = 8
	QStringConverterBase__UsesIcu              QStringConverterBase__Flag = 16
)

type QStringConverter__Encoding int

const (
	QStringConverter__Utf8         QStringConverter__Encoding = 0
	QStringConverter__Utf16        QStringConverter__Encoding = 1
	QStringConverter__Utf16LE      QStringConverter__Encoding = 2
	QStringConverter__Utf16BE      QStringConverter__Encoding = 3
	QStringConverter__Utf32        QStringConverter__Encoding = 4
	QStringConverter__Utf32LE      QStringConverter__Encoding = 5
	QStringConverter__Utf32BE      QStringConverter__Encoding = 6
	QStringConverter__Latin1       QStringConverter__Encoding = 7
	QStringConverter__System       QStringConverter__Encoding = 8
	QStringConverter__LastEncoding QStringConverter__Encoding = 8
)

type QStringConverterBase struct {
	h          *C.QStringConverterBase
	isSubclass bool
}

func (this *QStringConverterBase) cPointer() *C.QStringConverterBase {
	if this == nil {
		return nil
	}
	return this.h
}

func (this *QStringConverterBase) UnsafePointer() unsafe.Pointer {
	if this == nil {
		return nil
	}
	return unsafe.Pointer(this.h)
}

// newQStringConverterBase constructs the type using only CGO pointers.
func newQStringConverterBase(h *C.QStringConverterBase) *QStringConverterBase {
	if h == nil {
		return nil
	}
	return &QStringConverterBase{h: h}
}

// UnsafeNewQStringConverterBase constructs the type using only unsafe pointers.
func UnsafeNewQStringConverterBase(h unsafe.Pointer) *QStringConverterBase {
	if h == nil {
		return nil
	}

	return &QStringConverterBase{h: (*C.QStringConverterBase)(h)}
}

// NewQStringConverterBase constructs a new QStringConverterBase object.
func NewQStringConverterBase(param1 *QStringConverterBase) *QStringConverterBase {
	var outptr_QStringConverterBase *C.QStringConverterBase = nil

	C.QStringConverterBase_new(param1.cPointer(), &outptr_QStringConverterBase)
	ret := newQStringConverterBase(outptr_QStringConverterBase)
	ret.isSubclass = true
	return ret
}

// NewQStringConverterBase2 constructs a new QStringConverterBase object.
func NewQStringConverterBase2() *QStringConverterBase {
	var outptr_QStringConverterBase *C.QStringConverterBase = nil

	C.QStringConverterBase_new2(&outptr_QStringConverterBase)
	ret := newQStringConverterBase(outptr_QStringConverterBase)
	ret.isSubclass = true
	return ret
}

type QStringConverter struct {
	h          *C.QStringConverter
	isSubclass bool
	*QStringConverterBase
}

func (this *QStringConverter) cPointer() *C.QStringConverter {
	if this == nil {
		return nil
	}
	return this.h
}

func (this *QStringConverter) UnsafePointer() unsafe.Pointer {
	if this == nil {
		return nil
	}
	return unsafe.Pointer(this.h)
}

// newQStringConverter constructs the type using only CGO pointers.
func newQStringConverter(h *C.QStringConverter, h_QStringConverterBase *C.QStringConverterBase) *QStringConverter {
	if h == nil {
		return nil
	}
	return &QStringConverter{h: h,
		QStringConverterBase: newQStringConverterBase(h_QStringConverterBase)}
}

// UnsafeNewQStringConverter constructs the type using only unsafe pointers.
func UnsafeNewQStringConverter(h unsafe.Pointer, h_QStringConverterBase unsafe.Pointer) *QStringConverter {
	if h == nil {
		return nil
	}

	return &QStringConverter{h: (*C.QStringConverter)(h),
		QStringConverterBase: UnsafeNewQStringConverterBase(h_QStringConverterBase)}
}

func (this *QStringConverter) IsValid() bool {
	return (bool)(C.QStringConverter_IsValid(this.h))
}

func (this *QStringConverter) ResetState() {
	C.QStringConverter_ResetState(this.h)
}

func (this *QStringConverter) HasError() bool {
	return (bool)(C.QStringConverter_HasError(this.h))
}

func (this *QStringConverter) Name() string {
	_ret := C.QStringConverter_Name(this.h)
	return C.GoString(_ret)
}

func QStringConverter_NameForEncoding(e QStringConverter__Encoding) string {
	_ret := C.QStringConverter_NameForEncoding((C.int)(e))
	return C.GoString(_ret)
}

type QStringConverterBase__State struct {
	h          *C.QStringConverterBase__State
	isSubclass bool
}

func (this *QStringConverterBase__State) cPointer() *C.QStringConverterBase__State {
	if this == nil {
		return nil
	}
	return this.h
}

func (this *QStringConverterBase__State) UnsafePointer() unsafe.Pointer {
	if this == nil {
		return nil
	}
	return unsafe.Pointer(this.h)
}

// newQStringConverterBase__State constructs the type using only CGO pointers.
func newQStringConverterBase__State(h *C.QStringConverterBase__State) *QStringConverterBase__State {
	if h == nil {
		return nil
	}
	return &QStringConverterBase__State{h: h}
}

// UnsafeNewQStringConverterBase__State constructs the type using only unsafe pointers.
func UnsafeNewQStringConverterBase__State(h unsafe.Pointer) *QStringConverterBase__State {
	if h == nil {
		return nil
	}

	return &QStringConverterBase__State{h: (*C.QStringConverterBase__State)(h)}
}

// NewQStringConverterBase__State constructs a new QStringConverterBase::State object.
func NewQStringConverterBase__State() *QStringConverterBase__State {
	var outptr_QStringConverterBase__State *C.QStringConverterBase__State = nil

	C.QStringConverterBase__State_new(&outptr_QStringConverterBase__State)
	ret := newQStringConverterBase__State(outptr_QStringConverterBase__State)
	ret.isSubclass = true
	return ret
}

// NewQStringConverterBase__State2 constructs a new QStringConverterBase::State object.
func NewQStringConverterBase__State2(f QStringConverterBase__Flag) *QStringConverterBase__State {
	var outptr_QStringConverterBase__State *C.QStringConverterBase__State = nil

	C.QStringConverterBase__State_new2((C.int)(f), &outptr_QStringConverterBase__State)
	ret := newQStringConverterBase__State(outptr_QStringConverterBase__State)
	ret.isSubclass = true
	return ret
}

func (this *QStringConverterBase__State) Clear() {
	C.QStringConverterBase__State_Clear(this.h)
}

func (this *QStringConverterBase__State) Reset() {
	C.QStringConverterBase__State_Reset(this.h)
}

// Delete this object from C++ memory.
func (this *QStringConverterBase__State) Delete() {
	C.QStringConverterBase__State_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 *QStringConverterBase__State) GoGC() {
	runtime.SetFinalizer(this, func(this *QStringConverterBase__State) {
		this.Delete()
		runtime.KeepAlive(this.h)
	})
}