soprano/literalvalue.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef LITERAL_VALUE_H
00023 #define LITERAL_VALUE_H
00024 
00025 #include "soprano_export.h"
00026 
00027 #include <QtCore/QVariant>
00028 #include <QtCore/QSharedDataPointer>
00029 
00030 
00031 namespace Soprano
00032 {
00064     class SOPRANO_EXPORT LiteralValue
00065     {
00066     public:
00068 
00071         LiteralValue();
00072 
00076         ~LiteralValue();
00077 
00081         LiteralValue( const LiteralValue& other );
00082 
00088         LiteralValue( const QVariant& v );
00089 
00094         LiteralValue( int i );
00095 
00100         LiteralValue( qlonglong i );
00101 
00106         LiteralValue( uint i );
00107 
00112         LiteralValue( qulonglong i );
00113 
00118         LiteralValue( bool b );
00119 
00124         LiteralValue( double d );
00125 
00132         LiteralValue( const char* string );
00133 
00138         LiteralValue( const QLatin1String& string );
00139 
00144         LiteralValue( const QString& string );
00145 
00150         LiteralValue( const QDate& date );
00151 
00156         LiteralValue( const QTime& time );
00157 
00162         LiteralValue( const QDateTime& datetime );
00163 
00168         LiteralValue( const QByteArray& data );
00170 
00172 
00175         LiteralValue& operator=( const LiteralValue& other );
00176 
00189         LiteralValue& operator=( int i );
00190 
00195         LiteralValue& operator=( qlonglong i );
00196 
00208         LiteralValue& operator=( uint i );
00209 
00214         LiteralValue& operator=( qulonglong i );
00215 
00220         LiteralValue& operator=( bool b );
00221 
00226         LiteralValue& operator=( double d );
00227 
00232         LiteralValue& operator=( const QString& s );
00233 
00238         LiteralValue& operator=( const QLatin1String& s );
00239 
00244         LiteralValue& operator=( const QDate& date );
00245 
00250         LiteralValue& operator=( const QTime& time );
00251 
00256         LiteralValue& operator=( const QDateTime& datetime );
00257 
00262         LiteralValue& operator=( const QByteArray& data );
00264 
00266         bool operator==( const LiteralValue& other ) const;
00267 
00268         bool operator!=( const LiteralValue& other ) const;
00270 
00272         bool isValid() const;
00273 
00274         bool isInt() const;
00275         bool isInt64() const;
00276         bool isUnsignedInt() const;
00277         bool isUnsignedInt64() const;
00278         bool isBool() const;
00279         bool isDouble() const;
00280 
00287         bool isString() const;
00288         bool isDate() const;
00289         bool isTime() const;
00290         bool isDateTime() const;
00291         bool isByteArray() const;
00293 
00295         int toInt() const;
00296         qlonglong toInt64() const;
00297         uint toUnsignedInt() const;
00298         qulonglong toUnsignedInt64() const;
00299         bool toBool() const;
00300         double toDouble() const;
00301 
00310         QString toString() const;
00311         QDate toDate() const;
00312         QTime toTime() const;
00313         QDateTime toDateTime() const;
00314         QByteArray toByteArray() const;
00316 
00318 
00324         QUrl dataTypeUri() const;
00325 
00332         QVariant::Type type() const;
00333 
00339         QVariant variant() const;
00341 
00347         static LiteralValue fromString( const QString& value, QVariant::Type type );
00348 
00356         static LiteralValue fromString( const QString& value, const QUrl& dataTypeUri );
00357 
00363         static QVariant::Type typeFromDataTypeUri( const QUrl& dataTypeUri );
00364 
00370         static QUrl dataTypeUriFromType( QVariant::Type type );
00371 
00372     private:
00373         class Private;
00374         QSharedDataPointer<Private> d;
00375     };
00376 }
00377 
00378 SOPRANO_EXPORT QDebug operator<<( QDebug dbg, const Soprano::LiteralValue& );
00379 
00380 #endif

Generated on Fri Mar 7 19:00:11 2008 for Soprano by  doxygen 1.5.4