Parent: [4e3735] (diff)

Child: [851384] (diff)

Download this file

rclconfig.h    96 lines (79 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
/* @(#$Id: rclconfig.h,v 1.12 2006-01-19 17:11:46 dockes Exp $ (C) 2004 J.F.Dockes */
#include <list>
#include "conftree.h"
#include "smallut.h"
class RclConfig {
public:
RclConfig();
~RclConfig() {
delete m_conf;
delete mimemap;
delete mimeconf;
delete mimemap_local;
delete stopsuffixes;
}
bool ok() {return m_ok;}
const string &getReason() {return reason;}
string getConfDir() {return m_confdir;}
//ConfTree *getConfig() {return m_ok ? conf : 0;}
/// Get generic configuration parameter according to current keydir
bool getConfParam(const string &name, string &value)
{
if (m_conf == 0)
return false;
return m_conf->get(name, value, keydir);
}
/*
* Variants with autoconversion
*/
bool getConfParam(const std::string &name, int *value);
bool getConfParam(const std::string &name, bool *value);
/// Set current directory reference, and fetch automatic parameters.
void setKeyDir(const string &dir)
{
keydir = dir;
m_conf->get("defaultcharset", defcharset, keydir);
string str;
m_conf->get("guesscharset", str, keydir);
guesscharset = stringToBool(str);
}
/**
* Check if input mime type is a compressed one, and return command to
* uncompress if it is
* The returned command has substitutable places for input file name
* and temp dir name, and will return output name
*/
bool getUncompressor(const std::string &mtpe, std::list<std::string>& cmd);
bool getStopSuffixes(std::list<std::string>& sufflist);
std::string getMimeTypeFromSuffix(const std::string &suffix);
std::string getMimeHandlerDef(const std::string &mtype);
/**
* Return external viewer exec string for given mime type
*/
std::string getMimeViewerDef(const std::string &mtype);
/**
* Return icon name for mime type
*/
string getMimeIconName(const string &mtype);
const string &getDefCharset() {return defcharset;}
bool getGuessCharset() {return guesscharset;}
std::list<string> getAllMimeTypes();
std::string findFilter(const std::string& cmd);
private:
int m_ok;
string reason; // Explanation for bad state
string m_confdir; // Directory where the files are stored
string m_datadir; // Example: /usr/local/share/recoll
ConfTree *m_conf; // Parsed main configuration
string keydir; // Current directory used for parameter fetches.
ConfTree *mimemap; // These are independant of current keydir.
ConfTree *mimeconf;
ConfTree *mimemap_local; //
std::list<std::string> *stopsuffixes;
// Parameters auto-fetched on setkeydir
string defcharset; // These are stored locally to avoid
bool guesscharset; // They are fetched initially or on setKeydir()
};
#endif /* _RCLCONFIG_H_INCLUDED_ */