Skip to content

Commit

Permalink
added callbacks for virtual destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
therecipe committed Aug 26, 2016
1 parent c4e5523 commit 634982b
Show file tree
Hide file tree
Showing 100 changed files with 10,655 additions and 829 deletions.
12 changes: 12 additions & 0 deletions bluetooth/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ class MyQBluetoothLocalDevice: public QBluetoothLocalDevice
void Signal_PairingDisplayConfirmation(const QBluetoothAddress & address, QString pin) { callbackQBluetoothLocalDevice_PairingDisplayConfirmation(this, const_cast<QBluetoothAddress*>(&address), const_cast<char*>(pin.toUtf8().constData())); };
void Signal_PairingDisplayPinCode(const QBluetoothAddress & address, QString pin) { callbackQBluetoothLocalDevice_PairingDisplayPinCode(this, const_cast<QBluetoothAddress*>(&address), const_cast<char*>(pin.toUtf8().constData())); };
void Signal_PairingFinished(const QBluetoothAddress & address, QBluetoothLocalDevice::Pairing pairing) { callbackQBluetoothLocalDevice_PairingFinished(this, const_cast<QBluetoothAddress*>(&address), pairing); };
~MyQBluetoothLocalDevice() { callbackQBluetoothLocalDevice_DestroyQBluetoothLocalDevice(this); };
void pairingConfirmation(bool accept) { callbackQBluetoothLocalDevice_PairingConfirmation(this, accept); };
void timerEvent(QTimerEvent * event) { callbackQBluetoothLocalDevice_TimerEvent(this, event); };
void childEvent(QChildEvent * event) { callbackQBluetoothLocalDevice_ChildEvent(this, event); };
Expand Down Expand Up @@ -585,6 +586,11 @@ void QBluetoothLocalDevice_DestroyQBluetoothLocalDevice(void* ptr)
static_cast<QBluetoothLocalDevice*>(ptr)->~QBluetoothLocalDevice();
}

void QBluetoothLocalDevice_DestroyQBluetoothLocalDeviceDefault(void* ptr)
{

}

void* QBluetoothLocalDevice_NewQBluetoothLocalDevice(void* parent)
{
return new MyQBluetoothLocalDevice(static_cast<QObject*>(parent));
Expand Down Expand Up @@ -1329,6 +1335,7 @@ class MyQBluetoothSocket: public QBluetoothSocket
bool canReadLine() const { return callbackQBluetoothSocket_CanReadLine(const_cast<MyQBluetoothSocket*>(this)) != 0; };
void close() { callbackQBluetoothSocket_Close(this); };
qint64 writeData(const char * data, qint64 maxSize) { return callbackQBluetoothSocket_WriteData(this, const_cast<char*>(QString(data).toUtf8().constData()), maxSize); };
~MyQBluetoothSocket() { callbackQBluetoothSocket_DestroyQBluetoothSocket(this); };
bool atEnd() const { return callbackQBluetoothSocket_AtEnd(const_cast<MyQBluetoothSocket*>(this)) != 0; };
bool open(QIODevice::OpenMode mode) { return callbackQBluetoothSocket_Open(this, mode) != 0; };
qint64 pos() const { return callbackQBluetoothSocket_Pos(const_cast<MyQBluetoothSocket*>(this)); };
Expand Down Expand Up @@ -1579,6 +1586,11 @@ void QBluetoothSocket_DestroyQBluetoothSocket(void* ptr)
static_cast<QBluetoothSocket*>(ptr)->~QBluetoothSocket();
}

void QBluetoothSocket_DestroyQBluetoothSocketDefault(void* ptr)
{

}

