|
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.3 2005-03-25 09:40:27 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: internfile.h,v 1.4 2005-11-14 09:59:17 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"
|
9 |
|
9 |
|
10 |
class MimeHandler;
|
10 |
class MimeHandler;
|
11 |
|
11 |
|
12 |
/// Turn external file into internal representation, according to mime type etc
|
12 |
/// Turn external file into internal representation, according to mime
|
|
|
13 |
/// type etc
|
13 |
class FileInterner {
|
14 |
class FileInterner {
|
14 |
string fn;
|
15 |
string fn;
|
15 |
RclConfig *config;
|
16 |
RclConfig *config;
|
16 |
const string &tdir;
|
17 |
const string &tdir;
|
17 |
MimeHandler *handler;
|
18 |
MimeHandler *handler;
|
|
... |
|
... |
19 |
string mime;
|
20 |
string mime;
|
20 |
|
21 |
|
21 |
void tmpcleanup();
|
22 |
void tmpcleanup();
|
22 |
|
23 |
|
23 |
public:
|
24 |
public:
|
|
|
25 |
/**
|
|
|
26 |
* Identify and possibly decompress file, create adequate handler
|
|
|
27 |
* @param fn file name
|
|
|
28 |
* @param cnf Recoll configuration
|
|
|
29 |
* @param td temporary directory to use as working space for possible
|
|
|
30 |
* decompression
|
|
|
31 |
* @param mimetype mime type if known. For a compressed file this is the
|
|
|
32 |
* mime type for the uncompressed version.
|
|
|
33 |
*/
|
24 |
FileInterner(const std::string &f, RclConfig *cnf, const string& td);
|
34 |
FileInterner(const std::string &fn, RclConfig *cnf, const string& td,
|
|
|
35 |
const std::string *mtype = 0);
|
|
|
36 |
|
25 |
~FileInterner();
|
37 |
~FileInterner();
|
26 |
|
38 |
|
|
|
39 |
/// Return values for internfile()
|
27 |
enum Status {FIError, FIDone, FIAgain};
|
40 |
enum Status {FIError, FIDone, FIAgain};
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* Turn file or file part into Recoll document.
|
|
|
44 |
*
|
|
|
45 |
* For multidocument files (ie: mail folder), this must be called multiple
|
|
|
46 |
* times to retrieve the subdocuments
|
|
|
47 |
* @param doc output document
|
|
|
48 |
* @param ipath internal path. If set by caller, the specified subdoc will
|
|
|
49 |
* be returned. Else the next document according to current state will
|
|
|
50 |
* be returned, and the internal path will be set.
|
|
|
51 |
* @return FIError and FIDone are self-explanatory. If FIAgain is returned,
|
|
|
52 |
* this is a multi-document file, with more subdocs, and internfile()
|
|
|
53 |
* should be called again to get the following one(s).
|
|
|
54 |
*/
|
28 |
Status internfile(Rcl::Doc& doc, string &ipath);
|
55 |
Status internfile(Rcl::Doc& doc, string &ipath);
|
29 |
};
|
56 |
};
|
30 |
|
57 |
|
31 |
#endif /* _INTERNFILE_H_INCLUDED_ */
|
58 |
#endif /* _INTERNFILE_H_INCLUDED_ */
|