Skip to content

Commit

Permalink
Merge pull request #82 from rcalixte/qt6_cbor
Browse files Browse the repository at this point in the history
Modify qt6/cbor for proper builds
  • Loading branch information
mappu authored Nov 18, 2024
2 parents 4f57b3b + eada004 commit 30c6cb4
Show file tree
Hide file tree
Showing 10 changed files with 1,004 additions and 106 deletions.
4 changes: 2 additions & 2 deletions cmd/genbindings/config-libraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
generate(
"qt6/cbor",
[]string{
"/usr/include/x86_64-linux-gnu/qt5/QtCore",
"/usr/include/x86_64-linux-gnu/qt6/QtCore",
},
func(fullpath string) bool {
// Only include the same json, xml, cbor files excluded above
fname := filepath.Base(fullpath)
return strings.HasPrefix(fname, "qcbor")
},
clangBin,
pkgConfigCflags("Qt6Core"),
"--std=c++20 "+pkgConfigCflags("Qt6Core"),
outDir,
ClangMatchSameHeaderDefinitionOnly,
)
Expand Down
21 changes: 13 additions & 8 deletions qt6/cbor/gen_qcborarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define WORKAROUND_INNER_CLASS_DEFINITION_QCborArray__ConstIterator
#define WORKAROUND_INNER_CLASS_DEFINITION_QCborArray__Iterator
#include <QCborValue>
#include <QCborValueConstRef>
#include <QCborValueRef>
#include <QJsonArray>
#include <QList>
Expand Down Expand Up @@ -260,11 +261,15 @@ QCborValueRef* QCborArray__Iterator_OperatorMultiply(const QCborArray__Iterator*
return new QCborValueRef(self->operator*());
}

