summaryrefslogtreecommitdiff
path: root/src/user/lib/fwik/include/String.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/fwik/include/String.h')
-rw-r--r--src/user/lib/fwik/include/String.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/user/lib/fwik/include/String.h b/src/user/lib/fwik/include/String.h
index 2a44046..672220d 100644
--- a/src/user/lib/fwik/include/String.h
+++ b/src/user/lib/fwik/include/String.h
@@ -1,5 +1,40 @@
#ifndef DEF_FWIK_STRING_H
#define DEF_FWIK_STRING_H
+#include <cpp.h>
+
+class String {
+ private:
+ char *ptr; // zero-terminated for internal purposes.
+ int len;
+
+ public:
+ String();
+ String(const String& other);
+ String(char* ptr);
+ String(char* ptr, int len);
+ String(char c, int count);
+ ~String();
+ void operator=(const String &string);
+ void operator=(char* ptr);
+
+ char* c_str();
+
+ bool operator==(const String& other);
+ bool operator==(char* other);
+ bool operator<(const String& other);
+ char &operator[](int pos);
+
+ int size() { return len; }
+ operator bool() { return len != 0; }
+ String substr(int start, int count);
+
+ String operator+(const String& other);
+ void operator+=(const String& other);
+ void operator+=(char c);
+
+ static String dec(int i);
+ static String hex(uint32_t v);
+};
#endif