renamed the obResource class to Resource.

This commit is contained in:
Dana Jansens 2002-04-16 22:08:37 +00:00
parent 82e61c015f
commit 43e9d583c5
5 changed files with 24 additions and 24 deletions

View file

@ -34,9 +34,9 @@
# include <stdio.h> # include <stdio.h>
#endif // HAVE_STDIO_H #endif // HAVE_STDIO_H
bool obResource::m_initialized = false; bool Resource::m_initialized = false;
obResource::obResource(const std::string &file) { Resource::Resource(const std::string &file) {
setFile(file); setFile(file);
m_modified = false; m_modified = false;
m_database = NULL; m_database = NULL;
@ -47,7 +47,7 @@ obResource::obResource(const std::string &file) {
} }
} }
obResource::obResource() { Resource::Resource() {
m_modified = false; m_modified = false;
m_database = NULL; m_database = NULL;
m_autosave = true; m_autosave = true;
@ -57,26 +57,26 @@ obResource::obResource() {
} }
} }
obResource::~obResource() { Resource::~Resource() {
if (m_database != NULL) if (m_database != NULL)
XrmDestroyDatabase(m_database); XrmDestroyDatabase(m_database);
} }
void obResource::setFile(const std::string &file) { void Resource::setFile(const std::string &file) {
m_file = file; m_file = file;
} }
void obResource::setAutoSave(bool autosave) { void Resource::setAutoSave(bool autosave) {
m_autosave = autosave; m_autosave = autosave;
} }
void obResource::save() { void Resource::save() {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
XrmPutFileDatabase(m_database, m_file.c_str()); XrmPutFileDatabase(m_database, m_file.c_str());
m_modified = false; m_modified = false;
} }
bool obResource::load() { bool Resource::load() {
if (m_database != NULL) if (m_database != NULL)
XrmDestroyDatabase(m_database); XrmDestroyDatabase(m_database);
m_modified = false; m_modified = false;
@ -85,7 +85,7 @@ bool obResource::load() {
return true; return true;
} }
void obResource::setValue(const std::string &rname, bool value) { void Resource::setValue(const std::string &rname, bool value) {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
const char *val = (value ? "True" : "False"); const char *val = (value ? "True" : "False");
@ -97,11 +97,11 @@ void obResource::setValue(const std::string &rname, bool value) {
save(); save();
} }
void obResource::setValue(const std::string &rname, int value) { void Resource::setValue(const std::string &rname, int value) {
setValue(rname, (long)value); setValue(rname, (long)value);
} }
void obResource::setValue(const std::string &rname, long value) { void Resource::setValue(const std::string &rname, long value) {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
char val[11]; char val[11];
@ -114,7 +114,7 @@ void obResource::setValue(const std::string &rname, long value) {
save(); save();
} }
void obResource::setValue(const std::string &rname, const char *value) { void Resource::setValue(const std::string &rname, const char *value) {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
std::string rc_string = rname + ": " + value; std::string rc_string = rname + ": " + value;
@ -125,7 +125,7 @@ void obResource::setValue(const std::string &rname, const char *value) {
save(); save();
} }
void obResource::setValue(const std::string &rname, const std::string &value) { void Resource::setValue(const std::string &rname, const std::string &value) {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
std::string rc_string = rname + ": " + value; std::string rc_string = rname + ": " + value;
@ -136,7 +136,7 @@ void obResource::setValue(const std::string &rname, const std::string &value) {
save(); save();
} }
bool obResource::getValue(const std::string &rname, const std::string &rclass, bool Resource::getValue(const std::string &rname, const std::string &rclass,
bool &value) const { bool &value) const {
ASSERT(rclass.c_str() != NULL); ASSERT(rclass.c_str() != NULL);
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
@ -154,7 +154,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass,
return true; return true;
} }
bool obResource::getValue(const std::string &rname, const std::string &rclass, bool Resource::getValue(const std::string &rname, const std::string &rclass,
long &value) const { long &value) const {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);
@ -170,7 +170,7 @@ bool obResource::getValue(const std::string &rname, const std::string &rclass,
return true; return true;
} }
bool obResource::getValue(const std::string &rname, const std::string &rclass, bool Resource::getValue(const std::string &rname, const std::string &rclass,
std::string &value) const { std::string &value) const {
ASSERT(m_database != NULL); ASSERT(m_database != NULL);

View file

@ -27,11 +27,11 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
class obResource { class Resource {
public: public:
obResource(const std::string &file); Resource(const std::string &file);
obResource(); Resource();
virtual ~obResource(); virtual ~Resource();
inline const std::string &file() const { inline const std::string &file() const {
return static_cast<const std::string &>(m_file); return static_cast<const std::string &>(m_file);

View file

@ -996,7 +996,7 @@ void BScreen::removeWorkspaceNames(void) {
void BScreen::LoadStyle(void) { void BScreen::LoadStyle(void) {
obResource &conf = resource.styleconfig; Resource &conf = resource.styleconfig;
conf.setFile(openbox.getStyleFilename()); conf.setFile(openbox.getStyleFilename());
if (!conf.load()) { if (!conf.load()) {

View file

@ -135,7 +135,7 @@ private:
auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max, auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max,
focus_new, focus_last, toolbar_total_hide; focus_new, focus_last, toolbar_total_hide;
BColor border_color; BColor border_color;
obResource styleconfig; Resource styleconfig;
int workspaces, toolbar_placement, toolbar_width_percent, placement_policy, int workspaces, toolbar_placement, toolbar_width_percent, placement_policy,
edge_snap_threshold, row_direction, col_direction; edge_snap_threshold, row_direction, col_direction;

View file

@ -115,7 +115,7 @@ private:
Window masked; Window masked;
char *rc_file, **argv; char *rc_file, **argv;
int argc; int argc;
obResource config; Resource config;
protected: protected:
@ -145,7 +145,7 @@ public:
BScreen *getScreen(int); BScreen *getScreen(int);
BScreen *searchScreen(Window); BScreen *searchScreen(Window);
inline obResource &getConfig() { inline Resource &getConfig() {
return config; return config;
} }
inline const Time &getDoubleClickInterval(void) const inline const Time &getDoubleClickInterval(void) const