QCborValueRef* QCborArray__Iterator_OperatorMinusGreater(const QCborArray__Iterator* self) {
QCborValueRef* QCborArray__Iterator_OperatorMinusGreater(QCborArray__Iterator* self) {
return self->operator->();
}

QCborValueRef* QCborArray__Iterator_OperatorSubscript(QCborArray__Iterator* self, ptrdiff_t j) {
QCborValueConstRef* QCborArray__Iterator_OperatorMinusGreater2(const QCborArray__Iterator* self) {
return (QCborValueConstRef*) self->operator->();
}

QCborValueRef* QCborArray__Iterator_OperatorSubscript(const QCborArray__Iterator* self, ptrdiff_t j) {
return new QCborValueRef(self->operator[]((qsizetype)(j)));
}

Expand Down Expand Up @@ -377,16 +382,16 @@ void QCborArray__ConstIterator_OperatorAssign(QCborArray__ConstIterator* self, Q
self->operator=(*other);
}

QCborValueRef* QCborArray__ConstIterator_OperatorMultiply(const QCborArray__ConstIterator* self) {
return new QCborValueRef(self->operator*());
QCborValueConstRef* QCborArray__ConstIterator_OperatorMultiply(const QCborArray__ConstIterator* self) {
return new QCborValueConstRef(self->operator*());
}

QCborValueRef* QCborArray__ConstIterator_OperatorMinusGreater(const QCborArray__ConstIterator* self) {
return (QCborValueRef*) self->operator->();
QCborValueConstRef* QCborArray__ConstIterator_OperatorMinusGreater(const QCborArray__ConstIterator* self) {
return (QCborValueConstRef*) self->operator->();
}

QCborValueRef* QCborArray__ConstIterator_OperatorSubscript(QCborArray__ConstIterator* self, ptrdiff_t j) {
return new QCborValueRef(self->operator[]((qsizetype)(j)));
QCborValueConstRef* QCborArray__ConstIterator_OperatorSubscript(const QCborArray__ConstIterator* self, ptrdiff_t j) {
return new QCborValueConstRef(self->operator[]((qsizetype)(j)));
}

bool QCborArray__ConstIterator_OperatorEqual(const QCborArray__ConstIterator* self, QCborArray__Iterator* o) {
Expand Down
16 changes: 10 additions & 6 deletions qt6/cbor/gen_qcborarray.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ func (this *QCborArray__Iterator) OperatorMinusGreater() *QCborValueRef {
return UnsafeNewQCborValueRef(unsafe.Pointer(C.QCborArray__Iterator_OperatorMinusGreater(this.h)))
}

func (this *QCborArray__Iterator) OperatorMinusGreater2() *QCborValueConstRef {
return UnsafeNewQCborValueConstRef(unsafe.Pointer(C.QCborArray__Iterator_OperatorMinusGreater2(this.h)))
}

func (this *QCborArray__Iterator) OperatorSubscript(j int64) *QCborValueRef {
_ret := C.QCborArray__Iterator_OperatorSubscript(this.h, (C.ptrdiff_t)(j))
_goptr := newQCborValueRef(_ret)
Expand Down Expand Up @@ -592,20 +596,20 @@ func (this *QCborArray__ConstIterator) OperatorAssign(other *QCborArray__ConstIt
C.QCborArray__ConstIterator_OperatorAssign(this.h, other.cPointer())
}

func (this *QCborArray__ConstIterator) OperatorMultiply() *QCborValueRef {
func (this *QCborArray__ConstIterator) OperatorMultiply() *QCborValueConstRef {
_ret := C.QCborArray__ConstIterator_OperatorMultiply(this.h)
_goptr := newQCborValueRef(_ret)
_goptr := newQCborValueConstRef(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}

func (this *QCborArray__ConstIterator) OperatorMinusGreater() *QCborValueRef {
return UnsafeNewQCborValueRef(unsafe.Pointer(C.QCborArray__ConstIterator_OperatorMinusGreater(this.h)))
func (this *QCborArray__ConstIterator) OperatorMinusGreater() *QCborValueConstRef {
return UnsafeNewQCborValueConstRef(unsafe.Pointer(C.QCborArray__ConstIterator_OperatorMinusGreater(this.h)))
}

func (this *QCborArray__ConstIterator) OperatorSubscript(j int64) *QCborValueRef {
func (this *QCborArray__ConstIterator) OperatorSubscript(j int64) *QCborValueConstRef {
_ret := C.QCborArray__ConstIterator_OperatorSubscript(this.h, (C.ptrdiff_t)(j))
_goptr := newQCborValueRef(_ret)
_goptr := newQCborValueConstRef(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
Expand Down
13 changes: 8 additions & 5 deletions qt6/cbor/gen_qcborarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ typedef QCborArray::Iterator QCborArray__Iterator;
class QCborArray__Iterator;
#endif
class QCborValue;
class QCborValueConstRef;
class QCborValueRef;
class QJsonArray;
#else
typedef struct QCborArray QCborArray;
typedef struct QCborArray__ConstIterator QCborArray__ConstIterator;
typedef struct QCborArray__Iterator QCborArray__Iterator;
typedef struct QCborValue QCborValue;
typedef struct QCborValueConstRef QCborValueConstRef;
typedef struct QCborValueRef QCborValueRef;
typedef struct QJsonArray QJsonArray;
#endif
Expand Down Expand Up @@ -98,8 +100,9 @@ QCborArray__Iterator* QCborArray__Iterator_new();
QCborArray__Iterator* QCborArray__Iterator_new2(QCborArray__Iterator* param1);
void QCborArray__Iterator_OperatorAssign(QCborArray__Iterator* self, QCborArray__Iterator* other);
QCborValueRef* QCborArray__Iterator_OperatorMultiply(const QCborArray__Iterator* self);
QCborValueRef* QCborArray__Iterator_OperatorMinusGreater(const QCborArray__Iterator* self);
QCborValueRef* QCborArray__Iterator_OperatorSubscript(QCborArray__Iterator* self, ptrdiff_t j);
QCborValueRef* QCborArray__Iterator_OperatorMinusGreater(QCborArray__Iterator* self);
QCborValueConstRef* QCborArray__Iterator_OperatorMinusGreater2(const QCborArray__Iterator* self);
QCborValueRef* QCborArray__Iterator_OperatorSubscript(const QCborArray__Iterator* self, ptrdiff_t j);
bool QCborArray__Iterator_OperatorEqual(const QCborArray__Iterator* self, QCborArray__Iterator* o);
bool QCborArray__Iterator_OperatorNotEqual(const QCborArray__Iterator* self, QCborArray__Iterator* o);
bool QCborArray__Iterator_OperatorLesser(const QCborArray__Iterator* self, QCborArray__Iterator* other);
Expand All @@ -126,9 +129,9 @@ void QCborArray__Iterator_Delete(QCborArray__Iterator* self);
QCborArray__ConstIterator* QCborArray__ConstIterator_new();
QCborArray__ConstIterator* QCborArray__ConstIterator_new2(QCborArray__ConstIterator* param1);
void QCborArray__ConstIterator_OperatorAssign(QCborArray__ConstIterator* self, QCborArray__ConstIterator* other);
QCborValueRef* QCborArray__ConstIterator_OperatorMultiply(const QCborArray__ConstIterator* self);
QCborValueRef* QCborArray__ConstIterator_OperatorMinusGreater(const QCborArray__ConstIterator* self);
QCborValueRef* QCborArray__ConstIterator_OperatorSubscript(QCborArray__ConstIterator* self, ptrdiff_t j);
QCborValueConstRef* QCborArray__ConstIterator_OperatorMultiply(const QCborArray__ConstIterator* self);
QCborValueConstRef* QCborArray__ConstIterator_OperatorMinusGreater(const QCborArray__ConstIterator* self);
QCborValueConstRef* QCborArray__ConstIterator_OperatorSubscript(const QCborArray__ConstIterator* self, ptrdiff_t j);
bool QCborArray__ConstIterator_OperatorEqual(const QCborArray__ConstIterator* self, QCborArray__Iterator* o);
bool QCborArray__ConstIterator_OperatorNotEqual(const QCborArray__ConstIterator* self, QCborArray__Iterator* o);
bool QCborArray__ConstIterator_OperatorLesser(const QCborArray__ConstIterator* self, QCborArray__Iterator* other);
Expand Down
61 changes: 47 additions & 14 deletions qt6/cbor/gen_qcbormap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define WORKAROUND_INNER_CLASS_DEFINITION_QCborMap__ConstIterator
#define WORKAROUND_INNER_CLASS_DEFINITION_QCborMap__Iterator
#include <QCborValue>
#include <QCborValueConstRef>
#include <QCborValueRef>
#include <QJsonObject>
#include <QList>
Expand Down Expand Up @@ -48,7 +49,7 @@ void QCborMap_Clear(QCborMap* self) {
}

struct miqt_array /* of QCborValue* */ QCborMap_Keys(const QCborMap* self) {
QVector<QCborValue> _ret = self->keys();
QList<QCborValue> _ret = self->keys();
// Convert QList<> from C++ memory to manually-managed C memory
QCborValue** _arr = static_cast<QCborValue**>(malloc(sizeof(QCborValue*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
Expand Down Expand Up @@ -364,12 +365,12 @@ void QCborMap__Iterator_OperatorAssign(QCborMap__Iterator* self, QCborMap__Itera
self->operator=(*other);
}

struct miqt_map /* tuple of QCborValueRef* and QCborValueRef* */ QCborMap__Iterator_OperatorMultiply(const QCborMap__Iterator* self) {
struct miqt_map /* tuple of QCborValueConstRef* and QCborValueRef* */ QCborMap__Iterator_OperatorMultiply(const QCborMap__Iterator* self) {
QCborMap::Iterator::value_type _ret = self->operator*();
// Convert QPair<> from C++ memory to manually-managed C memory
QCborValueRef** _first_arr = static_cast<QCborValueRef**>(malloc(sizeof(QCborValueRef*)));
QCborValueConstRef** _first_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
QCborValueRef** _second_arr = static_cast<QCborValueRef**>(malloc(sizeof(QCborValueRef*)));
_first_arr[0] = new QCborValueRef(_ret.first);
_first_arr[0] = new QCborValueConstRef(_ret.first);
_second_arr[0] = new QCborValueRef(_ret.second);
struct miqt_map _out;
_out.len = 1;
Expand All @@ -378,10 +379,28 @@ struct miqt_map /* tuple of QCborValueRef* and QCborValueRef* */ QCborMap__Iter
return _out;
}

QCborValueRef* QCborMap__Iterator_OperatorMinusGreater(const QCborMap__Iterator* self) {
struct miqt_map /* tuple of QCborValueConstRef* and QCborValueRef* */ QCborMap__Iterator_OperatorSubscript(const QCborMap__Iterator* self, ptrdiff_t j) {
QCborMap::Iterator::value_type _ret = self->operator[]((qsizetype)(j));
// Convert QPair<> from C++ memory to manually-managed C memory
QCborValueConstRef** _first_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
QCborValueRef** _second_arr = static_cast<QCborValueRef**>(malloc(sizeof(QCborValueRef*)));
_first_arr[0] = new QCborValueConstRef(_ret.first);
_second_arr[0] = new QCborValueRef(_ret.second);
struct miqt_map _out;
_out.len = 1;
_out.keys = static_cast<void*>(_first_arr);
_out.values = static_cast<void*>(_second_arr);
return _out;
}

QCborValueRef* QCborMap__Iterator_OperatorMinusGreater(QCborMap__Iterator* self) {
return self->operator->();
}

QCborValueConstRef* QCborMap__Iterator_OperatorMinusGreater2(const QCborMap__Iterator* self) {
return (QCborValueConstRef*) self->operator->();
}

QCborValue* QCborMap__Iterator_Key(const QCborMap__Iterator* self) {
return new QCborValue(self->key());
}
Expand Down Expand Up @@ -499,30 +518,44 @@ void QCborMap__ConstIterator_OperatorAssign(QCborMap__ConstIterator* self, QCbor
self->operator=(*other);
}

struct miqt_map /* tuple of QCborValueRef* and QCborValueRef* */ QCborMap__ConstIterator_OperatorMultiply(const QCborMap__ConstIterator* self) {
struct miqt_map /* tuple of QCborValueConstRef* and QCborValueConstRef* */ QCborMap__ConstIterator_OperatorMultiply(const QCborMap__ConstIterator* self) {
QCborMap::ConstIterator::value_type _ret = self->operator*();
// Convert QPair<> from C++ memory to manually-managed C memory
QCborValueRef** _first_arr = static_cast<QCborValueRef**>(malloc(sizeof(QCborValueRef*)));
QCborValueRef** _second_arr = static_cast<QCborValueRef**>(malloc(sizeof(QCborValueRef*)));
_first_arr[0] = new QCborValueRef(_ret.first);
_second_arr[0] = new QCborValueRef(_ret.second);
QCborValueConstRef** _first_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
QCborValueConstRef** _second_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
_first_arr[0] = new QCborValueConstRef(_ret.first);
_second_arr[0] = new QCborValueConstRef(_ret.second);
struct miqt_map _out;
_out.len = 1;
_out.keys = static_cast<void*>(_first_arr);
_out.values = static_cast<void*>(_second_arr);
return _out;
}

QCborValueRef* QCborMap__ConstIterator_OperatorMinusGreater(const QCborMap__ConstIterator* self) {
return (QCborValueRef*) self->operator->();
struct miqt_map /* tuple of QCborValueConstRef* and QCborValueConstRef* */ QCborMap__ConstIterator_OperatorSubscript(const QCborMap__ConstIterator* self, ptrdiff_t j) {
QCborMap::ConstIterator::value_type _ret = self->operator[]((qsizetype)(j));
// Convert QPair<> from C++ memory to manually-managed C memory
QCborValueConstRef** _first_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
QCborValueConstRef** _second_arr = static_cast<QCborValueConstRef**>(malloc(sizeof(QCborValueConstRef*)));
_first_arr[0] = new QCborValueConstRef(_ret.first);
_second_arr[0] = new QCborValueConstRef(_ret.second);
struct miqt_map _out;
_out.len = 1;
_out.keys = static_cast<void*>(_first_arr);
_out.values = static_cast<void*>(_second_arr);
return _out;
}

QCborValueConstRef* QCborMap__ConstIterator_OperatorMinusGreater(const QCborMap__ConstIterator* self) {
return (QCborValueConstRef*) self->operator->();
}

QCborValue* QCborMap__ConstIterator_Key(const QCborMap__ConstIterator* self) {
return new QCborValue(self->key());
}

QCborValueRef* QCborMap__ConstIterator_Value(const QCborMap__ConstIterator* self) {
return new QCborValueRef(self->value());
QCborValueConstRef* QCborMap__ConstIterator_Value(const QCborMap__ConstIterator* self) {
return new QCborValueConstRef(self->value());
}

bool QCborMap__ConstIterator_OperatorEqual(const QCborMap__ConstIterator* self, QCborMap__Iterator* o) {
Expand Down
Loading

0 comments on commit 30c6cb4

Please sign in to comment.