Soprano 2.9.4
literalvalue.h
Go to the documentation of this file.
1/*
2 * This file is part of Soprano Project.
3 *
4 * Copyright (C) 2007-2011 Sebastian Trueg <trueg@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#ifndef LITERAL_VALUE_H
23#define LITERAL_VALUE_H
24
25#include "soprano_export.h"
26
27#include <QtCore/QVariant>
28#include <QtCore/QSharedDataPointer>
29
30#include "languagetag.h"
31
32
33namespace Soprano
34{
67 {
68 public:
70
74
79
83 LiteralValue( const LiteralValue& other );
84
93
98 LiteralValue( int i );
99
104 LiteralValue( qlonglong i );
105
110 LiteralValue( uint i );
111
116 LiteralValue( qulonglong i );
117
122 LiteralValue( bool b );
123
128 LiteralValue( double d );
129
136 LiteralValue( const char* string );
137
142 LiteralValue( const QLatin1String& string );
143
148 LiteralValue( const QString& string );
149
154 LiteralValue( const QDate& date );
155
160 LiteralValue( const QTime& time );
161
166 LiteralValue( const QDateTime& datetime );
167
172 LiteralValue( const QByteArray& data );
174
176
180
194
199 LiteralValue& operator=( qlonglong i );
200
213
218 LiteralValue& operator=( qulonglong i );
219
225
231
237
243
248 LiteralValue& operator=( const QDate& date );
249
254 LiteralValue& operator=( const QTime& time );
255
260 LiteralValue& operator=( const QDateTime& datetime );
261
268
270 bool operator==( const LiteralValue& other ) const;
271
272 bool operator!=( const LiteralValue& other ) const;
274
276 bool isValid() const;
277
284 bool isPlain() const;
285
286 bool isInt() const;
287 bool isInt64() const;
288 bool isUnsignedInt() const;
289 bool isUnsignedInt64() const;
290 bool isBool() const;
291 bool isDouble() const;
292
299 bool isString() const;
300 bool isDate() const;
301 bool isTime() const;
302 bool isDateTime() const;
303 bool isByteArray() const;
305
307 int toInt() const;
308 qlonglong toInt64() const;
309 uint toUnsignedInt() const;
310 qulonglong toUnsignedInt64() const;
311 bool toBool() const;
312 double toDouble() const;
313
327 QDate toDate() const;
328 QTime toTime() const;
332
334
342
350
357 QVariant::Type type() const;
358
366
374 static LiteralValue fromString( const QString& value, QVariant::Type type );
375
397 static LiteralValue fromString( const QString& value, const QUrl& dataTypeUri );
398
421 static LiteralValue fromVariant( const QVariant& value, const QUrl& dataType );
422
438 static LiteralValue createPlainLiteral( const QString& value, const LanguageTag& lang = LanguageTag() );
439
445 static QVariant::Type typeFromDataTypeUri( const QUrl& dataTypeUri );
446
452 static QUrl dataTypeUriFromType( QVariant::Type type );
453
454 private:
455 class LiteralValueData;
456 class PlainData;
457 class TypedData;
459 };
460
462}
463
465
466#endif
A LanguageTag represents a language according to RFC 3066 and RFC 4646.
Definition: languagetag.h:45
Represents a literal value of an RDF Node.
Definition: literalvalue.h:67
LiteralValue(const LiteralValue &other)
QVariant variant() const
LiteralValue & operator=(int i)
LiteralValue(const QVariant &v)
bool isValid() const
static LiteralValue fromString(const QString &value, const QUrl &dataTypeUri)
bool isDouble() const
QVariant::Type type() const
static LiteralValue createPlainLiteral(const QString &value, const LanguageTag &lang=LanguageTag())
LiteralValue & operator=(qulonglong i)
LiteralValue(qlonglong i)
LiteralValue(qulonglong i)
LiteralValue & operator=(const QTime &time)
bool isDateTime() const
LiteralValue(const QTime &time)
bool isInt64() const
qlonglong toInt64() const
LiteralValue(const QLatin1String &string)
uint toUnsignedInt() const
bool operator==(const LiteralValue &other) const
bool isByteArray() const
LiteralValue & operator=(double d)
bool isUnsignedInt() const
LanguageTag language() const
double toDouble() const
LiteralValue & operator=(qlonglong i)
QUrl dataTypeUri() const
LiteralValue & operator=(const QByteArray &data)
bool isString() const
bool isUnsignedInt64() const
QString toString() const
LiteralValue(const QByteArray &data)
static LiteralValue fromString(const QString &value, QVariant::Type type)
LiteralValue(const QDate &date)
LiteralValue & operator=(const LiteralValue &other)
QByteArray toByteArray() const
qulonglong toUnsignedInt64() const
LiteralValue & operator=(const QDateTime &datetime)
LiteralValue & operator=(bool b)
bool operator!=(const LiteralValue &other) const
static QUrl dataTypeUriFromType(QVariant::Type type)
LiteralValue(const QDateTime &datetime)
LiteralValue & operator=(const QDate &date)
static LiteralValue fromVariant(const QVariant &value, const QUrl &dataType)
QDateTime toDateTime() const
LiteralValue(const QString &string)
static QVariant::Type typeFromDataTypeUri(const QUrl &dataTypeUri)
QTime toTime() const
QDate toDate() const
LiteralValue & operator=(uint i)
LiteralValue & operator=(const QLatin1String &s)
bool isPlain() const
LiteralValue & operator=(const QString &s)
LiteralValue(const char *string)
SOPRANO_EXPORT QDebug operator<<(QDebug dbg, const Soprano::LiteralValue &)
SOPRANO_EXPORT uint qHash(const LanguageTag &node)
#define SOPRANO_EXPORT