]>
Dogcows Code - chaz/openbox/blob - src/configuration.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Configuration.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2002 - 2002 Ben Jansens (ben@orodu.net)
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
23 #ifndef __Configuration_hh
24 #define __Configuration_hh
27 #include <X11/Xresource.h>
31 * The Configuration class is a generic wrapper for configuration settings.
33 * This class is used for the global rc/config file, and for styles.
35 * This implementation of the Configuration class wraps an X resource database
40 explicit Configuration(const std::string
&file
, bool autosave
= True
);
41 Configuration(bool autosave
= True
);
42 virtual ~Configuration();
44 inline const std::string
&file() const {
45 return static_cast<const std::string
&>(_file
);
47 void setFile(const std::string
&file
);
50 inline bool autoSave() const {
53 void setAutoSave(bool);
55 inline bool isModified() const {
61 bool merge(const std::string
&file
, bool overwrite
= False
);
64 void setValue(const std::string
&rname
, bool value
);
65 inline void setValue(const std::string
&rname
, int value
) {
66 setValue(rname
, (long) value
);
68 inline void setValue(const std::string
&rname
, unsigned int value
) {
69 setValue(rname
, (unsigned long) value
);
71 void setValue(const std::string
&rname
, long value
);
72 void setValue(const std::string
&rname
, unsigned long value
);
73 void setValue(const std::string
&rname
, const std::string
&value
);
74 void setValue(const std::string
&rname
, const char *value
);
76 bool getValue(const std::string
&rname
, bool &value
) const;
77 inline bool getValue(const std::string
&rname
, int &value
) const {
78 return getValue(rname
, (long) value
);
80 inline bool getValue(const std::string
&rname
, unsigned int &value
) const {
81 return getValue(rname
, (unsigned long) value
);
83 bool getValue(const std::string
&rname
, long &value
) const;
84 bool getValue(const std::string
&rname
, unsigned long &value
) const;
85 bool getValue(const std::string
&rname
, std::string
&value
) const;
88 std::string
createClassName(const std::string
&rname
) const;
89 char toUpper(char) const;
91 static bool _initialized
;
95 XrmDatabase _database
;
98 #endif // __Configuration_hh
This page took 0.03635 seconds and 4 git commands to generate.