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

« back to all changes in this revision

Viewing changes to nepomuk/services/strigi/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-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 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
class KUrl;
 
28
class QUrl;
 
29
 
 
30
namespace Nepomuk {
 
31
 
 
32
    class Resource;
 
33
    class IndexFeeder;
 
34
 
 
35
    class StrigiIndexWriter : public Strigi::IndexWriter
 
36
    {
 
37
    public:
 
38
        StrigiIndexWriter( IndexFeeder* );
 
39
        ~StrigiIndexWriter();
 
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 Strigi::AnalysisResult* );
 
59
        void addText( const Strigi::AnalysisResult*, const char* text, int32_t length );
 
60
        void addValue( const Strigi::AnalysisResult*, const Strigi::RegisteredField* field,
 
61
                       const std::string& value );
 
62
        void addValue( const Strigi::AnalysisResult*, const Strigi::RegisteredField* field,
 
63
                       const unsigned char* data, uint32_t size );
 
64
        void addValue( const Strigi::AnalysisResult*, const Strigi::RegisteredField* field,
 
65
                       int32_t value );
 
66
        void addValue( const Strigi::AnalysisResult*, const Strigi::RegisteredField* field,
 
67
                       uint32_t value );
 
68
        void addValue( const Strigi::AnalysisResult*, const Strigi::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 Strigi::AnalysisResult*, const Strigi::RegisteredField* field,
 
73
                       const std::string& name, const std::string& value );
 
74
        void finishAnalysis( const Strigi::AnalysisResult* );
 
75
 
 
76
    private:
 
77
        QUrl determineFolderResourceUri( const KUrl& fileUrl );
 
78
 
 
79
        class Private;
 
80
        Private* d;
 
81
    };
 
82
}
 
83
 
 
84
uint qHash( const std::string& s );
 
85
 
 
86
#endif