aboutsummaryrefslogtreecommitdiff
path: root/backend/Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/Object.cpp')
-rw-r--r--backend/Object.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/backend/Object.cpp b/backend/Object.cpp
index ed8bc46..2640607 100644
--- a/backend/Object.cpp
+++ b/backend/Object.cpp
@@ -1,36 +1,22 @@
-#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() {
- safe_free(this->name);
- safe_free(this->description);
-}
+Object::Object(const String & name, const String & description) : name(name), description(description) { }
-void Object::set_name(const char * name) {
- safe_free(this->name);
- this->name = strdup(name);
+void Object::set_name(const String & name) {
+ this->name = name;
}
-const char * Object::get_name() {
+const String & Object::get_name() const {
return this->name;
}
-const char * Object::get_displayname() {
- return this->get_name();
+const String & Object::get_displayname() const {
+ static String displayname = this->name;
+ return displayname;
}
-void Object::set_description(const char * description) {
- safe_free(this->description);
- this->description = strdup(description);
+void Object::set_description(const String & description) {
+ this->description = description;
}
-const char * Object::get_description() {
+const String & Object::get_description() const {
return this->description;
}