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

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • types
entitymanager.cpp
Go to the documentation of this file.
1 /* This file is part of the Nepomuk-KDE libraries
2  Copyright (c) 2007-2010 Sebastian Trueg <trueg@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "entitymanager.h"
21 #include "class_p.h"
22 #include "property_p.h"
23 #include "ontology_p.h"
24 
25 #include "resourcemanager.h"
26 
27 #include <QtCore/QMutexLocker>
28 
29 Q_GLOBAL_STATIC( Nepomuk2::Types::EntityManager, entityManager )
30 
31 Nepomuk2::Types::EntityManager::EntityManager()
32 {
33 }
34 
35 
36 QExplicitlySharedDataPointer<Nepomuk2::Types::ClassPrivate> Nepomuk2::Types::EntityManager::getClass( const QUrl& uri )
37 {
38  QMutexLocker lock( &m_mutex );
39 
40  QHash<QUrl, QExplicitlySharedDataPointer<ClassPrivate> >::const_iterator it = m_classMap.constFind( uri );
41  if ( it != m_classMap.constEnd() ) {
42  return it.value();
43  }
44  else {
45  QExplicitlySharedDataPointer<ClassPrivate> scp( new ClassPrivate( uri ) );
46  m_classMap.insert( uri, scp );
47  return scp;
48  }
49 }
50 
51 
52 QExplicitlySharedDataPointer<Nepomuk2::Types::PropertyPrivate> Nepomuk2::Types::EntityManager::getProperty( const QUrl& uri )
53 {
54  QMutexLocker lock( &m_mutex );
55 
56  QHash<QUrl, QExplicitlySharedDataPointer<PropertyPrivate> >::const_iterator it = m_propertyMap.constFind( uri );
57  if ( it != m_propertyMap.constEnd() ) {
58  return it.value();
59  }
60  else {
61  QExplicitlySharedDataPointer<PropertyPrivate> cp( new PropertyPrivate( uri ) );
62  m_propertyMap.insert( uri, cp );
63  return cp;
64  }
65 }
66 
67 
68 QExplicitlySharedDataPointer<Nepomuk2::Types::OntologyPrivate> Nepomuk2::Types::EntityManager::getOntology( const QUrl& uri )
69 {
70  QMutexLocker lock( &m_mutex );
71 
72  QHash<QUrl, QExplicitlySharedDataPointer<OntologyPrivate> >::const_iterator it = m_ontologyMap.constFind( uri );
73  if ( it != m_ontologyMap.constEnd() ) {
74  return it.value();
75  }
76  else {
77  QExplicitlySharedDataPointer<OntologyPrivate> cp( new OntologyPrivate( uri ) );
78  m_ontologyMap.insert( uri, cp );
79  return cp;
80  }
81 }
82 
83 
84 Nepomuk2::Types::EntityManager* Nepomuk2::Types::EntityManager::self()
85 {
86  return entityManager();
87 }
Nepomuk2::Types::EntityManager::getClass
QExplicitlySharedDataPointer< ClassPrivate > getClass(const QUrl &uri)
Definition: entitymanager.cpp:36
QHash
resourcemanager.h
Nepomuk2::Types::EntityManager::getOntology
QExplicitlySharedDataPointer< OntologyPrivate > getOntology(const QUrl &uri)
Definition: entitymanager.cpp:68
entitymanager.h
Nepomuk2::Types::EntityManager::self
static EntityManager * self()
Definition: entitymanager.cpp:84
Nepomuk2::Types::EntityManager
Cache for all loaded entities.
Definition: entitymanager.h:43
Nepomuk2::Types::EntityManager::getProperty
QExplicitlySharedDataPointer< PropertyPrivate > getProperty(const QUrl &uri)
Definition: entitymanager.cpp:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal