Nepomuk
#include <Nepomuk/Variant>
Public Member Functions | |
Variant () | |
Variant (const Variant &other) | |
Variant (const QVariant &other) | |
Variant (int i) | |
Variant (qlonglong i) | |
Variant (uint i) | |
Variant (qulonglong i) | |
Variant (bool b) | |
Variant (double d) | |
Variant (const char *string) | |
Variant (const QString &string) | |
Variant (const QDate &date) | |
Variant (const QTime &time) | |
Variant (const QDateTime &datetime) | |
Variant (const QUrl &url) | |
Variant (const Resource &r) | |
Variant (const QList< int > &i) | |
Variant (const QList< qlonglong > &i) | |
Variant (const QList< uint > &i) | |
Variant (const QList< qulonglong > &i) | |
Variant (const QList< bool > &b) | |
Variant (const QList< double > &d) | |
Variant (const QStringList &stringlist) | |
Variant (const QList< QDate > &date) | |
Variant (const QList< QTime > &time) | |
Variant (const QList< QDateTime > &datetime) | |
Variant (const QList< QUrl > &url) | |
Variant (const QList< Resource > &r) | |
Variant (const QList< Variant > &vl) | |
~Variant () | |
void | append (int i) |
void | append (qlonglong i) |
void | append (uint i) |
void | append (qulonglong i) |
void | append (bool b) |
void | append (double d) |
void | append (const QString &string) |
void | append (const QDate &date) |
void | append (const QTime &time) |
void | append (const QDateTime &datetime) |
void | append (const QUrl &url) |
void | append (const Resource &r) |
void | append (const Variant &v) |
bool | isBool () const |
bool | isBoolList () const |
bool | isDate () const |
bool | isDateList () const |
bool | isDateTime () const |
bool | isDateTimeList () const |
bool | isDouble () const |
bool | isDoubleList () const |
bool | isInt () const |
bool | isInt64 () const |
bool | isInt64List () const |
bool | isIntList () const |
bool | isList () const |
bool | isResource () const |
bool | isResourceList () const |
bool | isString () const |
bool | isStringList () const |
bool | isTime () const |
bool | isTimeList () const |
bool | isUnsignedInt () const |
bool | isUnsignedInt64 () const |
bool | isUnsignedInt64List () const |
bool | isUnsignedIntList () const |
bool | isUrl () const |
bool | isUrlList () const |
bool | isValid () const |
bool | operator!= (const Variant &other) const |
Variant & | operator= (const Variant &) |
Variant & | operator= (int i) |
Variant & | operator= (qlonglong i) |
Variant & | operator= (uint i) |
Variant & | operator= (qulonglong i) |
Variant & | operator= (bool b) |
Variant & | operator= (double d) |
Variant & | operator= (const QString &string) |
Variant & | operator= (const QDate &date) |
Variant & | operator= (const QTime &time) |
Variant & | operator= (const QDateTime &datetime) |
Variant & | operator= (const QUrl &url) |
Variant & | operator= (const Resource &r) |
Variant & | operator= (const QList< int > &i) |
Variant & | operator= (const QList< qlonglong > &i) |
Variant & | operator= (const QList< uint > &i) |
Variant & | operator= (const QList< qulonglong > &i) |
Variant & | operator= (const QList< bool > &b) |
Variant & | operator= (const QList< double > &d) |
Variant & | operator= (const QStringList &stringlist) |
Variant & | operator= (const QList< QDate > &date) |
Variant & | operator= (const QList< QTime > &time) |
Variant & | operator= (const QList< QDateTime > &datetime) |
Variant & | operator= (const QList< QUrl > &url) |
Variant & | operator= (const QList< Resource > &r) |
bool | operator== (const Variant &other) const |
int | simpleType () const |
bool | toBool () const |
QList< bool > | toBoolList () const |
QDate | toDate () const |
QList< QDate > | toDateList () const |
QDateTime | toDateTime () const |
QList< QDateTime > | toDateTimeList () const |
double | toDouble () const |
QList< double > | toDoubleList () const |
int | toInt () const |
qlonglong | toInt64 () const |
QList< qlonglong > | toInt64List () const |
QList< int > | toIntList () const |
Soprano::Node | toNode () const |
QList< Soprano::Node > | toNodeList () const |
Resource | toResource () const |
QList< Resource > | toResourceList () const |
QString | toString () const |
QStringList | toStringList () const |
QTime | toTime () const |
QList< QTime > | toTimeList () const |
uint | toUnsignedInt () const |
qulonglong | toUnsignedInt64 () const |
QList< qulonglong > | toUnsignedInt64List () const |
QList< uint > | toUnsignedIntList () const |
QUrl | toUrl () const |
QList< QUrl > | toUrlList () const |
QList< Variant > | toVariantList () const |
int | type () const |
QVariant | variant () const |
Static Public Member Functions | |
static Variant | fromNode (const Soprano::Node &node) |
static Variant | fromNodeList (const QList< Soprano::Node > &node) |
static Variant | fromString (const QString &value, int type) |
Detailed Description
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding, automatic list conversion and a restricted set of supported types.
Important differences are:
- No new types can be added other than the ones that have defined constructors and get-methods
- Variant supports automatic list generation. For example a Variant containing an int also can produce an int-list via the toIntList method.
- toString and toStringList always return a valid list and do automatic conversion from the actual type used in the Variant. Thus, if one only needs to display the value in a Variant toString and toStringList do the job.
- Variant comes with direct support for Resource. There is one special thing about QUrl Variants though: for both isUrl() and isResource() return
true
. However, toUrl() will return different values for Resource and for QUrl Variants: in the former case the actual Resource::resourceUri() is returned which can be different in case of file:/ URLs.
Constructor & Destructor Documentation
Nepomuk::Variant::Variant | ( | ) |
Nepomuk::Variant::~Variant | ( | ) |
Nepomuk::Variant::Variant | ( | const Variant & | other | ) |
|
explicit |
Will create an invalid Variant if other has an unsupported type.
Nepomuk::Variant::Variant | ( | int | i | ) |
Nepomuk::Variant::Variant | ( | qlonglong | i | ) |
Nepomuk::Variant::Variant | ( | uint | i | ) |
Nepomuk::Variant::Variant | ( | qulonglong | i | ) |
Nepomuk::Variant::Variant | ( | bool | b | ) |
Nepomuk::Variant::Variant | ( | double | d | ) |
Nepomuk::Variant::Variant | ( | const char * | string | ) |
Nepomuk::Variant::Variant | ( | const QString & | string | ) |
Nepomuk::Variant::Variant | ( | const QDate & | date | ) |
Nepomuk::Variant::Variant | ( | const QTime & | time | ) |
Nepomuk::Variant::Variant | ( | const QDateTime & | datetime | ) |
Nepomuk::Variant::Variant | ( | const QUrl & | url | ) |
Nepomuk::Variant::Variant | ( | const Resource & | r | ) |
Nepomuk::Variant::Variant | ( | const QList< int > & | i | ) |
Nepomuk::Variant::Variant | ( | const QList< qlonglong > & | i | ) |
Nepomuk::Variant::Variant | ( | const QList< uint > & | i | ) |
Nepomuk::Variant::Variant | ( | const QList< qulonglong > & | i | ) |
Nepomuk::Variant::Variant | ( | const QList< bool > & | b | ) |
Nepomuk::Variant::Variant | ( | const QList< double > & | d | ) |
Nepomuk::Variant::Variant | ( | const QStringList & | stringlist | ) |
Nepomuk::Variant::Variant | ( | const QList< QDate > & | date | ) |
Nepomuk::Variant::Variant | ( | const QList< QTime > & | time | ) |
Nepomuk::Variant::Variant | ( | const QList< QDateTime > & | datetime | ) |
Nepomuk::Variant::Variant | ( | const QList< QUrl > & | url | ) |
Nepomuk::Variant::Variant | ( | const QList< Resource > & | r | ) |
Nepomuk::Variant::Variant | ( | const QList< Variant > & | vl | ) |
Create a new Variant from a list of Variants.
- Since
- 4.3
Member Function Documentation
void Nepomuk::Variant::append | ( | int | i | ) |
Append i to this variant.
If the variant already contains an int it will be converted to a list of int.
void Nepomuk::Variant::append | ( | qlonglong | i | ) |
void Nepomuk::Variant::append | ( | uint | i | ) |
void Nepomuk::Variant::append | ( | qulonglong | i | ) |
void Nepomuk::Variant::append | ( | bool | b | ) |
void Nepomuk::Variant::append | ( | double | d | ) |
void Nepomuk::Variant::append | ( | const QString & | string | ) |
void Nepomuk::Variant::append | ( | const QDate & | date | ) |
void Nepomuk::Variant::append | ( | const QTime & | time | ) |
void Nepomuk::Variant::append | ( | const QDateTime & | datetime | ) |
void Nepomuk::Variant::append | ( | const QUrl & | url | ) |
void Nepomuk::Variant::append | ( | const Resource & | r | ) |
void Nepomuk::Variant::append | ( | const Variant & | v | ) |
|
static |
Create a Variant object from a Soprano::Node.
- Since
- 4.5
|
static |
Create a Variant object from a list of Soprano::Node.
- Since
- 4.6
|
static |
bool Nepomuk::Variant::isBool | ( | ) | const |
bool Nepomuk::Variant::isBoolList | ( | ) | const |
bool Nepomuk::Variant::isDate | ( | ) | const |
bool Nepomuk::Variant::isDateList | ( | ) | const |
bool Nepomuk::Variant::isDateTime | ( | ) | const |
bool Nepomuk::Variant::isDateTimeList | ( | ) | const |
bool Nepomuk::Variant::isDouble | ( | ) | const |
bool Nepomuk::Variant::isDoubleList | ( | ) | const |
bool Nepomuk::Variant::isInt | ( | ) | const |
bool Nepomuk::Variant::isInt64 | ( | ) | const |
bool Nepomuk::Variant::isInt64List | ( | ) | const |
bool Nepomuk::Variant::isIntList | ( | ) | const |
bool Nepomuk::Variant::isList | ( | ) | const |
This methods does not handle all list types.
It checks the following:
- QList<Resource>
- QList<int>
- QList<double>
- QList<bool>
- QList<QDate>
- QList<QTime>
- QList<QDateTime>
- QList<QUrl>
- QList<String> (QStringList)
bool Nepomuk::Variant::isResource | ( | ) | const |
bool Nepomuk::Variant::isResourceList | ( | ) | const |
bool Nepomuk::Variant::isString | ( | ) | const |
bool Nepomuk::Variant::isStringList | ( | ) | const |
bool Nepomuk::Variant::isTime | ( | ) | const |
bool Nepomuk::Variant::isTimeList | ( | ) | const |
bool Nepomuk::Variant::isUnsignedInt | ( | ) | const |
bool Nepomuk::Variant::isUnsignedInt64 | ( | ) | const |
bool Nepomuk::Variant::isUnsignedInt64List | ( | ) | const |
bool Nepomuk::Variant::isUnsignedIntList | ( | ) | const |
bool Nepomuk::Variant::isUrl | ( | ) | const |
bool Nepomuk::Variant::isUrlList | ( | ) | const |
bool Nepomuk::Variant::isValid | ( | ) | const |
bool Nepomuk::Variant::operator!= | ( | const Variant & | other | ) | const |
Inverse of operator==.
Variant& Nepomuk::Variant::operator= | ( | int | i | ) |
Variant& Nepomuk::Variant::operator= | ( | qlonglong | i | ) |
Variant& Nepomuk::Variant::operator= | ( | uint | i | ) |
Variant& Nepomuk::Variant::operator= | ( | qulonglong | i | ) |
Variant& Nepomuk::Variant::operator= | ( | bool | b | ) |
Variant& Nepomuk::Variant::operator= | ( | double | d | ) |
Variant& Nepomuk::Variant::operator= | ( | const QString & | string | ) |
Variant& Nepomuk::Variant::operator= | ( | const QDate & | date | ) |
Variant& Nepomuk::Variant::operator= | ( | const QTime & | time | ) |
Variant& Nepomuk::Variant::operator= | ( | const QDateTime & | datetime | ) |
Variant& Nepomuk::Variant::operator= | ( | const QUrl & | url | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< int > & | i | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< qlonglong > & | i | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< uint > & | i | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< qulonglong > & | i | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< bool > & | b | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< double > & | d | ) |
Variant& Nepomuk::Variant::operator= | ( | const QStringList & | stringlist | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< QDate > & | date | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< QTime > & | time | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< QDateTime > & | datetime | ) |
Variant& Nepomuk::Variant::operator= | ( | const QList< QUrl > & | url | ) |
bool Nepomuk::Variant::operator== | ( | const Variant & | other | ) | const |
Does compare two Variant objects.
single-valued lists are treated as the single value itself. For example a QStringList variant with one element "x" equals a QString variant with value "x".
int Nepomuk::Variant::simpleType | ( | ) | const |
- Returns
- the type of the simple value, i.e. with the list stripped.
bool Nepomuk::Variant::toBool | ( | ) | const |
Convert into a bool value.
Will return the first value of a bool list.
QList<bool> Nepomuk::Variant::toBoolList | ( | ) | const |
QDate Nepomuk::Variant::toDate | ( | ) | const |
Convert into a QDate value.
Will return the first value of a QDate list.
QList<QDate> Nepomuk::Variant::toDateList | ( | ) | const |
QDateTime Nepomuk::Variant::toDateTime | ( | ) | const |
Convert into a QDateTime value.
Will return the first value of a QDateTime list.
QList<QDateTime> Nepomuk::Variant::toDateTimeList | ( | ) | const |
double Nepomuk::Variant::toDouble | ( | ) | const |
Convert into a double value.
Will return the first value of a double list.
QList<double> Nepomuk::Variant::toDoubleList | ( | ) | const |
int Nepomuk::Variant::toInt | ( | ) | const |
Convert into an int value.
Returns a valid value for all decimal types.
Will return the first value of an int list.
qlonglong Nepomuk::Variant::toInt64 | ( | ) | const |
Convert into a qlonglong value.
Returns a valid value for all decimal types.
Will return the first value of a qlonglong list.
QList<qlonglong> Nepomuk::Variant::toInt64List | ( | ) | const |
QList<int> Nepomuk::Variant::toIntList | ( | ) | const |
Soprano::Node Nepomuk::Variant::toNode | ( | ) | const |
Convert a Variant to a Node.
- Since
- 4.6
QList<Soprano::Node> Nepomuk::Variant::toNodeList | ( | ) | const |
Convert a Variant to a a list of Nodes.
- Since
- 4.6
Resource Nepomuk::Variant::toResource | ( | ) | const |
QList<Resource> Nepomuk::Variant::toResourceList | ( | ) | const |
QString Nepomuk::Variant::toString | ( | ) | const |
The toString() method is a little more powerful than other toXXX methods since it actually converts all values to string.
Thus, toString should work always (even list variants are converted to a comma-separated list)
Resources are converted to a string representation of their URI.
QStringList Nepomuk::Variant::toStringList | ( | ) | const |
Just like the toString method toStringList is able to convert all supported types into a list of strings.
QTime Nepomuk::Variant::toTime | ( | ) | const |
Convert into a QTime value.
Will return the first value of a QTime list.
QList<QTime> Nepomuk::Variant::toTimeList | ( | ) | const |
uint Nepomuk::Variant::toUnsignedInt | ( | ) | const |
Convert into a uint value.
Returns a valid value for all decimal types.
Will return the first value of a uint list.
qulonglong Nepomuk::Variant::toUnsignedInt64 | ( | ) | const |
Convert into a qulonglong value.
Returns a valid value for all decimal types.
Will return the first value of a qulonglong list.
QList<qulonglong> Nepomuk::Variant::toUnsignedInt64List | ( | ) | const |
QList<uint> Nepomuk::Variant::toUnsignedIntList | ( | ) | const |
QUrl Nepomuk::Variant::toUrl | ( | ) | const |
Convert into a QUrl value.
Can handle both QUrl and Resource variants. The latter will be converted into its resource URI
Will return the first value of a QUrl list.
- See also
- Resource::resourceUri
QList<QUrl> Nepomuk::Variant::toUrlList | ( | ) | const |
QList<Variant> Nepomuk::Variant::toVariantList | ( | ) | const |
Convert a Variant to a list of Variants.
- Since
- 4.3
int Nepomuk::Variant::type | ( | ) | const |
- Returns
- the QT Meta type id of the type
QVariant Nepomuk::Variant::variant | ( | ) | const |
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.