/** * Clayton Cafiero * CS 2240 * 2021-Jan-19 */ #ifndef DICTIONARY_H #define DICTIONARY_H #include #include #include class DictionaryItem { private: std::string word; std::string definition; public: DictionaryItem() { this->word = ""; this->definition = ""; } DictionaryItem(std::string word, std::string definition) { this->word = word; this->definition = definition; } // Getters std::string getWord() const { return word; } std::string getDefinition() const { return definition; } // Setters void setWord(std::string word) { this->word = word; } void setDefinition(std::string definition) { this->definition = definition; } friend std::ostream& operator << (std::ostream& outs, const DictionaryItem& d) { outs << std::left << std::setw(20) << d.word; outs << std::left << d.definition; return outs; } friend bool operator == (const DictionaryItem &lhs, const DictionaryItem &rhs) { // Use the unique field to determine if the two objects are equal return lhs.word == rhs.word; } }; #endif // DICTIONARY_H