aboutsummaryrefslogtreecommitdiff
path: root/backend/String.h
diff options
context:
space:
mode:
Diffstat (limited to 'backend/String.h')
-rw-r--r--backend/String.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/backend/String.h b/backend/String.h
new file mode 100644
index 0000000..b4025be
--- /dev/null
+++ b/backend/String.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <stddef.h>
+
+class String {
+public:
+ String();
+ String(const char * c_str);
+ String(const String &);
+ ~String();
+public:
+ static String fmt(const char * fmt, ...);
+
+public:
+ const char * c_str() const;
+ char * data() const;
+ size_t size() const;
+ bool empty() const;
+
+private:
+ void set(const char * data);
+ void set(const char * data, size_t data_len);
+private:
+ char * _data = nullptr;
+ size_t _data_len = 0;
+
+};
+