[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/nepomuk/services/backupsync/lib
From: Vishesh Handa <handa.vish () gmail ! com>
Date: 2011-01-28 9:12:30
Message-ID: 20110128091230.78CC4AC8BB () svn ! kde ! org
[Download RAW message or body]
SVN commit 1217725 by vhanda:
Change the mappings type from QHash<KUrl, Resource> to QHash<KUrl, KUrl>
Internally we still use Nepomuk::Resource in one or two places. For now it's more \
convenient this way.
M +5 -10 resourceidentifier.cpp
M +1 -3 resourceidentifier.h
M +2 -3 resourceidentifier_p.h
M +6 -6 resourcemerger.cpp
M +1 -1 resourcemerger.h
--- trunk/KDE/kdebase/runtime/nepomuk/services/backupsync/lib/resourceidentifier.cpp \
#1217724:1217725 @@ -174,25 +174,20 @@
// Getting the info
//
-Nepomuk::Resource Nepomuk::Sync::ResourceIdentifier::mappedResource(const KUrl& \
resourceUri) const +KUrl Nepomuk::Sync::ResourceIdentifier::mappedUri(const KUrl& \
resourceUri) const {
- QHash< KUrl, Resource >::iterator it = d->m_hash.find( resourceUri );
+ QHash< KUrl, KUrl >::iterator it = d->m_hash.find( resourceUri );
if( it != d->m_hash.end() )
return it.value();
- return Resource();
+ return KUrl();
}
-KUrl Nepomuk::Sync::ResourceIdentifier::mappedUri(const KUrl& resourceUri) const
-{
- return mappedResource( resourceUri ).resourceUri();
-}
-
KUrl::List Nepomuk::Sync::ResourceIdentifier::mappedUris() const
{
return d->m_hash.uniqueKeys();
}
-QHash< KUrl, Nepomuk::Resource > Nepomuk::Sync::ResourceIdentifier::mappings() const
+QHash<KUrl, KUrl> Nepomuk::Sync::ResourceIdentifier::mappings() const
{
return d->m_hash;
}
@@ -286,7 +281,7 @@
void Nepomuk::Sync::ResourceIdentifier::forceResource(const KUrl& oldUri, const \
Nepomuk::Resource& res) {
- d->m_hash[ oldUri ] = res;
+ d->m_hash[ oldUri ] = res.resourceUri();
d->m_notIdentified.remove( oldUri );
if( res.isFile() ) {
--- trunk/KDE/kdebase/runtime/nepomuk/services/backupsync/lib/resourceidentifier.h \
#1217724:1217725 @@ -99,14 +99,12 @@
*/
KUrl mappedUri( const KUrl & resourceUri ) const;
- Resource mappedResource( const KUrl & resourceUri ) const;
-
KUrl::List mappedUris() const;
/**
* Returns mappings of the identified uri
*/
- QHash<KUrl, Resource> mappings() const;
+ QHash<KUrl, KUrl> mappings() const;
/**
* Returns urls that were not successfully identified
--- trunk/KDE/kdebase/runtime/nepomuk/services/backupsync/lib/resourceidentifier_p.h \
#1217724:1217725 @@ -50,8 +50,7 @@
/**
* Contstructor.
* It will initialize all pointers with NULL and all values that
- * has a incorrect value with this value. For example -1 will be
- * assigned for m_id.
+ * has a incorrect value with this value.
*/
Private( ResourceIdentifier * parent );
void init( ResourceManager * rm );
@@ -65,7 +64,7 @@
* The main identification hash which maps external ResourceUris
* with the internal ones
*/
- QHash<KUrl, Nepomuk::Resource> m_hash;
+ QHash<KUrl, KUrl> m_hash;
QSet<KUrl> m_notIdentified;
--- trunk/KDE/kdebase/runtime/nepomuk/services/backupsync/lib/resourcemerger.cpp \
#1217724:1217725 @@ -47,8 +47,8 @@
ResourceMerger * q;
- QHash<KUrl, Resource> m_oldMappings;
- QHash<KUrl, Resource> m_newMappings;
+ QHash<KUrl, KUrl> m_oldMappings;
+ QHash<KUrl, KUrl> m_newMappings;
void push( const Soprano::Statement & st, const KUrl & graphUri );
KUrl resolve( const Soprano::Node & n );
@@ -103,7 +103,7 @@
Nepomuk::Resource Nepomuk::Sync::ResourceMerger::resolveUnidentifiedResource(const \
KUrl& uri) {
// The default implementation is to create it.
- QHash< KUrl, Resource >::const_iterator it = d->m_newMappings.constFind( uri );
+ QHash< KUrl, KUrl >::const_iterator it = d->m_newMappings.constFind( uri );
if( it != d->m_newMappings.constEnd() )
return it.value();
@@ -113,7 +113,7 @@
}
-void Nepomuk::Sync::ResourceMerger::merge(const Soprano::Graph& graph, const QHash< \
KUrl, Nepomuk::Resource >& mappings) +void Nepomuk::Sync::ResourceMerger::merge(const \
Soprano::Graph& graph, const QHash< KUrl, KUrl >& mappings) {
d->m_oldMappings = mappings;
@@ -175,9 +175,9 @@
const QUrl oldUri = n.isResource() ? n.uri() : QUrl(n.identifier());
// Find in mappings
- QHash< KUrl, Resource >::const_iterator it = m_oldMappings.constFind( oldUri );
+ QHash< KUrl, KUrl >::const_iterator it = m_oldMappings.constFind( oldUri );
if( it != m_oldMappings.constEnd() ) {
- return it.value().resourceUri();
+ return it.value();
} else {
Nepomuk::Resource res = q->resolveUnidentifiedResource( oldUri );
return res.resourceUri();
--- trunk/KDE/kdebase/runtime/nepomuk/services/backupsync/lib/resourcemerger.h \
#1217724:1217725 @@ -77,7 +77,7 @@
*
* \sa setGraphType graphType
*/
- virtual void merge( const Soprano::Graph & graph, const QHash<KUrl, \
Resource> & mappings ); + virtual void merge( const Soprano::Graph & \
graph, const QHash<KUrl, KUrl> & mappings );
/**
* The graph type by default is nrl:InstanceBase. If \p type is not a \
subclass of
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic