#include <assert.h>
+bool obResource::m_initialized = false;
+
obResource::obResource(const std::string &file) {
setFile(file);
m_modified = false;
m_database = NULL;
m_autosave = true;
+ if (!m_initialized) {
+ XrmInitialize();
+ m_initialized = true;
+ }
+}
+
+obResource::obResource() {
+ m_modified = false;
+ m_database = NULL;
+ m_autosave = true;
+ if (!m_initialized) {
+ XrmInitialize();
+ m_initialized = true;
+ }
}
obResource::~obResource() {
void obResource::setFile(const std::string &file) {
m_file = file;
- assert(m_file.c_str() != NULL);
}
void obResource::setAutoSave(bool autosave) {
save();
}
+void obResource::setValue(const std::string &rname, int value) {
+ setValue(rname, (long)value);
+}
+
void obResource::setValue(const std::string &rname, long value) {
assert(m_database != NULL);
bool obResource::getValue(const std::string &rname, const std::string &rclass,
bool &value) const {
- assert(rname.c_str() != NULL);
assert(rclass.c_str() != NULL);
assert(m_database != NULL);
&rettype, &retvalue) || retvalue.addr == NULL)
return false;
std::string val = retvalue.addr;
- if (val == "True")
+ if (0 == strncasecmp(val.c_str(), "true", val.length()))
value = true;
else
value = false;
bool obResource::getValue(const std::string &rname, const std::string &rclass,
long &value) const {
- assert(rname.c_str() != NULL);
- assert(rclass.c_str() != NULL);
assert(m_database != NULL);
char *rettype;
bool obResource::getValue(const std::string &rname, const std::string &rclass,
std::string &value) const {
- assert(rname.c_str() != NULL);
- assert(rclass.c_str() != NULL);
assert(m_database != NULL);
char *rettype;