NuriaProject Framework  0.1
The NuriaProject Framework
Static Public Member Functions | List of all members
Nuria::Variant Class Reference

Utilities for working with QVariants. More...

#include <variant.hpp>

Static Public Member Functions

template<typename... Items>
static QVariantList buildList (const Items &...items)
 
static void * getPointer (QVariant &variant)
 
static void * stealPointer (QVariant &variant)
 

Detailed Description

Utilities for working with QVariants.

Member Function Documentation

template<typename... Items>
static QVariantList Nuria::Variant::buildList ( const Items &...  items)
inlinestatic

Builds a QVariantList out of all arguments passed to the method. This does the same as QVariantList () << QVariant::fromValue (first) << ... But it's easier and shorter to read and write.

Note
This method implicitly converts passed arguments of type const char* to QString. You can disable this by defining NURIA_NO_CHAR_ARRAY_TO_QSTRING before including this header.
static void* Nuria::Variant::getPointer ( QVariant &  variant)
static

Returns the pointer from variant, if variant contains a pointer type. Works both for T and T*. Ownership of the returned pointer is not taken from variant and variant itself is not changed. If the operation failed, nullptr is returned.

static void* Nuria::Variant::stealPointer ( QVariant &  variant)
static

Steals the pointer from variant and returns it. Works only for pointer types, that is, T* but not T. If variant is invalid, nullptr is returned. After return, variant will be invalid if it contained a pointer.

Note
Ownership of the returned pointer is transferred to the caller.

The documentation for this class was generated from the following file: