aboutsummaryrefslogtreecommitdiff
path: root/backend/Object.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 20:01:27 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 20:01:27 +0100
commit9283e1eb66d6ff96b02f317e28cb6ff060953cdf (patch)
treec03d853ef620216f1c2299936004f56c6c3cee04 /backend/Object.cpp
parent7285f9f2c2622acff734e31314f92df9b25cae16 (diff)
WIP load XML
Diffstat (limited to 'backend/Object.cpp')
-rw-r--r--backend/Object.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/backend/Object.cpp b/backend/Object.cpp
index 300e6ac..e14c780 100644
--- a/backend/Object.cpp
+++ b/backend/Object.cpp
@@ -1,15 +1,40 @@
+#include <string.h>
#include <stdlib.h>
#include "Object.h"
+#include "util.h"
+
+Object::Object(const char * name, const char * description) {
+ this->set_name(name);
+ this->set_description(description);
+}
+
Object::~Object() {
- if (this->name != nullptr) {
- free(const_cast<char *>(this->name));
- this->name = nullptr;
- }
- if (this->description != nullptr) {
- free(const_cast<char *>(this->description));
- this->description = nullptr;
- }
+ safe_free(this->name);
+ safe_free(this->description);
+}
+
+void Object::set_name(const char * name) {
+ safe_free(this->name);
+ this->name = strdup(name);
+}
+const char * Object::get_name() {
+ return this->name;
+}
+
+void Object::set_description(const char * description) {
+ safe_free(this->description);
+ this->description = strdup(description);
+}
+const char * Object::get_description() {
+ return this->description;
+}
+
+void Object::set_hidden(bool hidden) {
+ this->hidden = hidden;
+}
+bool Object::get_hidden() {
+ return this->hidden;
}