2017-08-11 12:55:51 -07:00
|
|
|
/* generated by rust_qt_binding_generator */
|
|
|
|
#include "test_object_types_rust.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
struct qbytearray_t {
|
|
|
|
private:
|
|
|
|
const char* data;
|
|
|
|
int len;
|
|
|
|
public:
|
|
|
|
qbytearray_t(const QByteArray& v):
|
|
|
|
data(v.data()),
|
|
|
|
len(v.size()) {
|
|
|
|
}
|
|
|
|
operator QByteArray() const {
|
|
|
|
return QByteArray(data, len);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
struct qstring_t {
|
|
|
|
private:
|
|
|
|
const void* data;
|
|
|
|
int len;
|
|
|
|
public:
|
|
|
|
qstring_t(const QString& v):
|
|
|
|
data(static_cast<const void*>(v.utf16())),
|
|
|
|
len(v.size()) {
|
|
|
|
}
|
|
|
|
operator QString() const {
|
|
|
|
return QString::fromUtf8(static_cast<const char*>(data), len);
|
|
|
|
}
|
|
|
|
};
|
2017-08-13 08:01:52 -07:00
|
|
|
struct qmodelindex_t {
|
|
|
|
int row;
|
|
|
|
quintptr id;
|
|
|
|
};
|
2017-08-11 12:55:51 -07:00
|
|
|
}
|
|
|
|
typedef void (*qstring_set)(QString*, qstring_t*);
|
|
|
|
void set_qstring(QString* v, qstring_t* val) {
|
|
|
|
*v = *val;
|
|
|
|
}
|
|
|
|
typedef void (*qbytearray_set)(QByteArray*, qbytearray_t*);
|
|
|
|
void set_qbytearray(QByteArray* v, qbytearray_t* val) {
|
|
|
|
*v = *val;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" {
|
2017-08-12 10:21:35 -07:00
|
|
|
ObjectInterface* object_new(Object*, void (*)(Object*), void (*)(Object*), void (*)(Object*), void (*)(Object*), void (*)(Object*));
|
2017-08-12 03:49:37 -07:00
|
|
|
void object_free(ObjectInterface*);
|
2017-08-12 10:21:35 -07:00
|
|
|
bool object_boolean_get(ObjectInterface*);
|
|
|
|
void object_boolean_set(void*, bool);
|
|
|
|
int object_integer_get(ObjectInterface*);
|
|
|
|
void object_integer_set(void*, int);
|
|
|
|
uint object_uinteger_get(ObjectInterface*);
|
|
|
|
void object_uinteger_set(void*, uint);
|
|
|
|
void object_string_get(ObjectInterface*, QString*, qstring_set);
|
|
|
|
void object_string_set(void*, qstring_t);
|
|
|
|
void object_bytearray_get(ObjectInterface*, QByteArray*, qbytearray_set);
|
|
|
|
void object_bytearray_set(void*, qbytearray_t);
|
2017-08-11 12:55:51 -07:00
|
|
|
};
|
2017-08-12 03:49:37 -07:00
|
|
|
Object::Object(QObject *parent):
|
2017-08-11 12:55:51 -07:00
|
|
|
QObject(parent),
|
2017-08-12 03:49:37 -07:00
|
|
|
d(object_new(this,
|
2017-08-12 10:21:35 -07:00
|
|
|
[](Object* o) { emit o->booleanChanged(); },
|
|
|
|
[](Object* o) { emit o->integerChanged(); },
|
|
|
|
[](Object* o) { emit o->uintegerChanged(); },
|
|
|
|
[](Object* o) { emit o->stringChanged(); },
|
|
|
|
[](Object* o) { emit o->bytearrayChanged(); })) {}
|
2017-08-11 12:55:51 -07:00
|
|
|
|
2017-08-12 03:49:37 -07:00
|
|
|
Object::~Object() {
|
|
|
|
object_free(d);
|
2017-08-11 12:55:51 -07:00
|
|
|
}
|
2017-08-12 10:21:35 -07:00
|
|
|
bool Object::boolean() const
|
2017-08-11 12:55:51 -07:00
|
|
|
{
|
2017-08-12 10:21:35 -07:00
|
|
|
return object_boolean_get(d);
|
|
|
|
}
|
|
|
|
void Object::setBoolean(bool v) {
|
|
|
|
object_boolean_set(d, v);
|
|
|
|
}
|
|
|
|
int Object::integer() const
|
|
|
|
{
|
|
|
|
return object_integer_get(d);
|
|
|
|
}
|
|
|
|
void Object::setInteger(int v) {
|
|
|
|
object_integer_set(d, v);
|
|
|
|
}
|
|
|
|
uint Object::uinteger() const
|
|
|
|
{
|
|
|
|
return object_uinteger_get(d);
|
|
|
|
}
|
|
|
|
void Object::setUinteger(uint v) {
|
|
|
|
object_uinteger_set(d, v);
|
|
|
|
}
|
|
|
|
QString Object::string() const
|
|
|
|
{
|
|
|
|
QString v;
|
|
|
|
object_string_get(d, &v, set_qstring);
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
void Object::setString(const QString& v) {
|
|
|
|
object_string_set(d, v);
|
|
|
|
}
|
|
|
|
QByteArray Object::bytearray() const
|
|
|
|
{
|
|
|
|
QByteArray v;
|
|
|
|
object_bytearray_get(d, &v, set_qbytearray);
|
2017-08-11 12:55:51 -07:00
|
|
|
return v;
|
|
|
|
}
|
2017-08-12 10:21:35 -07:00
|
|
|
void Object::setBytearray(const QByteArray& v) {
|
|
|
|
object_bytearray_set(d, v);
|
2017-08-11 12:55:51 -07:00
|
|
|
}
|