From 086675f2e8b421f811ffc0ea140dc1b4f2b85e0d Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Tue, 19 Apr 2022 20:25:32 +0300 Subject: Add files via upload --- Sem. 09/StringPool/StringPool.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Sem. 09/StringPool/StringPool.h (limited to 'Sem. 09/StringPool/StringPool.h') diff --git a/Sem. 09/StringPool/StringPool.h b/Sem. 09/StringPool/StringPool.h new file mode 100644 index 0000000..6be1715 --- /dev/null +++ b/Sem. 09/StringPool/StringPool.h @@ -0,0 +1,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); -- cgit v1.3.1-23-gd82d