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