|
a/src/internfile/internfile.h |
|
b/src/internfile/internfile.h |
1 |
#ifndef _INTERNFILE_H_INCLUDED_
|
1 |
#ifndef _INTERNFILE_H_INCLUDED_
|
2 |
#define _INTERNFILE_H_INCLUDED_
|
2 |
#define _INTERNFILE_H_INCLUDED_
|
3 |
/* @(#$Id: internfile.h,v 1.4 2005-11-14 09:59:17 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: internfile.h,v 1.5 2005-11-18 15:19:14 dockes Exp $ (C) 2004 J.F.Dockes */
|
4 |
|
4 |
|
5 |
#include <string>
|
5 |
#include <string>
|
6 |
|
6 |
|
7 |
#include "rclconfig.h"
|
7 |
#include "rclconfig.h"
|
8 |
#include "rcldb.h"
|
8 |
#include "rcldb.h"
|
|
... |
|
... |
10 |
class MimeHandler;
|
10 |
class MimeHandler;
|
11 |
|
11 |
|
12 |
/// Turn external file into internal representation, according to mime
|
12 |
/// Turn external file into internal representation, according to mime
|
13 |
/// type etc
|
13 |
/// type etc
|
14 |
class FileInterner {
|
14 |
class FileInterner {
|
15 |
string fn;
|
|
|
16 |
RclConfig *config;
|
|
|
17 |
const string &tdir;
|
|
|
18 |
MimeHandler *handler;
|
|
|
19 |
string tfile;
|
|
|
20 |
string mime;
|
|
|
21 |
|
|
|
22 |
void tmpcleanup();
|
|
|
23 |
|
|
|
24 |
public:
|
15 |
public:
|
25 |
/**
|
16 |
/**
|
26 |
* Identify and possibly decompress file, create adequate handler
|
17 |
* Identify and possibly decompress file, create adequate
|
|
|
18 |
* handler. The mtype parameter is only set when the object is
|
|
|
19 |
* created for previewing a file. Filter output may be
|
|
|
20 |
* different for previewing and indexing.
|
|
|
21 |
*
|
27 |
* @param fn file name
|
22 |
* @param fn file name
|
28 |
* @param cnf Recoll configuration
|
23 |
* @param cnf Recoll configuration
|
29 |
* @param td temporary directory to use as working space for possible
|
24 |
* @param td temporary directory to use as working space if
|
30 |
* decompression
|
25 |
* decompression needed.
|
31 |
* @param mimetype mime type if known. For a compressed file this is the
|
26 |
* @param mtype mime type if known. For a compressed file this is the
|
32 |
* mime type for the uncompressed version.
|
27 |
* mime type for the uncompressed version. This currently doubles up
|
|
|
28 |
* to indicate that this object is for previewing (not indexing).
|
33 |
*/
|
29 |
*/
|
34 |
FileInterner(const std::string &fn, RclConfig *cnf, const string& td,
|
30 |
FileInterner(const std::string &fn, RclConfig *cnf, const string& td,
|
35 |
const std::string *mtype = 0);
|
31 |
const std::string *mtype = 0);
|
36 |
|
32 |
|
37 |
~FileInterner();
|
33 |
~FileInterner();
|
|
... |
|
... |
51 |
* @return FIError and FIDone are self-explanatory. If FIAgain is returned,
|
47 |
* @return FIError and FIDone are self-explanatory. If FIAgain is returned,
|
52 |
* this is a multi-document file, with more subdocs, and internfile()
|
48 |
* this is a multi-document file, with more subdocs, and internfile()
|
53 |
* should be called again to get the following one(s).
|
49 |
* should be called again to get the following one(s).
|
54 |
*/
|
50 |
*/
|
55 |
Status internfile(Rcl::Doc& doc, string &ipath);
|
51 |
Status internfile(Rcl::Doc& doc, string &ipath);
|
|
|
52 |
|
|
|
53 |
private:
|
|
|
54 |
string m_fn;
|
|
|
55 |
RclConfig *m_cfg;
|
|
|
56 |
const string &m_tdir;
|
|
|
57 |
MimeHandler *m_handler;
|
|
|
58 |
|
|
|
59 |
string m_tfile;
|
|
|
60 |
string m_mime;
|
|
|
61 |
|
|
|
62 |
void tmpcleanup();
|
56 |
};
|
63 |
};
|
57 |
|
64 |
|
58 |
#endif /* _INTERNFILE_H_INCLUDED_ */
|
65 |
#endif /* _INTERNFILE_H_INCLUDED_ */
|