Variant Class Reference
from PyKDE4.nepomuk import *
Namespace: Nepomuk
Detailed Description
\class Variant variant.h Nepomuk/Variant
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.
- Author:
- Sebastian Trueg <trueg@kde.org>
Methods |
| __init__ (self) |
| __init__ (self, Nepomuk.Variant other) |
| __init__ (self, QVariant other) |
| __init__ (self, int i) |
| __init__ (self, long i) |
| __init__ (self, long i) |
| __init__ (self, long i) |
| __init__ (self, bool b) |
| __init__ (self, float d) |
| __init__ (self, QString string) |
| __init__ (self, QString string) |
| __init__ (self, QDate date) |
| __init__ (self, QTime time) |
| __init__ (self, QDateTime datetime) |
| __init__ (self, QUrl url) |
| __init__ (self, Nepomuk.Resource r) |
| __init__ (self, [int] i) |
| __init__ (self, [long] i) |
| __init__ (self, [long] i) |
| __init__ (self, [long] i) |
| __init__ (self, [bool] b) |
| __init__ (self, [float] d) |
| __init__ (self, QStringList stringlist) |
| __init__ (self, [QDate] date) |
| __init__ (self, [QTime] time) |
| __init__ (self, [QDateTime] datetime) |
| __init__ (self, [QUrl] url) |
| __init__ (self, [Nepomuk.Resource] r) |
| append (self, int i) |
| append (self, long i) |
| append (self, long i) |
| append (self, long i) |
| append (self, bool b) |
| append (self, float d) |
| append (self, QString string) |
| append (self, QDate date) |
| append (self, QTime time) |
| append (self, QDateTime datetime) |
| append (self, QUrl url) |
| append (self, Nepomuk.Resource r) |
| append (self, Nepomuk.Variant v) |
bool | isBool (self) |
bool | isBoolList (self) |
bool | isDate (self) |
bool | isDateList (self) |
bool | isDateTime (self) |
bool | isDateTimeList (self) |
bool | isDouble (self) |
bool | isDoubleList (self) |
bool | isInt (self) |
bool | isInt64 (self) |
bool | isInt64List (self) |
bool | isIntList (self) |
bool | isList (self) |
bool | isResource (self) |
bool | isResourceList (self) |
bool | isString (self) |
bool | isStringList (self) |
bool | isTime (self) |
bool | isTimeList (self) |
bool | isUnsignedInt (self) |
bool | isUnsignedInt64 (self) |
bool | isUnsignedInt64List (self) |
bool | isUnsignedIntList (self) |
bool | isUrl (self) |
bool | isUrlList (self) |
bool | isValid (self) |
bool | operator != (self, Nepomuk.Variant other) |
bool | operator == (self, Nepomuk.Variant other) |
int | simpleType (self) |
bool | toBool (self) |
[bool] | toBoolList (self) |
QDate | toDate (self) |
[QDate] | toDateList (self) |
QDateTime | toDateTime (self) |
[QDateTime] | toDateTimeList (self) |
float | toDouble (self) |
[float] | toDoubleList (self) |
int | toInt (self) |
long | toInt64 (self) |
[long] | toInt64List (self) |
[int] | toIntList (self) |
Nepomuk.Resource | toResource (self) |
[Nepomuk.Resource] | toResourceList (self) |
QString | toString (self) |
QStringList | toStringList (self) |
QTime | toTime (self) |
[QTime] | toTimeList (self) |
long | toUnsignedInt (self) |
long | toUnsignedInt64 (self) |
[long] | toUnsignedInt64List (self) |
[long] | toUnsignedIntList (self) |
QUrl | toUrl (self) |
[QUrl] | toUrlList (self) |
int | type (self) |
QVariant | variant (self) |
Static Methods |
Nepomuk.Variant | fromString (QString value, int type) |
Method Documentation
Will create an invalid Variant if other has an unsupported type.
__init__ |
( |
self, |
|
|
|
long |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
long |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
long |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
bool |
b |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
float |
d |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
QDate |
date |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
QTime |
time |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
QUrl |
url |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[int] |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[long] |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[long] |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[long] |
i |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[bool] |
b |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[float] |
d |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[QDate] |
date |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[QTime] |
time |
|
) |
|
|
|
__init__ |
( |
self, |
|
|
|
[QUrl] |
url |
|
) |
|
|
|
Append i to this variant. If the variant already
contains an int it will be converted to a list of int.
append |
( |
self, |
|
|
|
QDate |
date |
|
) |
|
|
|
append |
( |
self, |
|
|
|
QTime |
time |
|
) |
|
|
|
append |
( |
self, |
|
|
|
QUrl |
url |
|
) |
|
|
|
Appends the value stored in v to the list in this
Variant. If this Variant contains a value with the same
simple type as v they are merged into a list. Otherwise
this Variant will contain one list of simple type v.simpleType()
Create a Variant object by parsing string value based on type.
If type is unknown a simple string Variant object is returned
containing the plain string value.
bool isDateTimeList |
( |
|
self ) |
|
bool isDoubleList |
( |
|
self ) |
|
bool isInt64List |
( |
|
self ) |
|
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 isResourceList |
( |
|
self ) |
|
bool isStringList |
( |
|
self ) |
|
bool isUnsignedInt |
( |
|
self ) |
|
bool isUnsignedInt64 |
( |
|
self ) |
|
bool isUnsignedInt64List |
( |
|
self ) |
|
bool isUnsignedIntList |
( |
|
self ) |
|
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".
- Returns:
- the type of the simple value, i.e. with
the list stripped.
[bool] toBoolList |
( |
|
self ) |
|
[QDate] toDateList |
( |
|
self ) |
|
[float] toDoubleList |
( |
|
self ) |
|
[long] toInt64List |
( |
|
self ) |
|
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.
Just like the toString method toStringList is able to convert all
supported types into a list of strings.
[QTime] toTimeList |
( |
|
self ) |
|
long toUnsignedInt |
( |
|
self ) |
|
long toUnsignedInt64 |
( |
|
self ) |
|
[long] toUnsignedInt64List |
( |
|
self ) |
|
[long] toUnsignedIntList |
( |
|
self ) |
|
[QUrl] toUrlList |
( |
|
self ) |
|
- Returns:
- the QT Meta type id of the type