• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

dummyanalyzers.cpp

Go to the documentation of this file.
00001 /* This file is part of Strigi Desktop Search
00002  *
00003  * Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 //#include <strigi/strigiconfig.h>
00021 #include <strigi/analyzerplugin.h>
00022 #include <strigi/streamendanalyzer.h>
00023 #include <strigi/streamsaxanalyzer.h>
00024 #include <strigi/streamthroughanalyzer.h>
00025 #include <strigi/streamlineanalyzer.h>
00026 #include <strigi/streameventanalyzer.h>
00027 
00028 using namespace Strigi;
00029 using namespace std;
00030 
00031 class DummyEndAnalyzerFactory;
00032 class DummyThroughAnalyzerFactory;
00033 class DummySaxAnalyzerFactory;
00034 class DummyLineAnalyzerFactory;
00035 class DummyEventAnalyzerFactory;
00036 
00037 class STRIGI_PLUGIN_API DummyEndAnalyzer : public StreamEndAnalyzer {
00038 public:
00039     DummyEndAnalyzer() {}
00040     bool checkHeader(const char*, int32_t) const {
00041         return false;
00042     }
00043     char analyze(Strigi::AnalysisResult&, InputStream*) {
00044         return -1;
00045     }
00046     const char* name() const { return "DummyEndAnalyzer"; }
00047 };
00048 class STRIGI_PLUGIN_API DummyEndAnalyzerFactory : public StreamEndAnalyzerFactory {
00049     const char* name() const {
00050         return "DummyEndAnalyzerFactory";
00051     }
00052     void registerFields(Strigi::FieldRegister&)  {}
00053     StreamEndAnalyzer* newInstance() const {
00054         return new DummyEndAnalyzer();
00055     }
00056 };
00057 class STRIGI_PLUGIN_API DummyThroughAnalyzer : public StreamThroughAnalyzer {
00058 public:
00059     DummyThroughAnalyzer() {}
00060     const char* name() const {
00061     return "DummyThroughAnalyzer";
00062     }
00063     void setIndexable(Strigi::AnalysisResult*) {}
00064     InputStream* connectInputStream(InputStream *in) {
00065         return in;
00066     }
00067     bool isReadyWithStream() { return true; }
00068 };
00069 class STRIGI_PLUGIN_API DummyThroughAnalyzerFactory : public StreamThroughAnalyzerFactory {
00070     const char* name() const {
00071         return "DummyThroughAnalyzerFactory";
00072     }
00073     void registerFields(Strigi::FieldRegister&)  {}
00074     StreamThroughAnalyzer* newInstance() const {
00075         return new DummyThroughAnalyzer();
00076     }
00077 };
00078 class STRIGI_PLUGIN_API DummySaxAnalyzer : public StreamSaxAnalyzer {
00079 public:
00080     DummySaxAnalyzer() {}
00081     const char* name() const { return "DummySaxAnalyzer"; }
00082     void startAnalysis(AnalysisResult*) {}
00083     void endAnalysis(bool /*complete*/) {}
00084     bool isReadyWithStream() { return true; }
00085 };
00086 class STRIGI_PLUGIN_API DummySaxAnalyzerFactory : public StreamSaxAnalyzerFactory {
00087     const char* name() const {
00088         return "DummySaxAnalyzerFactory";
00089     }
00090     void registerFields(Strigi::FieldRegister&)  {}
00091     StreamSaxAnalyzer* newInstance() const {
00092         return new DummySaxAnalyzer();
00093     }
00094 };
00095 class STRIGI_PLUGIN_API DummyLineAnalyzer : public StreamLineAnalyzer {
00096 public:
00097     DummyLineAnalyzer() {}
00098     const char* name() const { return "DummyLineAnalyzer"; }
00099     void startAnalysis(AnalysisResult*) {}
00100     void endAnalysis(bool /*complete*/) {}
00101     void handleLine(const char*, uint32_t) {}
00102     bool isReadyWithStream() { return true; }
00103 };
00104 class STRIGI_PLUGIN_API DummyLineAnalyzerFactory : public StreamLineAnalyzerFactory {
00105     const char* name() const {
00106         return "DummyLineAnalyzerFactory";
00107     }
00108     void registerFields(Strigi::FieldRegister&)  {}
00109     StreamLineAnalyzer* newInstance() const {
00110         return new DummyLineAnalyzer();
00111     }
00112 };
00113 class STRIGI_PLUGIN_API DummyEventAnalyzer : public StreamEventAnalyzer {
00114 public:
00115     DummyEventAnalyzer() {}
00116     const char* name() const { return "DummyEventAnalyzer"; }
00117     void startAnalysis(AnalysisResult*) {}
00118     void endAnalysis(bool /*complete*/) {}
00119     void handleData(const char*, uint32_t) {}
00120     bool isReadyWithStream() { return true; }
00121 };
00122 class STRIGI_PLUGIN_API DummyEventAnalyzerFactory : public StreamEventAnalyzerFactory {
00123     const char* name() const {
00124         return "DummyEventAnalyzerFactory";
00125     }
00126     void registerFields(Strigi::FieldRegister&)  {}
00127     StreamEventAnalyzer* newInstance() const {
00128         return new DummyEventAnalyzer();
00129     }
00130 };
00131 
00132 class Factory : public AnalyzerFactoryFactory {
00133 public:
00134     list<StreamEndAnalyzerFactory*>
00135     streamEndAnalyzerFactories() const {
00136         list<StreamEndAnalyzerFactory*> af;
00137         af.push_back(new DummyEndAnalyzerFactory());
00138         return af;
00139     }
00140     list<StreamThroughAnalyzerFactory*>
00141     streamThroughAnalyzerFactories() const {
00142         list<StreamThroughAnalyzerFactory*> af;
00143         af.push_back(new DummyThroughAnalyzerFactory());
00144         return af;
00145     }
00146     list<StreamSaxAnalyzerFactory*>
00147     streamSaxAnalyzerFactories() const {
00148         list<StreamSaxAnalyzerFactory*> af;
00149         af.push_back(new DummySaxAnalyzerFactory());
00150         return af;
00151     }
00152     list<StreamLineAnalyzerFactory*>
00153     streamLineAnalyzerFactories() const {
00154         list<StreamLineAnalyzerFactory*> af;
00155         af.push_back(new DummyLineAnalyzerFactory());
00156         return af;
00157     }
00158     list<StreamEventAnalyzerFactory*>
00159     streamEventAnalyzerFactories() const {
00160         list<StreamEventAnalyzerFactory*> af;
00161         af.push_back(new DummyEventAnalyzerFactory());
00162         return af;
00163     }
00164 };
00165 
00166 /*
00167  Register the AnalyzerFactoryFactory
00168 */
00169 STRIGI_ANALYZER_FACTORY(Factory)

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal