Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 09 / StringPool / StringPool.h
blob: 6be17151b68fc06912e2cd2929c76954fc1615e7 (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& other);

	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);