Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TeeSinkTokenFilter.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef TEESINKTOKENFILTER_H
8 #define TEESINKTOKENFILTER_H
9 
10 #include "TokenFilter.h"
11 #include "TokenStream.h"
12 
13 namespace Lucene {
14 
62 class LPPAPI TeeSinkTokenFilter : public TokenFilter {
63 public:
65  TeeSinkTokenFilter(const TokenStreamPtr& input);
66  virtual ~TeeSinkTokenFilter();
67 
69 
70 protected:
72 
73 public:
75  SinkTokenStreamPtr newSinkTokenStream();
76 
80  SinkTokenStreamPtr newSinkTokenStream(const SinkFilterPtr& filter);
81 
84  void addSinkTokenStream(const SinkTokenStreamPtr& sink);
85 
89  void consumeAllTokens();
90 
91  virtual bool incrementToken();
92  virtual void end();
93 };
94 
95 class LPPAPI SinkFilter : public LuceneObject {
96 public:
97  virtual ~SinkFilter();
98 
100 
101 public:
103  virtual bool accept(const AttributeSourcePtr& source) = 0;
104 
106  virtual void reset();
107 };
108 
109 class LPPAPI AcceptAllSinkFilter : public SinkFilter {
110 public:
111  virtual ~AcceptAllSinkFilter();
112 
114 
115 public:
116  virtual bool accept(const AttributeSourcePtr& source);
117 };
118 
120 class LPPAPI SinkTokenStream : public TokenStream {
121 public:
122  SinkTokenStream(const AttributeSourcePtr& source, const SinkFilterPtr& filter);
123  virtual ~SinkTokenStream();
124 
126 
127 protected:
133 
134 protected:
135  bool accept(const AttributeSourcePtr& source);
136  void addState(const AttributeSourceStatePtr& state);
137  void setFinalState(const AttributeSourceStatePtr& finalState);
138 
139 public:
140  virtual bool incrementToken();
141  virtual void end();
142  virtual void reset();
143 
144  friend class TeeSinkTokenFilter;
145 };
146 
147 }
148 
149 #endif

clucene.sourceforge.net