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 namespace Nepomuk {
00031
00032 class ResourceManager;
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
00090 Resource( ResourceManager* manager );
00091
00095 Resource( const Resource& );
00096
00134 Resource( const QString& pathOrIdentifier, const QUrl& type = QUrl() );
00135
00144 Resource( const QString& pathOrIdentifier, const QUrl& type, ResourceManager* manager );
00145
00149 KDE_DEPRECATED Resource( const QString& pathOrIdentifier, const QString& type );
00150
00163 Resource( const QUrl& uri, const QUrl& type = QUrl() );
00164
00173 Resource( const QUrl& uri, const QUrl& type, ResourceManager* manager );
00174
00178 Resource( ResourceData* );
00179
00183 virtual ~Resource();
00184
00188 Resource& operator=( const Resource& other );
00189
00193 Resource& operator=( const QUrl& uri );
00194
00200 ResourceManager* manager() const;
00201
00219 KDE_DEPRECATED QString uri() const;
00220
00233 QUrl resourceUri() const;
00234
00249 KDE_DEPRECATED QString type() const;
00250
00260 QUrl resourceType() const;
00261
00268 QList<QUrl> types() const;
00269
00275 void setTypes( const QList<QUrl>& types );
00276
00282 void addType( const QUrl& type );
00283
00288 bool hasType( const QUrl& typeUri ) const;
00289
00298 QString className() const;
00299
00303 KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
00304
00308 QHash<QUrl, Variant> properties() const;
00309
00318 bool hasProperty( const QUrl& uri ) const;
00319
00323 KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
00324
00331 Variant property( const QUrl& uri ) const;
00332
00336 KDE_DEPRECATED Variant property( const QString& uri ) const;
00337
00344 void setProperty( const QUrl& uri, const Variant& value );
00345
00354 void addProperty( const QUrl& uri, const Variant& value );
00355
00359 KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
00360
00366 void removeProperty( const QUrl& uri );
00367
00376 void removeProperty( const QUrl& uri, const Variant& value );
00377
00381 KDE_DEPRECATED void removeProperty( const QString& uri );
00382
00388 void remove();
00389
00394 bool exists() const;
00395
00403 bool isValid() const;
00404
00412 QString genericLabel() const;
00413
00422 QString genericDescription() const;
00423
00429 QString genericIcon() const;
00430
00439 Thing pimoThing();
00440
00444 bool operator==( const Resource& ) const;
00445
00451 bool operator!=( const Resource& ) const;
00452
00457 QString description() const;
00458
00463 void setDescription( const QString& value );
00464
00468 static QString descriptionUri();
00469
00473 QStringList identifiers() const;
00474
00478 void setIdentifiers( const QStringList& value );
00479
00483 void addIdentifier( const QString& value );
00484
00488 static QString identifierUri();
00489
00493 QStringList altLabels() const;
00494
00498 void setAltLabels( const QStringList& value );
00499
00503 void addAltLabel( const QString& value );
00504
00508 static QString altLabelUri();
00509
00513 QList<Resource> annotations() const;
00514
00518 void setAnnotations( const QList<Resource>& value );
00519
00523 void addAnnotation( const Resource& value );
00524
00528 static QString annotationUri();
00529
00534 QList<Tag> tags() const;
00535
00540 void setTags( const QList<Tag>& value );
00541
00547 void addTag( const Tag& value );
00548
00552 static QString tagUri();
00553
00557 QList<Resource> topics() const;
00558
00562 void setTopics( const QList<Resource>& value );
00563
00567 void addTopic( const Resource& value );
00568
00572 static QString topicUri();
00573
00577 QList<Resource> isTopicOfs() const;
00578
00582 void setIsTopicOfs( const QList<Resource>& value );
00583
00587 void addIsTopicOf( const Resource& value );
00588
00592 static QString isTopicOfUri();
00593
00597 QList<Resource> isRelateds() const;
00598
00602 void setIsRelateds( const QList<Resource>& value );
00603
00607 void addIsRelated( const Resource& value );
00608
00612 static QString isRelatedUri();
00613
00617 QString label() const;
00618
00622 void setLabel( const QString& value );
00623
00627 static QString labelUri();
00628
00632 quint32 rating() const;
00633
00637 void setRating( const quint32& value );
00638
00642 static QString ratingUri();
00643
00650 QStringList symbols() const;
00651
00658 void setSymbols( const QStringList& value );
00659
00666 void addSymbol( const QString& value );
00667
00671 static QString symbolUri();
00672
00677 QList<Resource> annotationOf() const;
00678
00683 QList<Resource> isRelatedOf() const;
00684
00694 static QList<Resource> allResources();
00695
00696 private:
00697 ResourceData* m_data;
00698
00699 class Private;
00700 Private* d;
00701
00702 friend class ResourceData;
00703 };
00704 }
00705
00706 #endif