Switch to unified view

a/src/internfile/mimehandler.h b/src/internfile/mimehandler.h
1
#ifndef _MIMEHANDLER_H_INCLUDED_
1
#ifndef _MIMEHANDLER_H_INCLUDED_
2
#define _MIMEHANDLER_H_INCLUDED_
2
#define _MIMEHANDLER_H_INCLUDED_
3
/* @(#$Id: mimehandler.h,v 1.5 2005-02-04 09:39:44 dockes Exp $  (C) 2004 J.F.Dockes */
3
/* @(#$Id: mimehandler.h,v 1.6 2005-03-25 09:40:27 dockes Exp $  (C) 2004 J.F.Dockes */
4
4
5
#include <string>
5
#include <string>
6
#include <list>
6
#include <list>
7
7
8
#include "rclconfig.h"
8
#include "rclconfig.h"
9
#include "rcldb.h"
9
#include "rcldb.h"
10
10
11
11
12
/**
12
/**
13
 * Document interner class. We sometimes have data to pass to an interner
13
 * Document interner class. 
14
 */
14
 */
15
class MimeHandler {
15
class MimeHandler {
16
 public:
16
 public:
17
    virtual ~MimeHandler() {}
17
    virtual ~MimeHandler() {}
18
19
    /**
20
     * Transform external data into internal utf8 document
21
     *
22
     * @param conf the global configuration
23
     * @param filename File from which the data comes from
24
     * @param mimetype its mime type (from the mimemap configuration file)
25
     * @param outdoc   The output document
26
     * @param ipath the access path for the document inside the file. 
27
     *              For mono-document file types, this will always be empty. 
28
     *              It is used, for example for mbox files which may contain
29
     *              multiple emails. If this is not empty in input, then the
30
     *              caller is requesting a single document (ie: for display).
31
     *              If this is empty (during indexation), it will be filled-up
32
     *              by the function, and all the file's documents will be 
33
     *              returned by successive calls.
34
     * @return the return value indicates if there are more documents to be 
35
     *         fetched from the same file.
36
     */
37
    enum Status {MHError, MHDone, MHAgain};
18
    virtual bool worker(RclConfig *, const std::string &filename, 
38
    virtual Status worker(RclConfig * conf, const std::string &filename, 
19
            const std::string &mimetype, Rcl::Doc& outdoc) = 0;
39
              const std::string &mimetype, Rcl::Doc& outdoc,
40
            string& ipath) = 0;
20
};
41
};
21
42
22
/**
43
/**
23
 * Return indexing handler class for given mime type
44
 * Return indexing handler class for given mime type
24
 * returned pointer should be deleted by caller
45
 * returned pointer should be deleted by caller
...
...
28
/**
49
/**
29
 * Return external viewer exec string for given mime type
50
 * Return external viewer exec string for given mime type
30
 */
51
 */
31
extern std::string getMimeViewer(const std::string &mtyp, ConfTree *mhandlers);
52
extern std::string getMimeViewer(const std::string &mtyp, ConfTree *mhandlers);
32
53
54
/** 
55
 * Return command to uncompress the given type. The returned command has
56
 * substitutable places for input file name and temp dir name, and will
57
 * return output name
58
 */
33
bool getUncompressor(const std::string &mtype, ConfTree *mhandlers,
59
bool getUncompressor(const std::string &mtype, ConfTree *mhandlers,
34
             std::list<std::string>& cmd);
60
             std::list<std::string>& cmd);
35
61
36
#endif /* _MIMEHANDLER_H_INCLUDED_ */
62
#endif /* _MIMEHANDLER_H_INCLUDED_ */