Added support for creating a new QVariant given another and for assign operations

This commit is contained in:
Filippo Cucchetto 2015-01-10 11:26:23 +01:00
parent 76894f3bc3
commit 3857a48d86
2 changed files with 17 additions and 0 deletions

View File

@ -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<QVariant*>(other);
*newQVariant = *otherQVariant;
*vptr = newQVariant;
}
void dos_qvariant_create_qobject(void **vptr, void* value)
{
auto qobject = reinterpret_cast<QObject*>(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<QVariant*>(vptr);
auto rightQVariant = reinterpret_cast<QVariant*>(other);
*leftQVariant = *rightQVariant;
}
void dos_qvariant_toInt(void* vptr, int& value)
{
auto variant = reinterpret_cast<QVariant*>(vptr);

View File

@ -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,