• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Nepomuk

variant.h

Go to the documentation of this file.
00001 /* 
00002  * This file is part of the Nepomuk KDE project.
00003  * Copyright (C) 2006-2008 Sebastian Trueg <trueg@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef _NEPOMUK_VARIANT_H_
00022 #define _NEPOMUK_VARIANT_H_
00023 
00024 #include "nepomuk_export.h"
00025 #include "resource.h"
00026 
00027 #include <QtCore/QDateTime>
00028 #include <QtCore/QUrl>
00029 #include <QtCore/QVariant>
00030 
00031 namespace Nepomuk {
00032 
00033     class Resource;
00034 
00055     class NEPOMUK_EXPORT Variant
00056     {
00057     public:
00058         Variant();
00059         ~Variant();
00060         Variant( const Variant& other );
00061 
00065         explicit Variant( const QVariant& other );
00066         Variant( int i );
00067         Variant( qlonglong i );
00068         Variant( uint i );
00069         Variant( qulonglong i );
00070         Variant( bool b );
00071         Variant( double d );
00072         Variant( const char* string );
00073         Variant( const QString& string );
00074         Variant( const QDate& date );
00075         Variant( const QTime& time );
00076         Variant( const QDateTime& datetime );
00077         Variant( const QUrl& url );
00078         Variant( const Resource& r );
00079         Variant( const QList<int>& i );
00080         Variant( const QList<qlonglong>& i );
00081         Variant( const QList<uint>& i );
00082         Variant( const QList<qulonglong>& i );
00083         Variant( const QList<bool>& b );
00084         Variant( const QList<double>& d );
00085         Variant( const QStringList& stringlist );
00086         Variant( const QList<QDate>& date );
00087         Variant( const QList<QTime>& time );
00088         Variant( const QList<QDateTime>& datetime );
00089         Variant( const QList<QUrl>& url );
00090         Variant( const QList<Resource>& r );
00091 
00092         Variant& operator=( const Variant& );
00093         Variant& operator=( int i );
00094         Variant& operator=( qlonglong i );
00095         Variant& operator=( uint i );
00096         Variant& operator=( qulonglong i );
00097         Variant& operator=( bool b );
00098         Variant& operator=( double d );
00099         Variant& operator=( const QString& string );
00100         Variant& operator=( const QDate& date );
00101         Variant& operator=( const QTime& time );
00102         Variant& operator=( const QDateTime& datetime );
00103         Variant& operator=( const QUrl& url );
00104         Variant& operator=( const Resource& r );
00105         Variant& operator=( const QList<int>& i );
00106         Variant& operator=( const QList<qlonglong>& i );
00107         Variant& operator=( const QList<uint>& i );
00108         Variant& operator=( const QList<qulonglong>& i );
00109         Variant& operator=( const QList<bool>& b );
00110         Variant& operator=( const QList<double>& d );
00111         Variant& operator=( const QStringList& stringlist );
00112         Variant& operator=( const QList<QDate>& date );
00113         Variant& operator=( const QList<QTime>& time );
00114         Variant& operator=( const QList<QDateTime>& datetime );
00115         Variant& operator=( const QList<QUrl>& url );
00116         Variant& operator=( const QList<Resource>& r );
00117 
00122         void append( int i );
00123         void append( qlonglong i );
00124         void append( uint i );
00125         void append( qulonglong i );
00126         void append( bool b );
00127         void append( double d );
00128         void append( const QString& string );
00129         void append( const QDate& date );
00130         void append( const QTime& time );
00131         void append( const QDateTime& datetime );
00132         void append( const QUrl& url );
00133         void append( const Resource& r );
00134 
00141         void append( const Variant& v );
00142 
00148         bool operator==( const Variant& other ) const;
00149 
00153         bool operator!=( const Variant& other ) const;
00154 
00155         bool isValid() const;
00156                 
00160         int type() const;
00161 
00166         int simpleType() const;
00167 
00181         bool isList() const;
00182 
00183         bool isInt() const;
00184         bool isInt64() const;
00185         bool isUnsignedInt() const;
00186         bool isUnsignedInt64() const;
00187         bool isBool() const;
00188         bool isDouble() const;
00189         bool isString() const;
00190         bool isDate() const;
00191         bool isTime() const;
00192         bool isDateTime() const;
00193         bool isUrl() const;
00194         bool isResource() const;
00195 
00196         bool isIntList() const;
00197         bool isInt64List() const;
00198         bool isUnsignedIntList() const;
00199         bool isUnsignedInt64List() const;
00200         bool isBoolList() const;
00201         bool isDoubleList() const;
00202         bool isStringList() const;
00203         bool isDateList() const;
00204         bool isTimeList() const;
00205         bool isDateTimeList() const;
00206         bool isUrlList() const;
00207         bool isResourceList() const;
00208 
00209         QVariant variant() const;
00210 
00211         int toInt() const;
00212         qlonglong toInt64() const;
00213         uint toUnsignedInt() const;
00214         qulonglong toUnsignedInt64() const;
00215 
00216         bool toBool() const;
00217         double toDouble() const;
00218 
00227         QString toString() const;
00228         QDate toDate() const;
00229         QTime toTime() const;
00230         QDateTime toDateTime() const;
00231         QUrl toUrl() const;
00232         Resource toResource() const;
00233 
00234         QList<int> toIntList() const;
00235         QList<qlonglong> toInt64List() const;
00236         QList<uint> toUnsignedIntList() const;
00237         QList<qulonglong> toUnsignedInt64List() const;
00238         QList<bool> toBoolList() const;
00239         QList<double> toDoubleList() const;
00240 
00245         QStringList toStringList() const;
00246         QList<QDate> toDateList() const;
00247         QList<QTime> toTimeList() const;
00248         QList<QDateTime> toDateTimeList() const;
00249         QList<QUrl> toUrlList() const;
00250         QList<Resource> toResourceList() const;
00251 
00257         static Variant fromString( const QString& value, int type );
00258 
00259     private:
00260         class Private;
00261         Private* const d;
00262     };
00263 }
00264 
00265 
00266 NEPOMUK_EXPORT QDebug operator<<( QDebug dbg, const Nepomuk::Variant& );
00267 
00268 Q_DECLARE_METATYPE(Nepomuk::Resource)
00269 Q_DECLARE_METATYPE(QList<Nepomuk::Resource>)
00270 Q_DECLARE_METATYPE(QList<int>)
00271 Q_DECLARE_METATYPE(QList<qlonglong>)
00272 Q_DECLARE_METATYPE(QList<uint>)
00273 Q_DECLARE_METATYPE(QList<qulonglong>)
00274 Q_DECLARE_METATYPE(QList<double>)
00275 Q_DECLARE_METATYPE(QList<bool>)
00276 Q_DECLARE_METATYPE(QList<QDate>)
00277 Q_DECLARE_METATYPE(QList<QTime>)
00278 Q_DECLARE_METATYPE(QList<QDateTime>)
00279 Q_DECLARE_METATYPE(QList<QUrl>)
00280 
00281 #endif

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal