|
a/src/common/rclconfig.h |
|
b/src/common/rclconfig.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 _RCLCONFIG_H_INCLUDED_
|
17 |
#ifndef _RCLCONFIG_H_INCLUDED_
|
18 |
#define _RCLCONFIG_H_INCLUDED_
|
18 |
#define _RCLCONFIG_H_INCLUDED_
|
19 |
/* @(#$Id: rclconfig.h,v 1.22 2006-10-11 14:16:25 dockes Exp $ (C) 2004 J.F.Dockes */
|
19 |
/* @(#$Id: rclconfig.h,v 1.23 2006-10-16 15:33:08 dockes Exp $ (C) 2004 J.F.Dockes */
|
20 |
|
20 |
|
21 |
#include <list>
|
21 |
#include <list>
|
|
|
22 |
#include <string>
|
|
|
23 |
#ifndef NO_NAMESPACES
|
|
|
24 |
using std::list;
|
|
|
25 |
using std::string;
|
|
|
26 |
#endif
|
22 |
|
27 |
|
23 |
#include "conftree.h"
|
28 |
#include "conftree.h"
|
24 |
#include "smallut.h"
|
29 |
#include "smallut.h"
|
25 |
|
30 |
|
26 |
class RclConfig {
|
31 |
class RclConfig {
|
|
... |
|
... |
59 |
* filenames are handled differently */
|
64 |
* filenames are handled differently */
|
60 |
const string &getDefCharset(bool filename = false);
|
65 |
const string &getDefCharset(bool filename = false);
|
61 |
/** Get guessCharset for current keydir (was set during setKeydir) */
|
66 |
/** Get guessCharset for current keydir (was set during setKeydir) */
|
62 |
bool getGuessCharset() {return guesscharset;}
|
67 |
bool getGuessCharset() {return guesscharset;}
|
63 |
|
68 |
|
|
|
69 |
/** Get list of top directories. This is needed from a number of places
|
|
|
70 |
* and needs some cleaning-up code. An empty list is always an error, no
|
|
|
71 |
* need for other status */
|
|
|
72 |
list<string> getTopdirs();
|
|
|
73 |
|
64 |
/** Get database directory */
|
74 |
/** Get database directory */
|
65 |
string getDbDir();
|
75 |
string getDbDir();
|
66 |
|
76 |
|
67 |
/**
|
77 |
/**
|
68 |
* Get list of ignored suffixes from mimemap
|
78 |
* Get list of ignored suffixes from mimemap
|
69 |
*
|
79 |
*
|
70 |
* The list is initialized on first call, and not changed for subsequent
|
80 |
* The list is initialized on first call, and not changed for subsequent
|
71 |
* setKeydirs.
|
81 |
* setKeydirs.
|
72 |
*/
|
82 |
*/
|
73 |
bool getStopSuffixes(std::list<std::string>& sufflist);
|
83 |
bool getStopSuffixes(list<string>& sufflist);
|
74 |
|
84 |
|
75 |
/**
|
85 |
/**
|
76 |
* Check in mimeconf if input mime type is a compressed one, and
|
86 |
* Check in mimeconf if input mime type is a compressed one, and
|
77 |
* return command to uncompress if it is.
|
87 |
* return command to uncompress if it is.
|
78 |
*
|
88 |
*
|
79 |
* The returned command has substitutable places for input file name
|
89 |
* The returned command has substitutable places for input file name
|
80 |
* and temp dir name, and will return output name
|
90 |
* and temp dir name, and will return output name
|
81 |
*/
|
91 |
*/
|
82 |
bool getUncompressor(const std::string &mtpe, std::list<std::string>& cmd);
|
92 |
bool getUncompressor(const string &mtpe, list<string>& cmd);
|
83 |
|
93 |
|
84 |
/** Use mimemap to compute mimetype */
|
94 |
/** Use mimemap to compute mimetype */
|
85 |
std::string getMimeTypeFromSuffix(const std::string &suffix);
|
95 |
string getMimeTypeFromSuffix(const string &suffix);
|
86 |
|
96 |
|
87 |
/** Get input filter from mimeconf for mimetype */
|
97 |
/** Get input filter from mimeconf for mimetype */
|
88 |
std::string getMimeHandlerDef(const std::string &mimetype);
|
98 |
string getMimeHandlerDef(const string &mimetype);
|
89 |
|
99 |
|
90 |
/** Get external viewer exec string from mimeconf for mimetype */
|
100 |
/** Get external viewer exec string from mimeconf for mimetype */
|
91 |
std::string getMimeViewerDef(const std::string &mimetype);
|
101 |
string getMimeViewerDef(const string &mimetype);
|
92 |
|
102 |
|
93 |
/** Get icon name from mimeconf for mimetype */
|
103 |
/** Get icon name from mimeconf for mimetype */
|
94 |
string getMimeIconName(const string &mtype, string *path = 0);
|
104 |
string getMimeIconName(const string &mtype, string *path = 0);
|
95 |
|
105 |
|
96 |
/** Get a list of all indexable mime types defined in mimemap */
|
106 |
/** Get a list of all indexable mime types defined in mimemap */
|
97 |
std::list<string> getAllMimeTypes();
|
107 |
list<string> getAllMimeTypes();
|
98 |
|
108 |
|
99 |
/** Find exec file for external filter. cmd is the command name from the
|
109 |
/** Find exec file for external filter. cmd is the command name from the
|
100 |
* command string returned by getMimeHandlerDef */
|
110 |
* command string returned by getMimeHandlerDef */
|
101 |
std::string findFilter(const std::string& cmd);
|
111 |
string findFilter(const string& cmd);
|
102 |
|
112 |
|
103 |
~RclConfig() {
|
113 |
~RclConfig() {
|
104 |
freeAll();
|
114 |
freeAll();
|
105 |
}
|
115 |
}
|
106 |
|
116 |
|
|
... |
|
... |
112 |
freeAll();
|
122 |
freeAll();
|
113 |
initFrom(r);
|
123 |
initFrom(r);
|
114 |
}
|
124 |
}
|
115 |
return *this;
|
125 |
return *this;
|
116 |
}
|
126 |
}
|
117 |
std::list<string> getConfNames(const string &sk) {
|
127 |
list<string> getConfNames(const string &sk) {
|
118 |
return m_conf->getNames(sk);
|
128 |
return m_conf->getNames(sk);
|
119 |
}
|
129 |
}
|
120 |
|
130 |
|
121 |
private:
|
131 |
private:
|
122 |
int m_ok;
|
132 |
int m_ok;
|
|
... |
|
... |
127 |
|
137 |
|
128 |
ConfStack<ConfTree> *m_conf; // Parsed configuration files
|
138 |
ConfStack<ConfTree> *m_conf; // Parsed configuration files
|
129 |
ConfStack<ConfTree> *mimemap; // The files don't change with keydir, but their
|
139 |
ConfStack<ConfTree> *mimemap; // The files don't change with keydir, but their
|
130 |
ConfStack<ConfTree> *mimeconf; // content may depend on it.
|
140 |
ConfStack<ConfTree> *mimeconf; // content may depend on it.
|
131 |
|
141 |
|
132 |
std::list<std::string> *stopsuffixes;
|
142 |
list<string> *stopsuffixes;
|
133 |
|
143 |
|
134 |
// Parameters auto-fetched on setkeydir
|
144 |
// Parameters auto-fetched on setkeydir
|
135 |
string defcharset; // These are stored locally to avoid
|
145 |
string defcharset; // These are stored locally to avoid
|
136 |
bool guesscharset; // They are fetched initially or on setKeydir()
|
146 |
bool guesscharset; // They are fetched initially or on setKeydir()
|
137 |
|
147 |
|