Website Summary Files Commits Branches @commit @diff @stats
path: root / Week07 / Exercise01 / String.h
blob: c9cc263820bd48c3d07cec7927220ac95d5b3c07 (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
#ifndef _STRING
#define _STRING

class String {
	char* str;
	unsigned length;
	unsigned allocated;

	void free();
	void copyFrom(const String& other);

	void resize();

public:
	String();
	~String();
	String(const String& other);
	String& operator=(const String& other);
	String(String&& other);
	String& operator=(String&& other);

	String(const char* str);
	void Clear();

	void AppendChar(char c);

	bool EqualTo(const String& other) const;

	const char* GetStr() const;
	unsigned GetLength() const;
};

#endif /* _STRING */