diff options
Implemented (broken) overall functionality of ex3 of sem 08
1 files changed, 38 insertions, 0 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h | 38 |
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h new file mode 100644 index 0000000..f7a7142 --- /dev/null +++ b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/WordCollection.h @@ -0,0 +1,38 @@ +#include "DynStr.h" +#include <istream> +#include <ostream> + +class WordCollection { + DynStr* words; + int* sortMap; + int count; + int length; + + void free(); + void copyFrom(const WordCollection& other); + + void resize(); + void insertSortMapIndex(int position, int value); + void removeSortMapIndex(int position); + int findSortMapIndexWhen(int condition, const char* str); + +public: + WordCollection(); + + WordCollection(const WordCollection& other); + WordCollection& operator=(const WordCollection& other); + ~WordCollection(); + + WordCollection& operator+=(const WordCollection& other); + WordCollection& operator-=(const WordCollection& other); + WordCollection& operator*=(const char* str); + WordCollection& operator/=(const char* str); + + friend std::ostream& operator<<(std::ostream& ostrm, const WordCollection& collection); + friend std::istream& operator>>(std::istream& istrm, WordCollection& collection); + + bool operator[](const char* str); +}; + +const WordCollection operator+(const WordCollection& lhs, const WordCollection& rhs); +const WordCollection operator-(const WordCollection& lhs, const WordCollection& rhs); |
