From 3857a48d865eba357b46f9f5eb0c7820004828ed Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Sat, 10 Jan 2015 11:26:23 +0100 Subject: [PATCH] Added support for creating a new QVariant given another and for assign operations --- DOtherSide/DOtherSide/DOtherSide.cpp | 15 +++++++++++++++ DOtherSide/DOtherSide/DOtherSide.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/DOtherSide/DOtherSide/DOtherSide.cpp b/DOtherSide/DOtherSide/DOtherSide.cpp index 8bbbc3d..f9ea951 100644 --- a/DOtherSide/DOtherSide/DOtherSide.cpp +++ b/DOtherSide/DOtherSide/DOtherSide.cpp @@ -146,6 +146,14 @@ void dos_qvariant_create_string(void** vptr, const char* value) *vptr = new QVariant(value); } +void dos_qvariant_create_qvariant(void** vptr, void* other) +{ + auto newQVariant = new QVariant(); + auto otherQVariant = reinterpret_cast(other); + *newQVariant = *otherQVariant; + *vptr = newQVariant; +} + void dos_qvariant_create_qobject(void **vptr, void* value) { auto qobject = reinterpret_cast(value); @@ -166,6 +174,13 @@ void dos_qvariant_delete(void *vptr) delete variant; } +void dos_qvariant_assign(void* vptr, void* other) +{ + auto leftQVariant = reinterpret_cast(vptr); + auto rightQVariant = reinterpret_cast(other); + *leftQVariant = *rightQVariant; +} + void dos_qvariant_toInt(void* vptr, int& value) { auto variant = reinterpret_cast(vptr); diff --git a/DOtherSide/DOtherSide/DOtherSide.h b/DOtherSide/DOtherSide/DOtherSide.h index cb1abe7..f118496 100644 --- a/DOtherSide/DOtherSide/DOtherSide.h +++ b/DOtherSide/DOtherSide/DOtherSide.h @@ -43,6 +43,7 @@ extern "C" void dos_qvariant_create_bool(void **vptr, bool value); void dos_qvariant_create_string(void **vptr, const char* value); void dos_qvariant_create_qobject(void **vptr, void* value); + void dos_qvariant_create_qvariant(void **vptr, void* value); void dos_qvariant_toInt(void* vptr, int& value); void dos_qvariant_setInt(void* vptr, int value); void dos_qvariant_toBool(void* vptr, bool& value); @@ -51,6 +52,7 @@ extern "C" void dos_qvariant_setString(void* vptr, const char* value); void dos_qvariant_isnull(void *vptr, bool& isNull); void dos_qvariant_delete(void *vptr); + void dos_qvariant_assign(void* vptr, void* other); // QObject void dos_qobject_create(void **vptr,