summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-18 01:21:16 (GMT)
committerfluxgen <fluxgen>2002-01-18 01:21:16 (GMT)
commit2417b7dfd7ea02dc040fd814a6f979b93a48de4c (patch)
tree02fb070e8165ed3c51075a5f7bf6297e8d8888c7 /src
parent5d72cb458406fc42f7ee68d8f8dbdf99d6f9a192 (diff)
downloadfluxbox_lack-2417b7dfd7ea02dc040fd814a6f979b93a48de4c.zip
fluxbox_lack-2417b7dfd7ea02dc040fd814a6f979b93a48de4c.tar.bz2
added XrmDatabaseHelper.hh
Diffstat (limited to 'src')
-rw-r--r--src/XrmDatabaseHelper.hh56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/XrmDatabaseHelper.hh b/src/XrmDatabaseHelper.hh
new file mode 100644
index 0000000..2c903e7
--- /dev/null
+++ b/src/XrmDatabaseHelper.hh
@@ -0,0 +1,56 @@
1// XrmDatabaseHelper.hh
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// This is a helper for XrmDatabase
23// when database goes out of scope
24// the XrmDatabase variable will be destroyed.
25
26#ifndef _XRMDATABASEHELPER_HH_
27#define _XRMDATABASEHELPER_HH_
28
29#include <X11/Xresource.h>
30
31class XrmDatabaseHelper
32{
33public:
34 XrmDatabaseHelper(char const * filename=0)
35 : m_database(filename == 0 ? 0 : XrmGetFileDatabase(filename))
36 { }
37
38 ~XrmDatabaseHelper() {
39 if (m_database!=0)
40 XrmDestroyDatabase(m_database);
41 }
42
43 XrmDatabaseHelper& operator=(const XrmDatabase& database) {
44 if (m_database!=0)
45 XrmDestroyDatabase(m_database);
46 m_database = database;
47 return *this;
48 }
49 bool operator == (const XrmDatabase& database) { return m_database == database; }
50 XrmDatabase & operator*(void) { return m_database; }
51
52private:
53 XrmDatabase m_database;
54};
55
56#endif //_XRMDATABASEHELPER_HH_