//----------------------------- // File: WordCount.C // Project: CMSC 202 Spring 2003, Project 1 // Author: Dennis L. Frey // SSN: xxx-xx-xxxx // Section: 123 // Date: Jan 30, 2003 // // Implementation of the WordCount class //---------------------------------------- #include "WordCount.H" #include using namespace std; // Default Constructor //------------------------------ WordCount::WordCount ( void ) { m_count = 1; } // Construct WordCount from string //-------------------------------= WordCount::WordCount (string word) { m_word = word; m_count = 1; } // GetCount -- accessor // return current count //---------------------------------- int WordCount::GetCount (void) const { return m_count; } // GetWord -- accessor // return current string // not changable by caller //-------------------------------------------- const string& WordCount::GetWord (void ) const { return m_word; } // SetCount -- mutator // change count to parameter value //---------------------------------- void WordCount::SetCount (int count) { m_count = count; } // IncrementCount -- mutator //---------------------------------- void WordCount::IncrementCount (void) { ++m_count; } // DecrementCoutn -- mutator //---------------------------------- void WordCount::DecrementCount (void) { --m_count; }