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

KIO

  • kio
  • kio
  • dummyanalyzers
dummyanalyzers.cpp
Go to the documentation of this file.
1 /* This file is part of Strigi Desktop Search
2  *
3  * Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 //#include <strigi/strigiconfig.h>
21 #include <strigi/analyzerplugin.h>
22 #include <strigi/streamendanalyzer.h>
23 #include <strigi/streamsaxanalyzer.h>
24 #include <strigi/streamthroughanalyzer.h>
25 #include <strigi/streamlineanalyzer.h>
26 #include <strigi/streameventanalyzer.h>
27 #include <config-strigi.h>
28 
29 using namespace Strigi;
30 using namespace std;
31 
32 class DummyEndAnalyzerFactory;
33 class DummyThroughAnalyzerFactory;
34 class DummySaxAnalyzerFactory;
35 class DummyLineAnalyzerFactory;
36 class DummyEventAnalyzerFactory;
37 
38 class STRIGI_PLUGIN_API DummyEndAnalyzer : public StreamEndAnalyzer {
39 public:
40  DummyEndAnalyzer() {}
41  bool checkHeader(const char*, int32_t) const {
42  return false;
43  }
44  STRIGI_ENDANALYZER_RETVAL analyze(Strigi::AnalysisResult&, InputStream*) {
45  return -1;
46  }
47  const char* name() const { return "DummyEndAnalyzer"; }
48 };
49 class STRIGI_PLUGIN_API DummyEndAnalyzerFactory : public StreamEndAnalyzerFactory {
50  const char* name() const {
51  return "DummyEndAnalyzerFactory";
52  }
53  void registerFields(Strigi::FieldRegister&) {}
54  StreamEndAnalyzer* newInstance() const {
55  return new DummyEndAnalyzer();
56  }
57 };
58 class STRIGI_PLUGIN_API DummyThroughAnalyzer : public StreamThroughAnalyzer {
59 public:
60  DummyThroughAnalyzer() {}
61  const char* name() const {
62  return "DummyThroughAnalyzer";
63  }
64  void setIndexable(Strigi::AnalysisResult*) {}
65  InputStream* connectInputStream(InputStream *in) {
66  return in;
67  }
68  bool isReadyWithStream() { return true; }
69 };
70 class STRIGI_PLUGIN_API DummyThroughAnalyzerFactory : public StreamThroughAnalyzerFactory {
71  const char* name() const {
72  return "DummyThroughAnalyzerFactory";
73  }
74  void registerFields(Strigi::FieldRegister&) {}
75  StreamThroughAnalyzer* newInstance() const {
76  return new DummyThroughAnalyzer();
77  }
78 };
79 class STRIGI_PLUGIN_API DummySaxAnalyzer : public StreamSaxAnalyzer {
80 public:
81  DummySaxAnalyzer() {}
82  const char* name() const { return "DummySaxAnalyzer"; }
83  void startAnalysis(AnalysisResult*) {}
84  void endAnalysis(bool /*complete*/) {}
85  bool isReadyWithStream() { return true; }
86 };
87 class STRIGI_PLUGIN_API DummySaxAnalyzerFactory : public StreamSaxAnalyzerFactory {
88  const char* name() const {
89  return "DummySaxAnalyzerFactory";
90  }
91  void registerFields(Strigi::FieldRegister&) {}
92  StreamSaxAnalyzer* newInstance() const {
93  return new DummySaxAnalyzer();
94  }
95 };
96 class STRIGI_PLUGIN_API DummyLineAnalyzer : public StreamLineAnalyzer {
97 public:
98  DummyLineAnalyzer() {}
99  const char* name() const { return "DummyLineAnalyzer"; }
100  void startAnalysis(AnalysisResult*) {}
101  void endAnalysis(bool /*complete*/) {}
102  void handleLine(const char*, uint32_t) {}
103  bool isReadyWithStream() { return true; }
104 };
105 class STRIGI_PLUGIN_API DummyLineAnalyzerFactory : public StreamLineAnalyzerFactory {
106  const char* name() const {
107  return "DummyLineAnalyzerFactory";
108  }
109  void registerFields(Strigi::FieldRegister&) {}
110  StreamLineAnalyzer* newInstance() const {
111  return new DummyLineAnalyzer();
112  }
113 };
114 class STRIGI_PLUGIN_API DummyEventAnalyzer : public StreamEventAnalyzer {
115 public:
116  DummyEventAnalyzer() {}
117  const char* name() const { return "DummyEventAnalyzer"; }
118  void startAnalysis(AnalysisResult*) {}
119  void endAnalysis(bool /*complete*/) {}
120  void handleData(const char*, uint32_t) {}
121  bool isReadyWithStream() { return true; }
122 };
123 class STRIGI_PLUGIN_API DummyEventAnalyzerFactory : public StreamEventAnalyzerFactory {
124  const char* name() const {
125  return "DummyEventAnalyzerFactory";
126  }
127  void registerFields(Strigi::FieldRegister&) {}
128  StreamEventAnalyzer* newInstance() const {
129  return new DummyEventAnalyzer();
130  }
131 };
132 
133 class Factory : public AnalyzerFactoryFactory {
134 public:
135  list<StreamEndAnalyzerFactory*>
136  streamEndAnalyzerFactories() const {
137  list<StreamEndAnalyzerFactory*> af;
138  af.push_back(new DummyEndAnalyzerFactory());
139  return af;
140  }
141  list<StreamThroughAnalyzerFactory*>
142  streamThroughAnalyzerFactories() const {
143  list<StreamThroughAnalyzerFactory*> af;
144  af.push_back(new DummyThroughAnalyzerFactory());
145  return af;
146  }
147  list<StreamSaxAnalyzerFactory*>
148  streamSaxAnalyzerFactories() const {
149  list<StreamSaxAnalyzerFactory*> af;
150  af.push_back(new DummySaxAnalyzerFactory());
151  return af;
152  }
153  list<StreamLineAnalyzerFactory*>
154  streamLineAnalyzerFactories() const {
155  list<StreamLineAnalyzerFactory*> af;
156  af.push_back(new DummyLineAnalyzerFactory());
157  return af;
158  }
159  list<StreamEventAnalyzerFactory*>
160  streamEventAnalyzerFactories() const {
161  list<StreamEventAnalyzerFactory*> af;
162  af.push_back(new DummyEventAnalyzerFactory());
163  return af;
164  }
165 };
166 
167 /*
168  Register the AnalyzerFactoryFactory
169 */
170 STRIGI_ANALYZER_FACTORY(Factory)
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Fri Nov 16 2012 15:09:54 by doxygen 1.8.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.8.5 API Reference

Skip menu "kdelibs-4.8.5 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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