char QBluetoothSocket_AtEnd(void* ptr)
{
return static_cast<QBluetoothSocket*>(ptr)->atEnd();
Expand Down
78 changes: 78 additions & 0 deletions bluetooth/bluetooth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,35 @@ func (ptr *QBluetoothLocalDevice) IsValid() bool {
return false
}

//export callbackQBluetoothLocalDevice_DestroyQBluetoothLocalDevice
func callbackQBluetoothLocalDevice_DestroyQBluetoothLocalDevice(ptr unsafe.Pointer) {
defer qt.Recovering("callback QBluetoothLocalDevice::~QBluetoothLocalDevice")

if signal := qt.GetSignal(fmt.Sprint(ptr), "QBluetoothLocalDevice::~QBluetoothLocalDevice"); signal != nil {
signal.(func())()
} else {
NewQBluetoothLocalDeviceFromPointer(ptr).DestroyQBluetoothLocalDeviceDefault()
}
}

func (ptr *QBluetoothLocalDevice) ConnectDestroyQBluetoothLocalDevice(f func()) {
defer qt.Recovering("connect QBluetoothLocalDevice::~QBluetoothLocalDevice")

if ptr.Pointer() != nil {

qt.ConnectSignal(fmt.Sprint(ptr.Pointer()), "QBluetoothLocalDevice::~QBluetoothLocalDevice", f)
}
}

func (ptr *QBluetoothLocalDevice) DisconnectDestroyQBluetoothLocalDevice() {
defer qt.Recovering("disconnect QBluetoothLocalDevice::~QBluetoothLocalDevice")

if ptr.Pointer() != nil {

qt.DisconnectSignal(fmt.Sprint(ptr.Pointer()), "QBluetoothLocalDevice::~QBluetoothLocalDevice")
}
}

func (ptr *QBluetoothLocalDevice) DestroyQBluetoothLocalDevice() {
defer qt.Recovering("QBluetoothLocalDevice::~QBluetoothLocalDevice")

Expand All @@ -1740,6 +1769,16 @@ func (ptr *QBluetoothLocalDevice) DestroyQBluetoothLocalDevice() {
}
}

func (ptr *QBluetoothLocalDevice) DestroyQBluetoothLocalDeviceDefault() {
defer qt.Recovering("QBluetoothLocalDevice::~QBluetoothLocalDevice")

if ptr.Pointer() != nil {
C.QBluetoothLocalDevice_DestroyQBluetoothLocalDeviceDefault(ptr.Pointer())
qt.DisconnectAllSignals(fmt.Sprint(ptr.Pointer()))
ptr.SetPointer(nil)
}
}

func NewQBluetoothLocalDevice(parent core.QObject_ITF) *QBluetoothLocalDevice {
defer qt.Recovering("QBluetoothLocalDevice::QBluetoothLocalDevice")

Expand Down Expand Up @@ -4722,6 +4761,35 @@ func (ptr *QBluetoothSocket) WriteDataDefault(data string, maxSize int64) int64
return 0
}

//export callbackQBluetoothSocket_DestroyQBluetoothSocket
func callbackQBluetoothSocket_DestroyQBluetoothSocket(ptr unsafe.Pointer) {
defer qt.Recovering("callback QBluetoothSocket::~QBluetoothSocket")

if signal := qt.GetSignal(fmt.Sprint(ptr), "QBluetoothSocket::~QBluetoothSocket"); signal != nil {
signal.(func())()
} else {
NewQBluetoothSocketFromPointer(ptr).DestroyQBluetoothSocketDefault()
}
}

func (ptr *QBluetoothSocket) ConnectDestroyQBluetoothSocket(f func()) {
defer qt.Recovering("connect QBluetoothSocket::~QBluetoothSocket")

if ptr.Pointer() != nil {

qt.ConnectSignal(fmt.Sprint(ptr.Pointer()), "QBluetoothSocket::~QBluetoothSocket", f)
}
}

func (ptr *QBluetoothSocket) DisconnectDestroyQBluetoothSocket() {
defer qt.Recovering("disconnect QBluetoothSocket::~QBluetoothSocket")

if ptr.Pointer() != nil {

qt.DisconnectSignal(fmt.Sprint(ptr.Pointer()), "QBluetoothSocket::~QBluetoothSocket")
}
}

func (ptr *QBluetoothSocket) DestroyQBluetoothSocket() {
defer qt.Recovering("QBluetoothSocket::~QBluetoothSocket")

Expand All @@ -4732,6 +4800,16 @@ func (ptr *QBluetoothSocket) DestroyQBluetoothSocket() {
}
}

func (ptr *QBluetoothSocket) DestroyQBluetoothSocketDefault() {
defer qt.Recovering("QBluetoothSocket::~QBluetoothSocket")

if ptr.Pointer() != nil {
C.QBluetoothSocket_DestroyQBluetoothSocketDefault(ptr.Pointer())
qt.DisconnectAllSignals(fmt.Sprint(ptr.Pointer()))
ptr.SetPointer(nil)
}
}

//export callbackQBluetoothSocket_AtEnd
func callbackQBluetoothSocket_AtEnd(ptr unsafe.Pointer) C.char {
defer qt.Recovering("callback QBluetoothSocket::atEnd")
Expand Down
2 changes: 2 additions & 0 deletions bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void QBluetoothLocalDevice_DisconnectPairingFinished(void* ptr);
void QBluetoothLocalDevice_PairingFinished(void* ptr, void* address, long long pairing);
char QBluetoothLocalDevice_IsValid(void* ptr);
void QBluetoothLocalDevice_DestroyQBluetoothLocalDevice(void* ptr);
void QBluetoothLocalDevice_DestroyQBluetoothLocalDeviceDefault(void* ptr);
void* QBluetoothLocalDevice_NewQBluetoothLocalDevice(void* parent);
void* QBluetoothLocalDevice_NewQBluetoothLocalDevice2(void* address, void* parent);
void* QBluetoothLocalDevice_Address(void* ptr);
Expand Down Expand Up @@ -294,6 +295,7 @@ long long QBluetoothSocket_State(void* ptr);
long long QBluetoothSocket_WriteData(void* ptr, char* data, long long maxSize);
long long QBluetoothSocket_WriteDataDefault(void* ptr, char* data, long long maxSize);
void QBluetoothSocket_DestroyQBluetoothSocket(void* ptr);
void QBluetoothSocket_DestroyQBluetoothSocketDefault(void* ptr);
char QBluetoothSocket_AtEnd(void* ptr);
char QBluetoothSocket_AtEndDefault(void* ptr);
char QBluetoothSocket_Open(void* ptr, long long mode);
Expand Down
Loading

0 comments on commit 634982b

Please sign in to comment.