summaryrefslogtreecommitdiff
path: root/src/utils/smart_string.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-14 10:11:32 +0100
committerHampusM <hampus@hampusmat.com>2022-02-14 10:11:32 +0100
commit7892ef9d248c189be68ce7faf63230ec0a318b67 (patch)
tree7c3d07779d5ce96994f81c0cc22e8b667601ee9d /src/utils/smart_string.cpp
parenta03dfe959fcafd238119bdf7f27c07b92064496e (diff)
refactor: reorganize & add debugging
Diffstat (limited to 'src/utils/smart_string.cpp')
-rw-r--r--src/utils/smart_string.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/utils/smart_string.cpp b/src/utils/smart_string.cpp
new file mode 100644
index 0000000..5258ffe
--- /dev/null
+++ b/src/utils/smart_string.cpp
@@ -0,0 +1,26 @@
+#include "smart_string.hpp"
+
+#include "memory.hpp"
+
+#include <stdlib.h>
+
+SmartString::SmartString(char *c_string)
+{
+ this->c_str = c_string;
+}
+
+SmartString::SmartString(unsigned int size)
+{
+ this->c_str = malloc_s<char>(size + 1);
+}
+
+SmartString::~SmartString()
+{
+ if (this->c_str != nullptr)
+ free(this->c_str);
+}
+
+SmartString::operator char *() const
+{
+ return this->c_str;
+}