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

Nepomuk

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk
  • core
variant.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Nepomuk KDE project.
3  * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _NEPOMUK_VARIANT_H_
22 #define _NEPOMUK_VARIANT_H_
23 
24 #include "nepomuk_export.h"
25 #include "resource.h"
26 
27 #include <QtCore/QDateTime>
28 #include <QtCore/QUrl>
29 #include <QtCore/QVariant>
30 
31 namespace Soprano {
32  class Node;
33 }
34 
35 namespace Nepomuk {
36 
37  class Resource;
38 
65  class NEPOMUK_EXPORT Variant
66  {
67  public:
68  Variant();
69  ~Variant();
70  Variant( const Variant& other );
71 
75  explicit Variant( const QVariant& other );
76  Variant( int i );
77  Variant( qlonglong i );
78  Variant( uint i );
79  Variant( qulonglong i );
80  Variant( bool b );
81  Variant( double d );
82  Variant( const char* string );
83  Variant( const QString& string );
84  Variant( const QDate& date );
85  Variant( const QTime& time );
86  Variant( const QDateTime& datetime );
87  Variant( const QUrl& url );
88  Variant( const Resource& r );
89  Variant( const QList<int>& i );
90  Variant( const QList<qlonglong>& i );
91  Variant( const QList<uint>& i );
92  Variant( const QList<qulonglong>& i );
93  Variant( const QList<bool>& b );
94  Variant( const QList<double>& d );
95  Variant( const QStringList& stringlist );
96  Variant( const QList<QDate>& date );
97  Variant( const QList<QTime>& time );
98  Variant( const QList<QDateTime>& datetime );
99  Variant( const QList<QUrl>& url );
100  Variant( const QList<Resource>& r );
101 
107  Variant( const QList<Variant>& vl );
108 
109  Variant& operator=( const Variant& );
110  Variant& operator=( int i );
111  Variant& operator=( qlonglong i );
112  Variant& operator=( uint i );
113  Variant& operator=( qulonglong i );
114  Variant& operator=( bool b );
115  Variant& operator=( double d );
116  Variant& operator=( const QString& string );
117  Variant& operator=( const QDate& date );
118  Variant& operator=( const QTime& time );
119  Variant& operator=( const QDateTime& datetime );
120  Variant& operator=( const QUrl& url );
121  Variant& operator=( const Resource& r );
122  Variant& operator=( const QList<int>& i );
123  Variant& operator=( const QList<qlonglong>& i );
124  Variant& operator=( const QList<uint>& i );
125  Variant& operator=( const QList<qulonglong>& i );
126  Variant& operator=( const QList<bool>& b );
127  Variant& operator=( const QList<double>& d );
128  Variant& operator=( const QStringList& stringlist );
129  Variant& operator=( const QList<QDate>& date );
130  Variant& operator=( const QList<QTime>& time );
131  Variant& operator=( const QList<QDateTime>& datetime );
132  Variant& operator=( const QList<QUrl>& url );
133  Variant& operator=( const QList<Resource>& r );
134 
139  void append( int i );
140  void append( qlonglong i );
141  void append( uint i );
142  void append( qulonglong i );
143  void append( bool b );
144  void append( double d );
145  void append( const QString& string );
146  void append( const QDate& date );
147  void append( const QTime& time );
148  void append( const QDateTime& datetime );
149  void append( const QUrl& url );
150  void append( const Resource& r );
151 
158  void append( const Variant& v );
159 
165  bool operator==( const Variant& other ) const;
166 
170  bool operator!=( const Variant& other ) const;
171 
172  bool isValid() const;
173 
177  int type() const;
178 
183  int simpleType() const;
184 
198  bool isList() const;
199 
200  bool isInt() const;
201  bool isInt64() const;
202  bool isUnsignedInt() const;
203  bool isUnsignedInt64() const;
204  bool isBool() const;
205  bool isDouble() const;
206  bool isString() const;
207  bool isDate() const;
208  bool isTime() const;
209  bool isDateTime() const;
210  bool isUrl() const;
211  bool isResource() const;
212 
213  bool isIntList() const;
214  bool isInt64List() const;
215  bool isUnsignedIntList() const;
216  bool isUnsignedInt64List() const;
217  bool isBoolList() const;
218  bool isDoubleList() const;
219  bool isStringList() const;
220  bool isDateList() const;
221  bool isTimeList() const;
222  bool isDateTimeList() const;
223  bool isUrlList() const;
224  bool isResourceList() const;
225 
226  QVariant variant() const;
227 
234  int toInt() const;
235 
242  qlonglong toInt64() const;
243 
250  uint toUnsignedInt() const;
251 
258  qulonglong toUnsignedInt64() const;
259 
265  bool toBool() const;
266 
272  double toDouble() const;
273 
282  QString toString() const;
283 
289  QDate toDate() const;
290 
296  QTime toTime() const;
297 
303  QDateTime toDateTime() const;
304 
313  QUrl toUrl() const;
314 
321  Resource toResource() const;
322 
323  QList<int> toIntList() const;
324  QList<qlonglong> toInt64List() const;
325  QList<uint> toUnsignedIntList() const;
326  QList<qulonglong> toUnsignedInt64List() const;
327  QList<bool> toBoolList() const;
328  QList<double> toDoubleList() const;
329 
334  QStringList toStringList() const;
335  QList<QDate> toDateList() const;
336  QList<QTime> toTimeList() const;
337  QList<QDateTime> toDateTimeList() const;
338  QList<QUrl> toUrlList() const;
339  QList<Resource> toResourceList() const;
340 
346  QList<Variant> toVariantList() const;
347 
353  Soprano::Node toNode() const;
354 
360  QList<Soprano::Node> toNodeList() const;
361 
367  static Variant fromString( const QString& value, int type );
368 
374  static Variant fromNode( const Soprano::Node& node );
375 
381  static Variant fromNodeList( const QList<Soprano::Node>& node );
382 
383  private:
384  class Private;
385  Private* const d;
386  };
387 }
388 
389 
390 NEPOMUK_EXPORT QDebug operator<<( QDebug dbg, const Nepomuk::Variant& );
391 
392 Q_DECLARE_METATYPE(Nepomuk::Resource)
393 Q_DECLARE_METATYPE(QList<Nepomuk::Resource>)
394 Q_DECLARE_METATYPE(QList<int>)
395 Q_DECLARE_METATYPE(QList<qlonglong>)
396 Q_DECLARE_METATYPE(QList<uint>)
397 Q_DECLARE_METATYPE(QList<qulonglong>)
398 Q_DECLARE_METATYPE(QList<double>)
399 Q_DECLARE_METATYPE(QList<bool>)
400 Q_DECLARE_METATYPE(QList<QDate>)
401 Q_DECLARE_METATYPE(QList<QTime>)
402 Q_DECLARE_METATYPE(QList<QDateTime>)
403 Q_DECLARE_METATYPE(QList<QUrl>)
404 
405 #endif
Nepomuk::Resource
Resource is the central object type in Nepomuk.
Definition: resource.h:94
resource.h
Nepomuk::Variant
The Nepomuk Variant extends over QVariant by introducing direct support for Resource embedding...
Definition: variant.h:65
DateRange::operator<<
QDebug operator<<(QDebug dbg, const DateRange &range)
Debug streaming operator.
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal