Switch to unified view

a/src/internfile/internfile.h b/src/internfile/internfile.h
...
...
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
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 _INTERNFILE_H_INCLUDED_
17
#ifndef _INTERNFILE_H_INCLUDED_
18
#define _INTERNFILE_H_INCLUDED_
18
#define _INTERNFILE_H_INCLUDED_
19
// The class changes according to RCL_USE_XATTR
20
#include "autoconfig.h"
19
21
20
#include <string>
22
#include <string>
21
#include <vector>
23
#include <vector>
22
#include <map>
24
#include <map>
23
#include <set>
25
#include <set>
...
...
25
using std::vector;
27
using std::vector;
26
using std::map;
28
using std::map;
27
using std::set;
29
using std::set;
28
30
29
#include "Filter.h"
31
#include "Filter.h"
30
// The class changes according to RCL_USE_XATTR
31
#include "autoconfig.h"
32
#include "uncomp.h"
32
#include "pathut.h"
33
#include "pathut.h"
33
34
34
class RclConfig;
35
class RclConfig;
35
namespace Rcl {
36
namespace Rcl {
36
    class Doc;
37
    class Doc;
...
...
112
     *   decompression needed. Must be private and will be wiped clean.
113
     *   decompression needed. Must be private and will be wiped clean.
113
     * @param mtype mime type if known. For a compressed file this is the 
114
     * @param mtype mime type if known. For a compressed file this is the 
114
     *   mime type for the uncompressed version.
115
     *   mime type for the uncompressed version.
115
     */
116
     */
116
    FileInterner(const string &fn, const struct stat *stp, 
117
    FileInterner(const string &fn, const struct stat *stp, 
117
       RclConfig *cnf, TempDir &td, int flags,
118
       RclConfig *cnf, int flags, const string *mtype = 0);
118
       const string *mtype = 0);
119
    
119
    
120
    /** 
120
    /** 
121
     * Alternate constructor for the case where the data is in memory.
121
     * Alternate constructor for the case where the data is in memory.
122
     * This is mainly for data extracted from the web cache. The mime type
122
     * This is mainly for data extracted from the web cache. The mime type
123
     * must be set, input must be already uncompressed.
123
     * must be set, input must be already uncompressed.
124
     */
124
     */
125
    FileInterner(const string &data, RclConfig *cnf, TempDir &td, 
125
    FileInterner(const string &data, RclConfig *cnf, 
126
                 int flags, const string& mtype);
126
                 int flags, const string& mtype);
127
127
128
    /**
128
    /**
129
     * Alternate constructor used at query time. We don't know where
129
     * Alternate constructor used at query time. We don't know where
130
     * the data was stored, this is determined from the Rcl::Doc data
130
     * the data was stored, this is determined from the Rcl::Doc data
...
...
133
     *   storage identifier (rclbes field) is used to build the
133
     *   storage identifier (rclbes field) is used to build the
134
     *   appropriate fetcher which uses the rest of the Doc fields (url,
134
     *   appropriate fetcher which uses the rest of the Doc fields (url,
135
     *   ipath...) to retrieve the file or a file reference, which we
135
     *   ipath...) to retrieve the file or a file reference, which we
136
     *   then process normally.
136
     *   then process normally.
137
     */
137
     */
138
    FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, TempDir &td, 
138
    FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, int flags);
139
                 int flags);
140
139
141
    ~FileInterner();
140
    ~FileInterner();
142
141
143
    void setMissingStore(FIMissingStore *st)
142
    void setMissingStore(FIMissingStore *st)
144
    {
143
    {
...
...
249
    bool                   m_forPreview;
248
    bool                   m_forPreview;
250
    string                 m_html; // Possibly set-aside html text for preview
249
    string                 m_html; // Possibly set-aside html text for preview
251
    TempFile               m_imgtmp; // Possible reference to an image temp file
250
    TempFile               m_imgtmp; // Possible reference to an image temp file
252
    string                 m_targetMType;
251
    string                 m_targetMType;
253
    string                 m_reachedMType; // target or text/plain
252
    string                 m_reachedMType; // target or text/plain
254
    // m_tdir and m_tfile are used only for decompressing input file if needed
255
    TempDir                &m_tdir; 
256
    string                 m_tfile;
253
    string                 m_tfile;
257
    bool                   m_ok; // Set after construction if ok
254
    bool                   m_ok; // Set after construction if ok
258
#ifdef RCL_USE_XATTR
255
#ifdef RCL_USE_XATTR
259
    // Fields found in file extended attributes. This is kept here,
256
    // Fields found in file extended attributes. This is kept here,
260
    // not in the file-level handler because we are only interested in
257
    // not in the file-level handler because we are only interested in
...
...
271
    vector<TempFile>       m_tempfiles;
268
    vector<TempFile>       m_tempfiles;
272
    // Error data if any
269
    // Error data if any
273
    string                 m_reason;
270
    string                 m_reason;
274
    FIMissingStore        *m_missingdatap;
271
    FIMissingStore        *m_missingdatap;
275
272
273
    Uncomp                 m_uncomp;
274
276
    // Pseudo-constructors
275
    // Pseudo-constructors
277
    void init(const string &fn, const struct stat *stp, 
276
    void init(const string &fn, const struct stat *stp, 
278
              RclConfig *cnf, int flags, const string *mtype = 0);
277
              RclConfig *cnf, int flags, const string *mtype = 0);
279
    void init(const string &data, RclConfig *cnf, int flags, 
278
    void init(const string &data, RclConfig *cnf, int flags, 
280
          const string& mtype);
279
          const string& mtype);
281
    void initcommon(RclConfig *cnf, int flags);
280
    void initcommon(RclConfig *cnf, int flags);
282
281
283
    void tmpcleanup();
284
    bool dijontorcl(Rcl::Doc&);
282
    bool dijontorcl(Rcl::Doc&);
285
    void collectIpathAndMT(Rcl::Doc&) const;
283
    void collectIpathAndMT(Rcl::Doc&) const;
286
    TempFile dataToTempFile(const string& data, const string& mt);
284
    TempFile dataToTempFile(const string& data, const string& mt);
287
    void popHandler();
285
    void popHandler();
288
    int addHandler();
286
    int addHandler();