1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __Configuration_hh
3 #define __Configuration_hh
6 #include <X11/Xresource.h>
12 * The Configuration class is a generic wrapper for configuration settings.
14 * This class is used for the global rc/config file, and for styles.
16 * This implementation of the Configuration class wraps an X resource database
21 explicit Configuration(const std::string &file, bool autosave = True);
22 Configuration(bool autosave = True);
23 virtual ~Configuration();
25 inline const std::string &file() const {
26 return static_cast<const std::string &>(_file);
28 void setFile(const std::string &file);
31 inline bool autoSave() const {
34 void setAutoSave(bool);
36 inline bool isModified() const {
42 bool merge(const std::string &file, bool overwrite = False);
45 void setValue(const std::string &rname, bool value);
46 inline void setValue(const std::string &rname, int value) {
47 setValue(rname, (long) value);
49 inline void setValue(const std::string &rname, unsigned int value) {
50 setValue(rname, (unsigned long) value);
52 void setValue(const std::string &rname, long value);
53 void setValue(const std::string &rname, unsigned long value);
54 void setValue(const std::string &rname, const std::string &value);
55 void setValue(const std::string &rname, const char *value);
57 bool getValue(const std::string &rname, bool &value) const;
58 inline bool getValue(const std::string &rname, int &value) const {
59 return getValue(rname, (long) value);
61 inline bool getValue(const std::string &rname, unsigned int &value) const {
62 return getValue(rname, (unsigned long) value);
64 bool getValue(const std::string &rname, long &value) const;
65 bool getValue(const std::string &rname, unsigned long &value) const;
66 bool getValue(const std::string &rname, std::string &value) const;
69 std::string createClassName(const std::string &rname) const;
70 char toUpper(char) const;
72 static bool _initialized;
76 XrmDatabase _database;
81 #endif // __Configuration_hh