summaryrefslogtreecommitdiff
path: root/src/user/lib/fwik/include/String.h
blob: 672220d9cf2ba9759f89c8a7225dd284096327af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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