|
1 /** |
|
2 * Copyright 2002-2004 The Apache Software Foundation |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 * you may not use this file except in compliance with the License. |
|
6 * You may obtain a copy of the License at |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 #ifndef _lucene_search_highlight_encoder_ |
|
17 #define _lucene_search_highlight_encoder_ |
|
18 |
|
19 #if defined(_LUCENE_PRAGMA_ONCE) |
|
20 # pragma once |
|
21 #endif |
|
22 |
|
23 #include "CLucene/util/StringBuffer.h" |
|
24 |
|
25 CL_NS_DEF2(search,highlight) |
|
26 |
|
27 /** |
|
28 * Encodes original text. The Encoder works with the Formatter to generate the output. |
|
29 * |
|
30 */ |
|
31 class Encoder:LUCENE_BASE |
|
32 { |
|
33 public: |
|
34 /** Virtual destructor */ |
|
35 virtual ~Encoder(){ |
|
36 } |
|
37 |
|
38 /** |
|
39 * @param originalText The section of text being output |
|
40 */ |
|
41 virtual TCHAR* encodeText(TCHAR* originalText) = 0; |
|
42 }; |
|
43 |
|
44 /** |
|
45 * Simple {@link Encoder} implementation that does not modify the output |
|
46 * @author Nicko Cadell |
|
47 * |
|
48 */ |
|
49 class DefaultEncoder: public Encoder |
|
50 { |
|
51 public: |
|
52 TCHAR* encodeText(TCHAR* originalText) |
|
53 { |
|
54 return STRDUP_TtoT(originalText); |
|
55 } |
|
56 }; |
|
57 |
|
58 |
|
59 CL_NS_END2 |
|
60 |
|
61 #endif |