1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __Configuration_hh
3 #define __Configuration_hh
6 #include <X11/Xresource.h>
10 * The Configuration class is a generic wrapper for configuration settings.
12 * This class is used for the global rc/config file, and for styles.
14 * This implementation of the Configuration class wraps an X resource database
19 explicit Configuration(const std::string &file, bool autosave = True);
20 Configuration(bool autosave = True);
21 virtual ~Configuration();
23 inline const std::string &file() const {
24 return static_cast<const std::string &>(_file);
26 void setFile(const std::string &file);
29 inline bool autoSave() const {
32 void setAutoSave(bool);
34 inline bool isModified() const {
40 bool merge(const std::string &file, bool overwrite = False);
43 void setValue(const std::string &rname, bool value);
44 inline void setValue(const std::string &rname, int value) {
45 setValue(rname, (long) value);
47 inline void setValue(const std::string &rname, unsigned int value) {
48 setValue(rname, (unsigned long) value);
50 void setValue(const std::string &rname, long value);
51 void setValue(const std::string &rname, unsigned long value);
52 void setValue(const std::string &rname, const std::string &value);
53 void setValue(const std::string &rname, const char *value);
55 bool getValue(const std::string &rname, bool &value) const;
56 inline bool getValue(const std::string &rname, int &value) const {
57 return getValue(rname, (long) value);
59 inline bool getValue(const std::string &rname, unsigned int &value) const {
60 return getValue(rname, (unsigned long) value);
62 bool getValue(const std::string &rname, long &value) const;
63 bool getValue(const std::string &rname, unsigned long &value) const;
64 bool getValue(const std::string &rname, std::string &value) const;
67 std::string createClassName(const std::string &rname) const;
68 char toUpper(char) const;
70 static bool _initialized;
74 XrmDatabase _database;
77 #endif // __Configuration_hh