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 Thing;
00037
00038 enum ErrorCode {
00039 NoError = 0,
00040 CommunicationError,
00041 InvalidType,
00042 UnknownError
00043 };
00044
00048
00049 NEPOMUK_EXPORT QString errorString( ErrorCode code );
00050
00070 class NEPOMUK_EXPORT Resource
00071 {
00072 public:
00078 Resource();
00079
00080 Resource( const Resource& );
00081
00127 Resource( const QString& uriOrIdentifier, const QUrl& type = QUrl() );
00128
00132 KDE_DEPRECATED Resource( const QString& uriOrIdentifier, const QString& type );
00133
00144 Resource( const QUrl& uri, const QUrl& type = QUrl() );
00145
00149 Resource( ResourceData* );
00150
00151 virtual ~Resource();
00152
00153 Resource& operator=( const Resource& );
00154
00155 Resource& operator=( const QUrl& );
00156
00174 KDE_DEPRECATED QString uri() const;
00175
00188 QUrl resourceUri() const;
00189
00204 KDE_DEPRECATED QString type() const;
00205
00215 QUrl resourceType() const;
00216
00223 QList<QUrl> types() const;
00224
00230 void setTypes( const QList<QUrl>& types );
00231
00237 void addType( const QUrl& type );
00238
00243 bool hasType( const QUrl& typeUri ) const;
00244
00253 QString className() const;
00254
00258 KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
00259
00263 QHash<QUrl, Variant> properties() const;
00264
00273 bool hasProperty( const QUrl& uri ) const;
00274
00278 KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
00279
00286 Variant property( const QUrl& uri ) const;
00287
00291 KDE_DEPRECATED Variant property( const QString& uri ) const;
00292
00299 void setProperty( const QUrl& uri, const Variant& value );
00300
00304 KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
00305
00311 void removeProperty( const QUrl& uri );
00312
00316 KDE_DEPRECATED void removeProperty( const QString& uri );
00317
00323 void remove();
00324
00329 bool exists() const;
00330
00338 bool isValid() const;
00339
00347 QString genericLabel() const;
00348
00357 QString genericDescription() const;
00358
00364 QString genericIcon() const;
00365
00374 Thing pimoThing();
00375
00380 bool operator==( const Resource& ) const;
00381
00386 QString description() const;
00387
00392 void setDescription( const QString& value );
00393
00397 static QString descriptionUri();
00398
00402 QStringList identifiers() const;
00403
00407 void setIdentifiers( const QStringList& value );
00408
00412 void addIdentifier( const QString& value );
00413
00417 static QString identifierUri();
00418
00422 QStringList altLabels() const;
00423
00427 void setAltLabels( const QStringList& value );
00428
00432 void addAltLabel( const QString& value );
00433
00437 static QString altLabelUri();
00438
00442 QList<Resource> annotations() const;
00443
00447 void setAnnotations( const QList<Resource>& value );
00448
00452 void addAnnotation( const Resource& value );
00453
00457 static QString annotationUri();
00458
00463 QList<Tag> tags() const;
00464
00469 void setTags( const QList<Tag>& value );
00470
00476 void addTag( const Tag& value );
00477
00481 static QString tagUri();
00482
00486 QList<Resource> topics() const;
00487
00491 void setTopics( const QList<Resource>& value );
00492
00496 void addTopic( const Resource& value );
00497
00501 static QString topicUri();
00502
00506 QList<Resource> isTopicOfs() const;
00507
00511 void setIsTopicOfs( const QList<Resource>& value );
00512
00516 void addIsTopicOf( const Resource& value );
00517
00521 static QString isTopicOfUri();
00522
00526 QList<Resource> isRelateds() const;
00527
00531 void setIsRelateds( const QList<Resource>& value );
00532
00536 void addIsRelated( const Resource& value );
00537
00541 static QString isRelatedUri();
00542
00546 QString label() const;
00547
00551 void setLabel( const QString& value );
00552
00556 static QString labelUri();
00557
00561 quint32 rating() const;
00562
00566 void setRating( const quint32& value );
00567
00571 static QString ratingUri();
00572
00579 QStringList symbols() const;
00580
00587 void setSymbols( const QStringList& value );
00588
00595 void addSymbol( const QString& value );
00596
00600 static QString symbolUri();
00601
00606 QList<Resource> annotationOf() const;
00607
00612 QList<Resource> isRelatedOf() const;
00613
00621 static QList<Resource> allResources();
00622
00623
00624 private:
00625 ResourceData* m_data;
00626
00627 class Private;
00628 Private* d;
00629
00630 friend class ResourceData;
00631 };
00632 }
00633
00634 #endif