Nepomuk
entity.h
Go to the documentation of this file.
00001 /* This file is part of the Nepomuk-KDE libraries 00002 Copyright (c) 2007-2010 Sebastian Trueg <trueg@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _NEPOMUK_ENTITY_H_ 00021 #define _NEPOMUK_ENTITY_H_ 00022 00023 #include <QtCore/QUrl> 00024 #include <QtCore/QString> 00025 #include <QtCore/QSharedData> 00026 #include <QtCore/QHash> 00027 00028 #include <Soprano/Node> 00029 00030 #include <kglobal.h> 00031 #include <klocale.h> 00032 00033 #include "nepomuk_export.h" 00034 00035 class QIcon; 00036 00037 00038 namespace Nepomuk { 00039 namespace Types { 00040 class EntityPrivate; 00041 00054 class NEPOMUK_EXPORT Entity 00055 { 00056 public: 00060 Entity( const Entity& ); 00061 00065 virtual ~Entity(); 00066 00070 Entity& operator=( const Entity& ); 00071 00076 QString name() const; 00077 00081 QUrl uri() const; 00082 00094 QString label( const QString& language = KGlobal::locale()->language() ); 00095 00111 QString label( const QString& language = KGlobal::locale()->language() ) const; 00112 00124 QString comment( const QString& language = KGlobal::locale()->language() ); 00125 00141 QString comment( const QString& language = KGlobal::locale()->language() ) const; 00142 00150 QIcon icon(); 00151 00161 QIcon icon() const; 00162 00170 bool isValid() const; 00171 00176 bool isAvailable(); 00177 00186 bool isAvailable() const; 00187 00201 void reset( bool recursive = false ); 00202 00211 bool userVisible() const; 00212 00216 operator QUrl() const { return uri(); } 00217 00222 bool operator==( const Entity& other ) const; 00223 00229 bool operator==( const QUrl& other ) const; 00230 00235 bool operator!=( const Entity& other ) const; 00236 00242 bool operator!=( const QUrl& other ) const; 00243 00244 protected: 00248 Entity(); 00249 00250 QExplicitlySharedDataPointer<EntityPrivate> d; 00251 }; 00252 00253 inline uint qHash( const Entity& c ) 00254 { 00255 return qHash( c.uri() ); 00256 } 00257 } 00258 } 00259 00260 #ifndef DISABLE_NEPOMUK_LEGACY 00261 00262 namespace Nepomuk { 00263 00264 class Ontology; 00265 00269 class KDE_DEPRECATED NEPOMUK_EXPORT Entity 00270 { 00271 public: 00272 Entity( const Entity& ); 00273 ~Entity(); 00274 00275 Entity& operator=( const Entity& ); 00276 00280 const Ontology* definingOntology() const; 00281 00286 QString name() const; 00287 00291 QUrl uri() const; 00292 00293 QString label( const QString& language = QString() ) const; 00294 QString comment( const QString& language = QString() ) const; 00295 00296 protected: 00297 Entity(); 00298 00299 private: 00300 class Private; 00301 QSharedDataPointer<Private> d; 00302 00303 friend class OntologyManager; 00304 }; 00305 } 00306 00307 #endif // DISABLE_NEPOMUK_LEGACY 00308 00309 #endif // _NEPOMUK_ENTITY_H_
KDE 4.6 API Reference