|
a/src/internfile/mh_text.h |
|
b/src/internfile/mh_text.h |
|
... |
|
... |
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 |
#include <sys/types.h>
|
19 |
#include <sys/types.h>
|
20 |
|
20 |
|
21 |
#include <string>
|
21 |
#include <string>
|
22 |
using std::string;
|
|
|
23 |
|
22 |
|
24 |
#include "mimehandler.h"
|
23 |
#include "mimehandler.h"
|
25 |
|
24 |
|
26 |
/**
|
25 |
/**
|
27 |
* Handler for text/plain files.
|
26 |
* Handler for text/plain files.
|
28 |
*
|
27 |
*
|
29 |
* Maybe try to guess charset, or use default, then transcode to utf8
|
28 |
* Maybe try to guess charset, or use default, then transcode to utf8
|
30 |
*/
|
29 |
*/
|
31 |
class MimeHandlerText : public RecollFilter {
|
30 |
class MimeHandlerText : public RecollFilter {
|
32 |
public:
|
31 |
public:
|
33 |
MimeHandlerText(RclConfig *cnf, const string& id)
|
32 |
MimeHandlerText(RclConfig *cnf, const std::string& id)
|
34 |
: RecollFilter(cnf, id), m_paging(false), m_offs(0)
|
33 |
: RecollFilter(cnf, id), m_paging(false), m_offs(0), m_pagesz(0)
|
35 |
{
|
34 |
{
|
36 |
}
|
35 |
}
|
37 |
virtual ~MimeHandlerText()
|
36 |
virtual ~MimeHandlerText()
|
38 |
{
|
37 |
{
|
39 |
}
|
38 |
}
|
40 |
virtual bool set_document_file(const string& mt, const string &file_path);
|
39 |
virtual bool set_document_file(const std::string& mt, const std::string &file_path);
|
41 |
virtual bool set_document_string(const string&, const string&);
|
40 |
virtual bool set_document_string(const std::string&, const std::string&);
|
42 |
virtual bool is_data_input_ok(DataInput input) const {
|
41 |
virtual bool is_data_input_ok(DataInput input) const {
|
43 |
if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING)
|
42 |
if (input == DOCUMENT_FILE_NAME || input == DOCUMENT_STRING)
|
44 |
return true;
|
43 |
return true;
|
45 |
return false;
|
44 |
return false;
|
46 |
}
|
45 |
}
|
47 |
virtual bool next_document();
|
46 |
virtual bool next_document();
|
48 |
virtual bool skip_to_document(const string& s);
|
47 |
virtual bool skip_to_document(const std::string& s);
|
49 |
virtual void clear()
|
48 |
virtual void clear()
|
50 |
{
|
49 |
{
|
51 |
m_paging = false;
|
50 |
m_paging = false;
|
52 |
m_text.erase();
|
51 |
m_text.erase();
|
53 |
m_fn.erase();
|
52 |
m_fn.erase();
|
54 |
m_offs = 0;
|
53 |
m_offs = 0;
|
55 |
RecollFilter::clear();
|
54 |
RecollFilter::clear();
|
56 |
}
|
55 |
}
|
57 |
private:
|
56 |
private:
|
58 |
bool m_paging;
|
57 |
bool m_paging;
|
59 |
string m_text;
|
58 |
std::string m_text;
|
60 |
string m_fn;
|
59 |
std::string m_fn;
|
61 |
off_t m_offs; // Offset of next read in file if we're paging
|
60 |
off_t m_offs; // Offset of next read in file if we're paging
|
62 |
size_t m_pagesz;
|
61 |
size_t m_pagesz;
|
63 |
string m_charsetfromxattr;
|
62 |
std::string m_charsetfromxattr;
|
64 |
|
63 |
|
65 |
bool readnext();
|
64 |
bool readnext();
|
66 |
};
|
65 |
};
|
67 |
|
66 |
|
68 |
#endif /* _MH_TEXT_H_INCLUDED_ */
|
67 |
#endif /* _MH_TEXT_H_INCLUDED_ */
|