]> Dogcows Code - chaz/openbox/blobdiff - src/Resource.cc
load_rc() now uses the obResource class to load its configuration
[chaz/openbox] / src / Resource.cc
index a6254bcb3ee334b9dbca2c469e7a65bbefd4175b..5ff05657c28a7822991e0556ea82106e97e1a63a 100644 (file)
@@ -42,6 +42,12 @@ obResource::obResource(const std::string &file) {
   m_autosave = true;
 }
 
+obResource::obResource() {
+  m_modified = false;
+  m_database = NULL;
+  m_autosave = true;
+}
+
 obResource::~obResource() {
   if (m_database != NULL)
     XrmDestroyDatabase(m_database);
@@ -49,7 +55,6 @@ obResource::~obResource() {
 
 void obResource::setFile(const std::string &file) {
   m_file = file;
-  assert(m_file.c_str() != NULL);
 }
 
 void obResource::setAutoSave(bool autosave) {
@@ -57,12 +62,14 @@ void obResource::setAutoSave(bool autosave) {
 }
 
 void obResource::save() {
+  assert(m_file.c_str() != NULL);
   assert(m_database != NULL);
   XrmPutFileDatabase(m_database, m_file.c_str());
   m_modified = false;
 }
 
 bool obResource::load() {
+  assert(m_file.c_str() != NULL);
   if (m_database != NULL)
     XrmDestroyDatabase(m_database);
   m_modified = false;
@@ -72,6 +79,7 @@ bool obResource::load() {
 }
 
 void obResource::setValue(const std::string &rname, bool value) {
+  assert(rname.c_str() != NULL);
   assert(m_database != NULL);
 
   const char *val = (value ? "True" : "False");
@@ -84,6 +92,7 @@ void obResource::setValue(const std::string &rname, bool value) {
 }
 
 void obResource::setValue(const std::string &rname, long value) {
+  assert(rname.c_str() != NULL);
   assert(m_database != NULL);
   
   char val[11];
@@ -97,6 +106,7 @@ void obResource::setValue(const std::string &rname, long value) {
 }
 
 void obResource::setValue(const std::string &rname, const char *value) {
+  assert(rname.c_str() != NULL);
   assert(m_database != NULL);
   
   std::string rc_string = rname + ": " + value;
@@ -108,6 +118,7 @@ void obResource::setValue(const std::string &rname, const char *value) {
 }
 
 void obResource::setValue(const std::string &rname, const std::string &value) {
+  assert(rname.c_str() != NULL);
   assert(m_database != NULL);
   
   std::string rc_string = rname + ": " + value;
This page took 0.025604 seconds and 4 git commands to generate.