|
a/src/query/plaintorich.h |
|
b/src/query/plaintorich.h |
|
... |
|
... |
41 |
};
|
41 |
};
|
42 |
|
42 |
|
43 |
/**
|
43 |
/**
|
44 |
* A class for highlighting search results. Overridable methods allow
|
44 |
* A class for highlighting search results. Overridable methods allow
|
45 |
* for different styles. We can handle plain text or html input. In the latter
|
45 |
* for different styles. We can handle plain text or html input. In the latter
|
46 |
* case, we may fail to highligt term groups if they are mixed with html tags.
|
46 |
* case, we may fail to highligt term groups if they are mixed with HTML
|
|
|
47 |
* tags (ex: firstterm <b>2ndterm</b>).
|
47 |
*/
|
48 |
*/
|
48 |
class PlainToRich {
|
49 |
class PlainToRich {
|
49 |
public:
|
50 |
public:
|
50 |
PlainToRich() : m_inputhtml(false) {}
|
51 |
PlainToRich()
|
|
|
52 |
: m_inputhtml(false)
|
|
|
53 |
{
|
|
|
54 |
}
|
|
|
55 |
|
51 |
virtual ~PlainToRich() {}
|
56 |
virtual ~PlainToRich()
|
|
|
57 |
{
|
|
|
58 |
}
|
|
|
59 |
|
52 |
void set_inputhtml(bool v) {m_inputhtml = v;}
|
60 |
void set_inputhtml(bool v)
|
|
|
61 |
{
|
|
|
62 |
m_inputhtml = v;
|
|
|
63 |
}
|
53 |
|
64 |
|
54 |
/**
|
65 |
/**
|
55 |
* Transform plain text for highlighting search terms, ie in the
|
66 |
* Transform plain text for highlighting search terms, ie in the
|
56 |
* preview window or result list entries.
|
67 |
* preview window or result list entries.
|
57 |
*
|
68 |
*
|
|
... |
|
... |
66 |
* on word order.
|
77 |
* on word order.
|
67 |
*
|
78 |
*
|
68 |
* @param in raw text out of internfile.
|
79 |
* @param in raw text out of internfile.
|
69 |
* @param out rich text output, divided in chunks (to help our caller
|
80 |
* @param out rich text output, divided in chunks (to help our caller
|
70 |
* avoid inserting half tags into textedit which doesnt like it)
|
81 |
* avoid inserting half tags into textedit which doesnt like it)
|
71 |
* @param hdata terms and groups to be highlighted. These are
|
82 |
* @param in hdata terms and groups to be highlighted. These are
|
72 |
* lowercase and unaccented.
|
83 |
* lowercase and unaccented.
|
73 |
* @param chunksize max size of chunks in output list
|
84 |
* @param chunksize max size of chunks in output list
|
74 |
*/
|
85 |
*/
|
75 |
virtual bool plaintorich(const string &in, list<string> &out,
|
86 |
virtual bool plaintorich(const string &in, list<string> &out,
|
76 |
const HiliteData& hdata,
|
87 |
const HiliteData& hdata,
|
77 |
int chunksize = 50000
|
88 |
int chunksize = 50000
|
78 |
);
|
89 |
);
|
79 |
|
90 |
|
80 |
/* Methods to ouput headers, highlighting and marking tags */
|
91 |
/* Overridable output methods for headers, highlighting and marking tags */
|
81 |
virtual string header() {return snull;}
|
92 |
virtual string header() {return snull;}
|
82 |
virtual string startMatch() {return snull;}
|
93 |
virtual string startMatch() {return snull;}
|
83 |
virtual string endMatch() {return snull;}
|
94 |
virtual string endMatch() {return snull;}
|
84 |
virtual string startAnchor(int) {return snull;}
|
95 |
virtual string startAnchor(int) {return snull;}
|
85 |
virtual string endAnchor() {return snull;}
|
96 |
virtual string endAnchor() {return snull;}
|