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 
33 namespace Soprano
34 {
67  {
68  public:
70 
74 
79 
83  LiteralValue( const LiteralValue& other );
84 
92  LiteralValue( const QVariant& v );
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 
155 
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 
230  LiteralValue& operator=( double d );
231 
237 
243 
249 
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 
326  QString toString() const;
327  QDate toDate() const;
328  QTime toTime() const;
332 
334 
341  QUrl dataTypeUri() const;
342 
350 
357  QVariant::Type type() const;
358 
364  QVariant variant() const;
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 
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 
461  SOPRANO_EXPORT uint qHash( const LiteralValue& lit );
462 }
463 
464 SOPRANO_EXPORT QDebug operator<<( QDebug dbg, const Soprano::LiteralValue& );
465 
466 #endif
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QLatin1String &s)
Soprano::LiteralValue::language
LanguageTag language() const
Soprano::LiteralValue::fromVariant
static LiteralValue fromVariant(const QVariant &value, const QUrl &dataType)
Soprano::LiteralValue::dataTypeUriFromType
static QUrl dataTypeUriFromType(QVariant::Type type)
soprano_export.h
Soprano::Vocabulary::RDF::type
SOPRANO_EXPORT QUrl type()
Soprano::LiteralValue::isValid
bool isValid() const
Soprano::LiteralValue::operator=
LiteralValue & operator=(bool b)
Soprano::LiteralValue::isInt
bool isInt() const
Soprano::LiteralValue::LiteralValue
LiteralValue()
Soprano::LiteralValue::LiteralValue
LiteralValue(const char *string)
QUrl
Soprano::LiteralValue::toDouble
double toDouble() const
Soprano::LiteralValue::typeFromDataTypeUri
static QVariant::Type typeFromDataTypeUri(const QUrl &dataTypeUri)
QDate
languagetag.h
Soprano::LiteralValue::LiteralValue
LiteralValue(const QString &string)
Soprano::LiteralValue::toBool
bool toBool() const
Soprano::Vocabulary::XMLSchema::date
SOPRANO_EXPORT QUrl date()
Soprano::LiteralValue::toString
QString toString() const
QSharedDataPointer< LiteralValueData >
Soprano::LiteralValue
Represents a literal value of an RDF Node.
Definition: literalvalue.h:67
Soprano::LiteralValue::operator=
LiteralValue & operator=(double d)
SOPRANO_EXPORT
#define SOPRANO_EXPORT
Definition: soprano_export.h:37
Soprano::LiteralValue::LiteralValue
LiteralValue(bool b)
Soprano::LiteralValue::LiteralValue
LiteralValue(double d)
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QTime &time)
Soprano::LiteralValue::LiteralValue
LiteralValue(const QVariant &v)
Soprano::LiteralValue::isUnsignedInt64
bool isUnsignedInt64() const
Soprano::Vocabulary::RDF::value
SOPRANO_EXPORT QUrl value()
Soprano::LiteralValue::~LiteralValue
~LiteralValue()
Soprano::Node::operator<<
SOPRANO_EXPORT QDebug operator<<(QDebug s, const Soprano::Node &)
Soprano::LiteralValue::isByteArray
bool isByteArray() const
Soprano::LanguageTag
A LanguageTag represents a language according to RFC 3066 and RFC 4646.
Definition: languagetag.h:45
Soprano::LiteralValue::variant
QVariant variant() const
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QDateTime &datetime)
Soprano::LiteralValue::operator==
bool operator==(const LiteralValue &other) const
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QDate &date)
Soprano::LiteralValue::LiteralValue
LiteralValue(const QTime &time)
Soprano::LiteralValue::isTime
bool isTime() const
Soprano::LiteralValue::fromString
static LiteralValue fromString(const QString &value, const QUrl &dataTypeUri)
Soprano::LiteralValue::createPlainLiteral
static LiteralValue createPlainLiteral(const QString &value, const LanguageTag &lang=LanguageTag())
Soprano::LiteralValue::dataTypeUri
QUrl dataTypeUri() const
Soprano::LiteralValue::toByteArray
QByteArray toByteArray() const
Soprano::LiteralValue::LiteralValue
LiteralValue(const QDate &date)
Soprano::LiteralValue::toInt
int toInt() const
Soprano::LiteralValue::fromString
static LiteralValue fromString(const QString &value, QVariant::Type type)
Soprano::Vocabulary::XMLSchema::time
SOPRANO_EXPORT QUrl time()
Soprano::LiteralValue::toDateTime
QDateTime toDateTime() const
Soprano::LiteralValue::isBool
bool isBool() const
Soprano::LiteralValue::LiteralValue
LiteralValue(qlonglong i)
Soprano::LiteralValue::isString
bool isString() const
Soprano::qHash
SOPRANO_EXPORT uint qHash(const LanguageTag &node)
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QByteArray &data)
QLatin1String
Soprano::LiteralValue::isInt64
bool isInt64() const
Soprano::LiteralValue::isDouble
bool isDouble() const
Soprano::LiteralValue::operator=
LiteralValue & operator=(qlonglong i)
Soprano::LiteralValue::toUnsignedInt
uint toUnsignedInt() const
Soprano::LiteralValue::operator=
LiteralValue & operator=(qulonglong i)
Soprano::LiteralValue::toTime
QTime toTime() const
Soprano::LiteralValue::LiteralValue
LiteralValue(const QDateTime &datetime)
Soprano::LiteralValue::LiteralValue
LiteralValue(qulonglong i)
Soprano::LiteralValue::operator=
LiteralValue & operator=(const LiteralValue &other)
Soprano
Definition: backend.h:36
Soprano::LiteralValue::isDate
bool isDate() const
Soprano::LiteralValue::LiteralValue
LiteralValue(int i)
Soprano::LiteralValue::LiteralValue
LiteralValue(const LiteralValue &other)
Soprano::LiteralValue::operator!=
bool operator!=(const LiteralValue &other) const
QDateTime
Soprano::LiteralValue::LiteralValue
LiteralValue(const QByteArray &data)
Soprano::LiteralValue::toUnsignedInt64
qulonglong toUnsignedInt64() const
Soprano::LiteralValue::toDate
QDate toDate() const
QVariant
Soprano::LiteralValue::operator=
LiteralValue & operator=(const QString &s)
Soprano::LiteralValue::type
QVariant::Type type() const
Soprano::LiteralValue::operator=
LiteralValue & operator=(int i)
Soprano::LiteralValue::operator=
LiteralValue & operator=(uint i)
Soprano::LiteralValue::isDateTime
bool isDateTime() const
QTime
Soprano::LiteralValue::LiteralValue
LiteralValue(const QLatin1String &string)
Soprano::LiteralValue::isUnsignedInt
bool isUnsignedInt() const
QString
Soprano::LiteralValue::toInt64
qlonglong toInt64() const
QByteArray
Soprano::LiteralValue::LiteralValue
LiteralValue(uint i)
Soprano::LiteralValue::isPlain
bool isPlain() const