// StringTab class implementation file // by CMB // created 8/04 // see header file for interface documentation // header file also has change history #include "StringTab.h" Symbol *StringTab::addString(string newId) { Symbol *theSym; StrTabMap::iterator itemIter = tab.find(newId); if (itemIter == tab.end()) { // if not already there theSym = new Symbol(newId); tab.insert(StrTabMap::value_type(newId, theSym)); } else { theSym = (*itemIter).second; } return theSym; } void StringTab::dumpStringTab(ostream &o) { StrTabMap::const_iterator iter = tab.begin(); while (iter != tab.end()) { o << iter->second->getName() << endl; iter++; } } // used in function below ostream& operator<<(ostream& o, const Symbol& symbol) { return o << symbol.getName(); } ostream& operator<<(ostream& o, const Symbol *symPtr) { return o << *symPtr; }