• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • 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-2009 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 Soprano {
00032     class Node;
00033 }
00034 
00035 namespace Nepomuk {
00036 
00037     class Resource;
00038 
00065     class NEPOMUK_EXPORT Variant
00066     {
00067     public:
00068         Variant();
00069         ~Variant();
00070         Variant( const Variant& other );
00071 
00075         explicit Variant( const QVariant& other );
00076         Variant( int i );
00077         Variant( qlonglong i );
00078         Variant( uint i );
00079         Variant( qulonglong i );
00080         Variant( bool b );
00081         Variant( double d );
00082         Variant( const char* string );
00083         Variant( const QString& string );
00084         Variant( const QDate& date );
00085         Variant( const QTime& time );
00086         Variant( const QDateTime& datetime );
00087         Variant( const QUrl& url );
00088         Variant( const Resource& r );
00089         Variant( const QList<int>& i );
00090         Variant( const QList<qlonglong>& i );
00091         Variant( const QList<uint>& i );
00092         Variant( const QList<qulonglong>& i );
00093         Variant( const QList<bool>& b );
00094         Variant( const QList<double>& d );
00095         Variant( const QStringList& stringlist );
00096         Variant( const QList<QDate>& date );
00097         Variant( const QList<QTime>& time );
00098         Variant( const QList<QDateTime>& datetime );
00099         Variant( const QList<QUrl>& url );
00100         Variant( const QList<Resource>& r );
00101 
00107         Variant( const QList<Variant>& vl );
00108 
00109         Variant& operator=( const Variant& );
00110         Variant& operator=( int i );
00111         Variant& operator=( qlonglong i );
00112         Variant& operator=( uint i );
00113         Variant& operator=( qulonglong i );
00114         Variant& operator=( bool b );
00115         Variant& operator=( double d );
00116         Variant& operator=( const QString& string );
00117         Variant& operator=( const QDate& date );
00118         Variant& operator=( const QTime& time );
00119         Variant& operator=( const QDateTime& datetime );
00120         Variant& operator=( const QUrl& url );
00121         Variant& operator=( const Resource& r );
00122         Variant& operator=( const QList<int>& i );
00123         Variant& operator=( const QList<qlonglong>& i );
00124         Variant& operator=( const QList<uint>& i );
00125         Variant& operator=( const QList<qulonglong>& i );
00126         Variant& operator=( const QList<bool>& b );
00127         Variant& operator=( const QList<double>& d );
00128         Variant& operator=( const QStringList& stringlist );
00129         Variant& operator=( const QList<QDate>& date );
00130         Variant& operator=( const QList<QTime>& time );
00131         Variant& operator=( const QList<QDateTime>& datetime );
00132         Variant& operator=( const QList<QUrl>& url );
00133         Variant& operator=( const QList<Resource>& r );
00134 
00139         void append( int i );
00140         void append( qlonglong i );
00141         void append( uint i );
00142         void append( qulonglong i );
00143         void append( bool b );
00144         void append( double d );
00145         void append( const QString& string );
00146         void append( const QDate& date );
00147         void append( const QTime& time );
00148         void append( const QDateTime& datetime );
00149         void append( const QUrl& url );
00150         void append( const Resource& r );
00151 
00158         void append( const Variant& v );
00159 
00165         bool operator==( const Variant& other ) const;
00166 
00170         bool operator!=( const Variant& other ) const;
00171 
00172         bool isValid() const;
00173 
00177         int type() const;
00178 
00183         int simpleType() const;
00184 
00198         bool isList() const;
00199 
00200         bool isInt() const;
00201         bool isInt64() const;
00202         bool isUnsignedInt() const;
00203         bool isUnsignedInt64() const;
00204         bool isBool() const;
00205         bool isDouble() const;
00206         bool isString() const;
00207         bool isDate() const;
00208         bool isTime() const;
00209         bool isDateTime() const;
00210         bool isUrl() const;
00211         bool isResource() const;
00212 
00213         bool isIntList() const;
00214         bool isInt64List() const;
00215         bool isUnsignedIntList() const;
00216         bool isUnsignedInt64List() const;
00217         bool isBoolList() const;
00218         bool isDoubleList() const;
00219         bool isStringList() const;
00220         bool isDateList() const;
00221         bool isTimeList() const;
00222         bool isDateTimeList() const;
00223         bool isUrlList() const;
00224         bool isResourceList() const;
00225 
00226         QVariant variant() const;
00227 
00234         int toInt() const;
00235 
00242         qlonglong toInt64() const;
00243 
00250         uint toUnsignedInt() const;
00251 
00258         qulonglong toUnsignedInt64() const;
00259 
00265         bool toBool() const;
00266 
00272         double toDouble() const;
00273 
00282         QString toString() const;
00283 
00289         QDate toDate() const;
00290 
00296         QTime toTime() const;
00297 
00303         QDateTime toDateTime() const;
00304 
00313         QUrl toUrl() const;
00314 
00321         Resource toResource() const;
00322 
00323         QList<int> toIntList() const;
00324         QList<qlonglong> toInt64List() const;
00325         QList<uint> toUnsignedIntList() const;
00326         QList<qulonglong> toUnsignedInt64List() const;
00327         QList<bool> toBoolList() const;
00328         QList<double> toDoubleList() const;
00329 
00334         QStringList toStringList() const;
00335         QList<QDate> toDateList() const;
00336         QList<QTime> toTimeList() const;
00337         QList<QDateTime> toDateTimeList() const;
00338         QList<QUrl> toUrlList() const;
00339         QList<Resource> toResourceList() const;
00340 
00346         QList<Variant> toVariantList() const;
00347 
00353         Soprano::Node toNode() const;
00354 
00360         QList<Soprano::Node> toNodeList() const;
00361         
00367         static Variant fromString( const QString& value, int type );
00368 
00374         static Variant fromNode( const Soprano::Node& node );
00375 
00381         static Variant fromNodeList( const QList<Soprano::Node>& node );
00382 
00383     private:
00384         class Private;
00385         Private* const d;
00386     };
00387 }
00388 
00389 
00390 NEPOMUK_EXPORT QDebug operator<<( QDebug dbg, const Nepomuk::Variant& );
00391 
00392 Q_DECLARE_METATYPE(Nepomuk::Resource)
00393 Q_DECLARE_METATYPE(QList<Nepomuk::Resource>)
00394 Q_DECLARE_METATYPE(QList<int>)
00395 Q_DECLARE_METATYPE(QList<qlonglong>)
00396 Q_DECLARE_METATYPE(QList<uint>)
00397 Q_DECLARE_METATYPE(QList<qulonglong>)
00398 Q_DECLARE_METATYPE(QList<double>)
00399 Q_DECLARE_METATYPE(QList<bool>)
00400 Q_DECLARE_METATYPE(QList<QDate>)
00401 Q_DECLARE_METATYPE(QList<QTime>)
00402 Q_DECLARE_METATYPE(QList<QDateTime>)
00403 Q_DECLARE_METATYPE(QList<QUrl>)
00404 
00405 #endif

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Modules
  • 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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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