~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to nepomuk/services/backupsync/service/identificationset.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   This file is part of the Nepomuk KDE project.
3
 
   Copyright (C) 2010  Vishesh Handa <handa.vish@gmail.com>
4
 
 
5
 
   This library is free software; you can redistribute it and/or
6
 
   modify it under the terms of the GNU Lesser General Public
7
 
   License as published by the Free Software Foundation; either
8
 
   version 2.1 of the License, or (at your option) version 3, or any
9
 
   later version accepted by the membership of KDE e.V. (or its
10
 
   successor approved by the membership of KDE e.V.), which shall
11
 
   act as a proxy defined in Section 6 of version 3 of the license.
12
 
 
13
 
   This library is distributed in the hope that it will be useful,
14
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
   Lesser General Public License for more details.
17
 
 
18
 
   You should have received a copy of the GNU Lesser General Public
19
 
   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 
*/
21
 
 
22
 
#ifndef IDENTIFICATIONSET_H
23
 
#define IDENTIFICATIONSET_H
24
 
 
25
 
#include <QtCore/QUrl>
26
 
#include <QtCore/QSet>
27
 
#include <QtCore/QMultiHash>
28
 
#include <QtCore/QTextStream>
29
 
#include <QtCore/QSharedDataPointer>
30
 
#include <Nepomuk/ResourceManager>
31
 
 
32
 
namespace Soprano {
33
 
    class Statement;
34
 
    class Model;
35
 
}
36
 
 
37
 
namespace Nepomuk {
38
 
        
39
 
        class ChangeLog;
40
 
        
41
 
        class IdentificationSet
42
 
        {
43
 
        public :
44
 
            IdentificationSet();
45
 
            IdentificationSet( const IdentificationSet & rhs );
46
 
            virtual ~IdentificationSet();
47
 
 
48
 
            /**
49
 
             * Loads the IdentificationSet present at the \p url
50
 
             *
51
 
             * \param url It must be a local file
52
 
             */
53
 
            static IdentificationSet fromUrl( const QUrl & url );
54
 
 
55
 
            /**
56
 
             * Parses the contents of the text stream \p ts and returns a IdentificationSet.
57
 
             */
58
 
            static IdentificationSet fromTextStream( QTextStream& ts );
59
 
 
60
 
            /**
61
 
             * Creates an IdentificationSet from the ChangeLog \p log. The model \p is queried
62
 
             * for all the identification properties for each resource in the \p log.
63
 
             *
64
 
             * \param log The ChangeLog
65
 
             * \param model The model which will be queried for all the identification properties.
66
 
             *              By default the Nepomuk mainModel is used.
67
 
             * \param ignoreList The resources that shall be ignored ( not considered )
68
 
             */
69
 
            static IdentificationSet fromChangeLog(const ChangeLog& log, Soprano::Model* model = Nepomuk::ResourceManager::instance()->mainModel(), const QSet<QUrl> & ignoreList = QSet<QUrl>());
70
 
 
71
 
            /**
72
 
             * Creates an IdentificationSet which only contains the properties for the Resource
73
 
             * with resource uri \p resourceUri.
74
 
             */
75
 
            static IdentificationSet fromResource(const QUrl & resourceUri, Soprano::Model* model = Nepomuk::ResourceManager::instance()->mainModel(), const QSet<QUrl> & ignoreList = QSet<QUrl>());
76
 
 
77
 
            /**
78
 
             * Creates an IdentificationSet for all the resources present in \p resList
79
 
             */
80
 
            static IdentificationSet fromResourceList( const QList<QUrl> resList, Soprano::Model* model = Nepomuk::ResourceManager::instance()->mainModel() );
81
 
            
82
 
            /**
83
 
             * Creates an IdentificationSet which contains all the identification properties
84
 
             * of all the resources present in the \p log. No model is queried to get these
85
 
             * properties. Only the identification properties present in the ChangeLog are
86
 
             * used.
87
 
             *
88
 
             * In order to test which properties are identifyable, the main model is queried.
89
 
             */
90
 
            static IdentificationSet fromOnlyChangeLog( const ChangeLog & log );
91
 
 
92
 
            bool save( const QUrl & url ) const;
93
 
            bool save( QTextStream & out ) const;
94
 
 
95
 
            QList<Soprano::Statement> toList() const;
96
 
 
97
 
            void clear();
98
 
            void mergeWith(const IdentificationSet & rhs);
99
 
            
100
 
            IdentificationSet & operator=( const IdentificationSet & rhs );
101
 
            IdentificationSet& operator<<(const IdentificationSet & rhs);
102
 
 
103
 
            static void createIdentificationSet( const QSet< QUrl >& uniqueUris, const QUrl& outputUrl );
104
 
        private :
105
 
            class Private;
106
 
            QSharedDataPointer<Private> d;
107
 
        };
108
 
}
109
 
#endif // IDENTIFICATIONSET_H