~ubuntu-branches/ubuntu/natty/kdebase-runtime/natty-proposed

« back to all changes in this revision

Viewing changes to nepomuk/strigibackend/nepomukindexwriter.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-24 11:07:10 UTC
  • mto: (0.8.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: james.westby@ubuntu.com-20101124110710-6dbsyw0yh21qvn82
Tags: upstream-4.5.80
ImportĀ upstreamĀ versionĀ 4.5.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Copyright (C) 2007-2009 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 General Public License as
6
 
  published by the Free Software Foundation; either version 2 of
7
 
  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 General Public License
15
 
  along with this library; see the file COPYING.  If not, write to
16
 
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 
  Boston, MA 02110-1301, USA.
18
 
*/
19
 
 
20
 
#ifndef _STRIGI_NEPOMUK_INDEX_WRITER_H_
21
 
#define _STRIGI_NEPOMUK_INDEX_WRITER_H_
22
 
 
23
 
#include <strigi/indexwriter.h>
24
 
#include <strigi/analysisresult.h>
25
 
#include <strigi/analyzerconfiguration.h>
26
 
 
27
 
namespace Soprano {
28
 
    class Model;
29
 
}
30
 
 
31
 
class KUrl;
32
 
class QUrl;
33
 
 
34
 
namespace Strigi {
35
 
    class NepomukIndexWriter : public Strigi::IndexWriter
36
 
    {
37
 
    public:
38
 
        NepomukIndexWriter( Soprano::Model* );
39
 
        ~NepomukIndexWriter();
40
 
 
41
 
        void commit();
42
 
 
43
 
        /**
44
 
         * Delete the entries with the given paths from the index.
45
 
         *
46
 
         * @param entries the paths of the files that should be deleted
47
 
         **/
48
 
        void deleteEntries( const std::vector<std::string>& entries );
49
 
 
50
 
        /**
51
 
         * Delete all indexed documents from the index.
52
 
         **/
53
 
        void deleteAllEntries();
54
 
 
55
 
        void initWriterData( const Strigi::FieldRegister& );
56
 
        void releaseWriterData( const Strigi::FieldRegister& );
57
 
 
58
 
        void startAnalysis( const AnalysisResult* );
59
 
        void addText( const AnalysisResult*, const char* text, int32_t length );
60
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
61
 
                       const std::string& value );
62
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
63
 
                       const unsigned char* data, uint32_t size );
64
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
65
 
                       int32_t value );
66
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
67
 
                       uint32_t value );
68
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
69
 
                       double value );
70
 
        void addTriplet( const std::string& subject,
71
 
                         const std::string& predicate, const std::string& object );
72
 
        void addValue( const AnalysisResult*, const RegisteredField* field,
73
 
                       const std::string& name, const std::string& value );
74
 
        void finishAnalysis( const AnalysisResult* );
75
 
 
76
 
    private:
77
 
        /**
78
 
         * \param uri The resource URI. Can be empty if \p url is not.
79
 
         * \param url The file URL. Can be empty if \p uri is not.
80
 
         */
81
 
        void removeIndexedData( const KUrl& uri, const KUrl& url );
82
 
 
83
 
        QUrl determineFolderResourceUri( const KUrl& fileUrl );
84
 
 
85
 
        class Private;
86
 
        Private* d;
87
 
    };
88
 
}
89
 
 
90
 
uint qHash( const std::string& s );
91
 
 
92
 
#endif