1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __Configuration_hh
3 #define __Configuration_hh
5 /*! @file configuration.hh
6 @brief Loads, saves, and provides configuration options for the window
12 #include <X11/Xresource.h>
20 * The Configuration class is a generic wrapper for configuration settings.
22 * This class is used for the global rc/config file, and for styles.
24 * This implementation of the Configuration class wraps an X resource database
29 explicit Configuration(const std::string &file, bool autosave = True);
30 Configuration(bool autosave = True);
31 virtual ~Configuration();
33 inline const std::string &file() const {
34 return static_cast<const std::string &>(_file);
36 void setFile(const std::string &file);
39 inline bool autoSave() const {
42 void setAutoSave(bool);
44 inline bool isModified() const {
50 bool merge(const std::string &file, bool overwrite = False);
53 void setValue(const std::string &rname, bool value);
54 inline void setValue(const std::string &rname, int value) {
55 setValue(rname, (long) value);
57 inline void setValue(const std::string &rname, unsigned int value) {
58 setValue(rname, (unsigned long) value);
60 void setValue(const std::string &rname, long value);
61 void setValue(const std::string &rname, unsigned long value);
62 void setValue(const std::string &rname, const std::string &value);
63 void setValue(const std::string &rname, const char *value);
65 bool getValue(const std::string &rname, bool &value) const;
66 inline bool getValue(const std::string &rname, int &value) const {
67 return getValue(rname, (long) value);
69 inline bool getValue(const std::string &rname, unsigned int &value) const {
70 return getValue(rname, (unsigned long) value);
72 bool getValue(const std::string &rname, long &value) const;
73 bool getValue(const std::string &rname, unsigned long &value) const;
74 bool getValue(const std::string &rname, std::string &value) const;
77 std::string createClassName(const std::string &rname) const;
78 char toUpper(char) const;
80 static bool _initialized;
84 XrmDatabase _database;
89 #endif // __Configuration_hh