Website Summary Files Commits Branches @commit @diff @stats
path: root / Utils / Kindle / string.h
blob: 48742b17213f30ae2fbc6260599a095910ff4350 (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
41
42
#pragma once

#include <fstream>
#include <iostream>
class string
{
	char* str;
	size_t size;

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

public:
	string();
	string(const char*);

	string(const string&);

	string(string&&); //move constructor that accepts rvalue;

	string& operator=(const string& other);
	string& operator=(string&& other);  //move op= that accepts rvalue;

	~string();

	size_t getSize() const;
	void concat(const string& other);

	const char* c_str() const;

	string& operator+=(const string& other);

	friend std::ostream& operator<<(std::ostream& stream, const string& str);
	friend std::istream& operator>>(std::istream& stream, string& str);
	void getLine(std::istream& out);
};

string operator+(const string& lhs, const string& rhs);

bool operator==(const string& lhs, const string& rhs);
bool operator<=(const string& lhs, const string& rhs);
bool operator<(const string& lhs, const string& rhs);