summaryrefslogtreecommitdiff
path: root/src/common/string.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-21 13:00:36 +0100
committerHampusM <hampus@hampusmat.com>2022-03-21 13:00:36 +0100
commit757a29d0137b974fff6ddcc945d76e69ae120ecb (patch)
tree1fff46951e30eeae0402e99070e60901bd104eea /src/common/string.cpp
parent12e3713e7705e4353d306ae2ec03abfe8fcd5f55 (diff)
refactor: use MPU6050_light & clean up bloatHEADmaster
Diffstat (limited to 'src/common/string.cpp')
-rw-r--r--src/common/string.cpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/common/string.cpp b/src/common/string.cpp
deleted file mode 100644
index 27b65d4..0000000
--- a/src/common/string.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "string.hpp"
-
-#include "common/memory.hpp"
-
-#include <stdlib.h>
-
-namespace common
-{
-
-String::String(char *c_string) : c_str(c_string)
-{
-}
-
-String::String(unsigned int size) : c_str(malloc_s<char>(size + 1))
-{
-}
-
-String::String(const String &smart_str)
- : c_str(malloc_s<char>(strlen(smart_str.c_str) + 1))
-{
- memcpy(c_str, smart_str.c_str, strlen(smart_str.c_str) + 1);
-}
-
-String::String(String &&smart_str) noexcept : c_str(smart_str.c_str)
-{
- smart_str.c_str = nullptr;
-}
-
-String &String::operator=(const String &smart_str)
-{
- if (&smart_str != this)
- {
- free(c_str);
- c_str = nullptr;
-
- auto str_size = strlen(smart_str.c_str) + 1;
-
- c_str = malloc_s<char>(str_size);
- memcpy(c_str, smart_str.c_str, str_size);
- }
-
- return *this;
-}
-
-String &String::operator=(String &&smart_str) noexcept
-{
- if (&smart_str != this)
- {
- free(c_str);
- c_str = smart_str.c_str;
- smart_str.c_str = nullptr;
- }
-
- return *this;
-}
-
-String::~String()
-{
- if (c_str != nullptr)
- {
- free(c_str);
- }
-}
-
-String::operator char *() const
-{
- return c_str;
-}
-
-} // namespace common