Nepomuk
resource.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
00021 #ifndef _NEPOMUK_RESOURCE_H_
00022 #define _NEPOMUK_RESOURCE_H_
00023
00024 #include <QtCore/QHash>
00025 #include <QtCore/QStringList>
00026 #include <QtCore/QUrl>
00027
00028 #include "nepomuk_export.h"
00029
00030
00031 namespace Nepomuk {
00032
00033 class ResourceData;
00034 class Variant;
00035 class Tag;
00036 class Resource;
00037
00038
00039 enum ErrorCode {
00040 NoError = 0,
00041 CommunicationError,
00042 InvalidType,
00043 UnknownError
00044 };
00045
00049
00050 NEPOMUK_EXPORT QString errorString( ErrorCode code );
00051
00071 class NEPOMUK_EXPORT Resource
00072 {
00073 public:
00079 Resource();
00080
00081 Resource( const Resource& );
00082
00128 Resource( const QString& uriOrIdentifier, const QUrl& type = QUrl() );
00129
00133 KDE_DEPRECATED Resource( const QString& uriOrIdentifier, const QString& type );
00134
00145 Resource( const QUrl& uri, const QUrl& type = QUrl() );
00146
00150 Resource( ResourceData* );
00151
00152 virtual ~Resource();
00153
00154 Resource& operator=( const Resource& );
00155
00173 KDE_DEPRECATED QString uri() const;
00174
00187 QUrl resourceUri() const;
00188
00203 KDE_DEPRECATED QString type() const;
00204
00214 QUrl resourceType() const;
00215
00222 QList<QUrl> types() const;
00223
00229 void setTypes( const QList<QUrl>& types );
00230
00236 void addType( const QUrl& type );
00237
00242 bool hasType( const QUrl& typeUri ) const;
00243
00252 QString className() const;
00253
00257 KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
00258
00262 QHash<QUrl, Variant> properties() const;
00263
00272 bool hasProperty( const QUrl& uri ) const;
00273
00277 KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
00278
00285 Variant property( const QUrl& uri ) const;
00286
00290 KDE_DEPRECATED Variant property( const QString& uri ) const;
00291
00298 void setProperty( const QUrl& uri, const Variant& value );
00299
00303 KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
00304
00310 void removeProperty( const QUrl& uri );
00311
00315 KDE_DEPRECATED void removeProperty( const QString& uri );
00316
00322 void remove();
00323
00328 bool exists() const;
00329
00337 bool isValid() const;
00338
00346 QString genericLabel() const;
00347
00356 QString genericDescription() const;
00357
00363 QString genericIcon() const;
00364
00369 bool operator==( const Resource& ) const;
00370
00375 QString description() const;
00376
00381 void setDescription( const QString& value );
00382
00386 static QString descriptionUri();
00387
00391 QStringList identifiers() const;
00392
00396 void setIdentifiers( const QStringList& value );
00397
00401 void addIdentifier( const QString& value );
00402
00406 static QString identifierUri();
00407
00411 QStringList altLabels() const;
00412
00416 void setAltLabels( const QStringList& value );
00417
00421 void addAltLabel( const QString& value );
00422
00426 static QString altLabelUri();
00427
00431 QList<Resource> annotations() const;
00432
00436 void setAnnotations( const QList<Resource>& value );
00437
00441 void addAnnotation( const Resource& value );
00442
00446 static QString annotationUri();
00447
00452 QList<Tag> tags() const;
00453
00458 void setTags( const QList<Tag>& value );
00459
00465 void addTag( const Tag& value );
00466
00470 static QString tagUri();
00471
00475 QList<Resource> topics() const;
00476
00480 void setTopics( const QList<Resource>& value );
00481
00485 void addTopic( const Resource& value );
00486
00490 static QString topicUri();
00491
00495 QList<Resource> isTopicOfs() const;
00496
00500 void setIsTopicOfs( const QList<Resource>& value );
00501
00505 void addIsTopicOf( const Resource& value );
00506
00510 static QString isTopicOfUri();
00511
00515 QList<Resource> isRelateds() const;
00516
00520 void setIsRelateds( const QList<Resource>& value );
00521
00525 void addIsRelated( const Resource& value );
00526
00530 static QString isRelatedUri();
00531
00535 QString label() const;
00536
00540 void setLabel( const QString& value );
00541
00545 static QString labelUri();
00546
00550 quint32 rating() const;
00551
00555 void setRating( const quint32& value );
00556
00560 static QString ratingUri();
00561
00568 QStringList symbols() const;
00569
00576 void setSymbols( const QStringList& value );
00577
00584 void addSymbol( const QString& value );
00585
00589 static QString symbolUri();
00590
00595 QList<Resource> annotationOf() const;
00596
00601 QList<Resource> isRelatedOf() const;
00602
00610 static QList<Resource> allResources();
00611
00612
00613 private:
00614 ResourceData* m_data;
00615
00616 class Private;
00617 Private* d;
00618
00619 friend class ResourceData;
00620 };
00621 }
00622
00623 #endif