Switch to unified view

a/src/internfile/mimehandler.h b/src/internfile/mimehandler.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 _MIMEHANDLER_H_INCLUDED_
17
#ifndef _MIMEHANDLER_H_INCLUDED_
18
#define _MIMEHANDLER_H_INCLUDED_
18
#define _MIMEHANDLER_H_INCLUDED_
19
/* @(#$Id: mimehandler.h,v 1.16 2008-10-04 14:26:59 dockes Exp $  (C) 2004 J.F.Dockes */
19
/* @(#$Id: mimehandler.h,v 1.16 2008-10-04 14:26:59 dockes Exp $  (C) 2004 J.F.Dockes */
20
#include "autoconfig.h"
20
21
21
#include <string>
22
#include <string>
22
#include <list>
23
#include <list>
23
using std::string;
24
using std::string;
24
using std::list;
25
using std::list;
26
#ifdef RCL_USE_XATTR
27
#include <map>
28
using std::map;
29
#endif // RCL_USE_XATTR
25
30
26
#include <Filter.h>
31
#include <Filter.h>
27
32
28
class RclConfig;
33
class RclConfig;
29
34
...
...
49
    }
54
    }
50
55
51
    // We don't use this for now
56
    // We don't use this for now
52
    virtual bool set_document_uri(const std::string &) {return false;}
57
    virtual bool set_document_uri(const std::string &) {return false;}
53
58
59
    /// This does the extended attributes thing if enabled and should
60
    /// be called from subclasses.
61
    virtual bool set_document_file(const string &file_path);
62
54
    // Default implementations
63
    // Default implementations
55
    virtual bool set_document_string(const std::string &) {return false;}
64
    virtual bool set_document_string(const std::string &) {return false;}
56
    virtual bool set_document_data(const char *cp, unsigned int sz) {
65
    virtual bool set_document_data(const char *cp, unsigned int sz) {
57
    return set_document_string(string(cp, sz));
66
    return set_document_string(string(cp, sz));
58
    }
67
    }
...
...
75
    virtual string get_error() const {
84
    virtual string get_error() const {
76
    return m_reason;
85
    return m_reason;
77
    }
86
    }
78
87
79
    virtual void clear() {
88
    virtual void clear() {
89
  Dijon::Filter::clear();
80
    m_forPreview = m_havedoc = false;
90
    m_forPreview = m_havedoc = false;
81
  Dijon::Filter::clear();
91
  m_defcharset.clear();
92
  m_reason.clear();
93
#ifdef RCL_USE_XATTR
94
  m_fieldsFromAttrs.clear();
95
#endif // RCL_USE_XATTR
82
    }
96
    }
97
#ifdef RCL_USE_XATTR
98
    const map<string, string>& getFieldsFromAttrs() {return m_fieldsFromAttrs;}
99
#endif // RCL_USE_XATTR
83
100
84
protected:
101
protected:
85
    bool   m_forPreview;
102
    bool   m_forPreview;
86
    string m_defcharset;
103
    string m_defcharset;
87
    string m_reason;
104
    string m_reason;
88
    bool   m_havedoc;
105
    bool   m_havedoc;
106
#ifdef RCL_USE_XATTR
107
    map<string, string> m_fieldsFromAttrs;
108
#endif // RCL_USE_XATTR
89
};
109
};
90
110
91
/**
111
/**
92
 * Return indexing handler object for the given mime type
112
 * Return indexing handler object for the given mime type
93
 * returned pointer should be deleted by caller
113
 * returned pointer should be deleted by caller
...
...
95
 * @param cfg  the recoll config object to be used
115
 * @param cfg  the recoll config object to be used
96
 * @param filtertypes decide if we should restrict to types in 
116
 * @param filtertypes decide if we should restrict to types in 
97
 *     indexedmimetypes (if this is set at all).
117
 *     indexedmimetypes (if this is set at all).
98
 */
118
 */
99
extern Dijon::Filter *getMimeHandler(const std::string &mtyp, RclConfig *cfg,
119
extern Dijon::Filter *getMimeHandler(const std::string &mtyp, RclConfig *cfg,
120
                   bool filtertypes=false);
100
121
101
                   bool filtertypes=false);
102
/// Free up filter for reuse (you can also delete it)
122
/// Free up filter for reuse (you can also delete it)
103
extern void returnMimeHandler(Dijon::Filter *);
123
extern void returnMimeHandler(Dijon::Filter *);
104
124
105
/// Can this mime type be interned ?
125
/// Can this mime type be interned ?
106
extern bool canIntern(const std::string mimetype, RclConfig *cfg);
126
extern bool canIntern(const std::string mimetype, RclConfig *cfg);
127
107
#endif /* _MIMEHANDLER_H_INCLUDED_ */
128
#endif /* _MIMEHANDLER_H_INCLUDED_ */