aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-12-02 22:12:09 (GMT)
committerfluxgen <fluxgen>2002-12-02 22:12:09 (GMT)
commit145ca1ab89889371e44b66d3d9d014176b0518ad (patch)
tree8fef946507c069d98fb547055974640df741ddba /src
parent3f8b92ae1dcb22fde3efa3a64dd41ff8b9331c80 (diff)
downloadfluxbox-145ca1ab89889371e44b66d3d9d014176b0518ad.zip
fluxbox-145ca1ab89889371e44b66d3d9d014176b0518ad.tar.bz2
new functions....minor hack
Diffstat (limited to 'src')
-rw-r--r--src/XrmDatabaseHelper.hh25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/XrmDatabaseHelper.hh b/src/XrmDatabaseHelper.hh
index 22cad2c..0cd3f52 100644
--- a/src/XrmDatabaseHelper.hh
+++ b/src/XrmDatabaseHelper.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: XrmDatabaseHelper.hh,v 1.6 2002/12/01 13:42:06 rathnor Exp $ 22// $Id: XrmDatabaseHelper.hh,v 1.7 2002/12/02 22:12:09 fluxgen Exp $
23 23
24// This is a helper for XrmDatabase 24// This is a helper for XrmDatabase
25// when database goes out of scope 25// when database goes out of scope
@@ -38,12 +38,11 @@ class XrmDatabaseHelper
38{ 38{
39public: 39public:
40 XrmDatabaseHelper(char const * filename=0) 40 XrmDatabaseHelper(char const * filename=0)
41 : m_database(filename == 0 ? 0 : XrmGetFileDatabase(filename)) 41 : m_database(0)
42 { } 42 { if (filename != 0) load(filename); }
43 43
44 ~XrmDatabaseHelper() { 44 ~XrmDatabaseHelper() {
45 if (m_database!=0) 45 close();
46 XrmDestroyDatabase(m_database);
47 } 46 }
48 47
49 /// assignment operator 48 /// assignment operator
@@ -53,6 +52,22 @@ public:
53 m_database = database; 52 m_database = database;
54 return *this; 53 return *this;
55 } 54 }
55 bool load(const char *filename) {
56 if (filename == 0)
57 return false;
58 XrmDatabase db = XrmGetFileDatabase(filename);
59 if (db == 0)
60 return false;
61 close(); // close old database
62 m_database = db; // set new and return true
63 return true;
64 }
65 void close() {
66 if (m_database != 0) {
67 XrmDestroyDatabase(m_database);
68 m_database = 0;
69 }
70 }
56 bool operator == (const XrmDatabase& database) { return m_database == database; } 71 bool operator == (const XrmDatabase& database) { return m_database == database; }
57 XrmDatabase & operator*(void) { return m_database; } 72 XrmDatabase & operator*(void) { return m_database; }
58 73