Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 09 / StringPool / StringPool.h
diff options
context:
space:
mode:
1 files changed, 37 insertions, 0 deletions
-rw-r--r--Sem. 09/StringPool/StringPool.h37
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);