|
a/src/internfile/mh_text.h |
|
b/src/internfile/mh_text.h |
|
... |
|
... |
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#ifndef _MH_TEXT_H_INCLUDED_
|
17 |
#ifndef _MH_TEXT_H_INCLUDED_
|
18 |
#define _MH_TEXT_H_INCLUDED_
|
18 |
#define _MH_TEXT_H_INCLUDED_
|
19 |
/* @(#$Id: mh_text.h,v 1.5 2008-10-04 14:26:59 dockes Exp $ (C) 2004 J.F.Dockes */
|
19 |
/* @(#$Id: mh_text.h,v 1.5 2008-10-04 14:26:59 dockes Exp $ (C) 2004 J.F.Dockes */
|
|
|
20 |
#include <sys/types.h>
|
20 |
|
21 |
|
21 |
#include <string>
|
22 |
#include <string>
|
22 |
using std::string;
|
23 |
using std::string;
|
23 |
|
24 |
|
24 |
#include "mimehandler.h"
|
25 |
#include "mimehandler.h"
|
|
... |
|
... |
28 |
*
|
29 |
*
|
29 |
* Maybe try to guess charset, or use default, then transcode to utf8
|
30 |
* Maybe try to guess charset, or use default, then transcode to utf8
|
30 |
*/
|
31 |
*/
|
31 |
class MimeHandlerText : public RecollFilter {
|
32 |
class MimeHandlerText : public RecollFilter {
|
32 |
public:
|
33 |
public:
|
33 |
MimeHandlerText(const string& mt) : RecollFilter(mt) {}
|
34 |
MimeHandlerText(const string& mt)
|
|
|
35 |
: RecollFilter(mt), m_paging(false), m_offs(0) {}
|
34 |
virtual ~MimeHandlerText() {}
|
36 |
virtual ~MimeHandlerText() {}
|
35 |
virtual bool set_document_file(const string &file_path);
|
37 |
virtual bool set_document_file(const string &file_path);
|
36 |
virtual bool set_document_string(const string&);
|
38 |
virtual bool set_document_string(const string&);
|
37 |
virtual bool is_data_input_ok(DataInput input) const {
|
39 |
virtual bool is_data_input_ok(DataInput input) const {
|
38 |
if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING)
|
40 |
if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING)
|
39 |
return true;
|
41 |
return true;
|
40 |
return false;
|
42 |
return false;
|
41 |
}
|
43 |
}
|
42 |
virtual bool next_document();
|
44 |
virtual bool next_document();
|
|
|
45 |
virtual bool skip_to_document(const string& s);
|
43 |
virtual void clear()
|
46 |
virtual void clear()
|
44 |
{
|
47 |
{
|
|
|
48 |
m_paging = false;
|
45 |
m_text.erase();
|
49 |
m_text.erase();
|
|
|
50 |
m_fn.erase();
|
|
|
51 |
m_offs = 0;
|
46 |
RecollFilter::clear();
|
52 |
RecollFilter::clear();
|
47 |
}
|
53 |
}
|
48 |
private:
|
54 |
private:
|
|
|
55 |
bool m_paging;
|
49 |
string m_text;
|
56 |
string m_text;
|
|
|
57 |
string m_fn;
|
|
|
58 |
off_t m_offs; // Offset of next read in file if we're paging
|
|
|
59 |
size_t m_pagesz;
|
|
|
60 |
|
|
|
61 |
bool readnext();
|
50 |
};
|
62 |
};
|
51 |
|
63 |
|
52 |
#endif /* _MH_TEXT_H_INCLUDED_ */
|
64 |
#endif /* _MH_TEXT_H_INCLUDED_ */
|