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

Nepomuk

resource.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Nepomuk KDE project.
00003  * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef _NEPOMUK_RESOURCE_H_
00022 #define _NEPOMUK_RESOURCE_H_
00023 
00024 #include <QtCore/QHash>
00025 #include <QtCore/QStringList>
00026 
00027 #include <kurl.h>
00028 
00029 #include "class.h"
00030 
00031 #include "nepomuk_export.h"
00032 
00033 namespace Nepomuk {
00034 
00035     class ResourceManager;
00036     class ResourceData;
00037     class Variant;
00038     class Tag;
00039     class Thing;
00040     class File;
00041     namespace Types {
00042         class Property;
00043     }
00044 
00045     enum ErrorCode {
00046         NoError = 0,
00047         CommunicationError, 
00048         InvalidType,
00049         UnknownError
00050     };
00051 
00055     // FIXME: add the uri of the resource as parameter
00056     NEPOMUK_EXPORT QString errorString( ErrorCode code );
00057 
00094     class NEPOMUK_EXPORT Resource
00095     {
00096     public:
00102         Resource();
00103 
00114         Resource( ResourceManager* manager );
00115 
00119         Resource( const Resource& );
00120 
00154         Resource( const QString& pathOrIdentifier, const QUrl& type = QUrl() );
00155 
00164         Resource( const QString& pathOrIdentifier, const QUrl& type, ResourceManager* manager );
00165 
00169 #ifndef KDE_NO_DEPRECATED
00170         KDE_DEPRECATED Resource( const QString& pathOrIdentifier, const QString& type );
00171 #endif
00172 
00187         Resource( const QUrl& uri, const QUrl& type = QUrl() );
00188 
00197         Resource( const QUrl& uri, const QUrl& type, ResourceManager* manager );
00198 
00202         Resource( ResourceData* );
00203 
00207         virtual ~Resource();
00208 
00212         Resource& operator=( const Resource& other );
00213 
00217         Resource& operator=( const QUrl& uri );
00218 
00224         ResourceManager* manager() const;
00225 
00243 #ifndef KDE_NO_DEPRECATED
00244         KDE_DEPRECATED QString uri() const;
00245 #endif
00246 
00260         QUrl resourceUri() const;
00261 
00276 #ifndef KDE_NO_DEPRECATED
00277         KDE_DEPRECATED QString type() const;
00278 #endif
00279 
00289         QUrl resourceType() const;
00290 
00297         QList<QUrl> types() const;
00298 
00304         void setTypes( const QList<QUrl>& types );
00305 
00311         void addType( const QUrl& type );
00312 
00317         bool hasType( const QUrl& typeUri ) const;
00318 
00327         QString className() const;
00328 
00332 #ifndef KDE_NO_DEPRECATED
00333         KDE_DEPRECATED QHash<QString, Variant> allProperties() const;
00334 #endif
00335 
00339         QHash<QUrl, Variant> properties() const;
00340 
00349         bool hasProperty( const QUrl& uri ) const;
00350 
00356         bool hasProperty( const Types::Property& p, const Variant& v ) const;
00357 
00361 #ifndef KDE_NO_DEPRECATED
00362         KDE_DEPRECATED bool hasProperty( const QString& uri ) const;
00363 #endif
00364 
00371         Variant property( const QUrl& uri ) const;
00372 
00376 #ifndef KDE_NO_DEPRECATED
00377         KDE_DEPRECATED Variant property( const QString& uri ) const;
00378 #endif
00379 
00386         void setProperty( const QUrl& uri, const Variant& value );
00387 
00396         void addProperty( const QUrl& uri, const Variant& value );
00397 
00401 #ifndef KDE_NO_DEPRECATED
00402         KDE_DEPRECATED void setProperty( const QString& uri, const Variant& value );
00403 #endif
00404 
00410         void removeProperty( const QUrl& uri );
00411 
00420         void removeProperty( const QUrl& uri, const Variant& value );
00421 
00425 #ifndef KDE_NO_DEPRECATED
00426         KDE_DEPRECATED void removeProperty( const QString& uri );
00427 #endif
00428 
00434         void remove();
00435 
00440         bool exists() const;
00441 
00449         bool isValid() const;
00450 
00458         QString genericLabel() const;
00459 
00468         QString genericDescription() const;
00469 
00475         QString genericIcon() const;
00476 
00485         Thing pimoThing();
00486 
00490         bool operator==( const Resource& ) const;
00491 
00497         bool operator!=( const Resource& ) const;
00498 
00503         QString description() const;
00504 
00509         void setDescription( const QString& value );
00510 
00514         static QString descriptionUri();
00515 
00519         QStringList identifiers() const;
00520 
00524         void setIdentifiers( const QStringList& value );
00525 
00529         void addIdentifier( const QString& value );
00530 
00534         static QString identifierUri();
00535 
00539         QStringList altLabels() const;
00540 
00544         void setAltLabels( const QStringList& value );
00545 
00549         void addAltLabel( const QString& value );
00550 
00554         static QString altLabelUri();
00555 
00559         QList<Resource> annotations() const;
00560 
00564         void setAnnotations( const QList<Resource>& value );
00565 
00569         void addAnnotation( const Resource& value );
00570 
00574         static QString annotationUri();
00575 
00580         QList<Tag> tags() const;
00581 
00586         void setTags( const QList<Tag>& value );
00587 
00593         void addTag( const Tag& value );
00594 
00598         static QString tagUri();
00599 
00603         QList<Resource> topics() const;
00604 
00608         void setTopics( const QList<Resource>& value );
00609 
00613         void addTopic( const Resource& value );
00614 
00618         static QString topicUri();
00619 
00623         QList<Resource> isTopicOfs() const;
00624 
00628         void setIsTopicOfs( const QList<Resource>& value );
00629 
00633         void addIsTopicOf( const Resource& value );
00634 
00638         static QString isTopicOfUri();
00639 
00643         QList<Resource> isRelateds() const;
00644 
00648         void setIsRelateds( const QList<Resource>& value );
00649 
00653         void addIsRelated( const Resource& value );
00654 
00658         static QString isRelatedUri();
00659 
00663         QString label() const;
00664 
00668         void setLabel( const QString& value );
00669 
00673         static QString labelUri();
00674 
00678         quint32 rating() const;
00679 
00683         void setRating( const quint32& value );
00684 
00688         static QString ratingUri();
00689 
00696         QStringList symbols() const;
00697 
00704         void setSymbols( const QStringList& value );
00705 
00712         void addSymbol( const QString& value );
00713 
00717         static QString symbolUri();
00718 
00723         QList<Resource> annotationOf() const;
00724 
00729         QList<Resource> isRelatedOf() const;
00730 
00744         static QList<Resource> allResources();
00745 
00753         int usageCount() const;
00754 
00761         void increaseUsageCount();
00762 
00770         bool isFile() const;
00771 
00778         File toFile() const;
00779 
00788         static Resource fromResourceUri( const KUrl& uri, const Nepomuk::Types::Class& type = Nepomuk::Types::Class(), ResourceManager* manager = 0 );
00789 
00790     private:
00797         void determineFinalResourceData() const;
00798 
00799         ResourceData* m_data;
00800 
00801         class Private;
00802         Private* d; // unused
00803 
00804         friend class ResourceData;
00805     };
00806 
00807     NEPOMUK_EXPORT uint qHash( const Resource& res );
00808 }
00809 
00810 #endif

Nepomuk

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal