NepomukDaemons
term.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _NEPOMUK_SEARCH_TERM_H_
00021 #define _NEPOMUK_SEARCH_TERM_H_
00022
00023 #include <QtCore/QList>
00024 #include <QtCore/QUrl>
00025 #include <QtCore/QSharedDataPointer>
00026
00027 #include <Soprano/LiteralValue>
00028
00029 #include <nepomuk/nepomuk_export.h>
00030
00031
00032 namespace Nepomuk {
00033 namespace Search {
00044 class NEPOMUK_EXPORT Term
00045 {
00046 public:
00050 enum Type {
00051 InvalidTerm,
00059 LiteralTerm,
00060
00066 ResourceTerm,
00067
00071 AndTerm,
00072
00076 OrTerm,
00077
00085 ComparisonTerm
00086 };
00087
00088 enum Comparator {
00089 Contains,
00090 Equal,
00091 Greater,
00092 Smaller,
00093 GreaterOrEqual,
00094 SmallerOrEqual
00095 };
00096
00100 Term();
00101
00105 Term( const Term& other );
00106
00110 Term( const Soprano::LiteralValue& value );
00111
00115 Term( const QUrl& resource );
00116
00124 Term( const QString& field, const Soprano::LiteralValue& value, Comparator c = Contains );
00125
00133 Term( const QUrl& field, const Soprano::LiteralValue& value, Comparator c = Contains );
00134
00140 Term( const QUrl& field, const QUrl& resource );
00141
00145 ~Term();
00146
00150 Term& operator=( const Term& other );
00151
00155 Term& operator=( const Soprano::LiteralValue& other );
00156
00160 bool isValid() const;
00161
00167 Type type() const;
00168
00174 Soprano::LiteralValue value() const;
00175
00181 QUrl resource() const;
00182
00188 Comparator comparator() const;
00189
00196 QString field() const;
00197
00203 QUrl property() const;
00204
00210 QList<Term> subTerms() const;
00211
00215 void setType( Type );
00216
00220 void setValue( const Soprano::LiteralValue& );
00221
00225 void setResource( const QUrl& );
00226
00230 void setComparator( Comparator );
00231
00239 void setField( const QString& );
00240
00249 void setProperty( const QUrl& );
00250
00256 void setSubTerms( const QList<Term>& );
00257
00263 void addSubTerm( const Term& );
00264
00268 bool operator==( const Term& ) const;
00269
00270 private:
00271 class Private;
00272 QSharedDataPointer<Private> d;
00273 };
00274
00275 NEPOMUK_EXPORT uint qHash( const Nepomuk::Search::Term& );
00276 }
00277 }
00278
00279 NEPOMUK_EXPORT QDebug operator<<( QDebug, const Nepomuk::Search::Term& );
00280
00281 #endif