Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 09 / StringPool / StringPool.h
blob: cef3608d7de6902b7bd626b39b0d1147f672a6b9 (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
#pragma once
#include "MyString/MyString.h"


class StringPool
{
	MyString** data;
	size_t count;

	void copyFrom(const StringPool& other);
	void free();
	void resize(size_t newCount);

	int findWord(const MyString& str) const;

public:
	StringPool();

	StringPool(const StringPool& other);
	StringPool& operator=(const StringPool& other);
	
	StringPool& operator*=(const MyString& word);
	StringPool& operator/=(const MyString& word);

	bool operator[](const MyString& str) const;

	friend std::ostream& operator<<(std::ostream&, const StringPool&);
	friend void operator>>(const MyString&, StringPool&);

	StringPool& operator+=(const StringPool& other);
	StringPool& operator-=(const StringPool& other);

	~StringPool();
};

StringPool operator+(const StringPool& lhs, const StringPool& rhs);
StringPool operator-(const StringPool& lhs, const StringPool& rhs);