Created
November 8, 2010 20:59
-
-
Save chtitux/668262 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Dictionary.cpp | |
* | |
* Created on: 8 nov. 2010 | |
* Author: chtitux | |
*/ | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <stdexcept> | |
#include "Dictionary.h" | |
Dictionary::Dictionary() { | |
} | |
Dictionary::Dictionary(istream & is) { | |
} | |
void Dictionary::Flush() { | |
words.clear(); | |
} | |
unsigned int Dictionary::Size() const { | |
return words.size(); | |
} | |
void Dictionary::Insert(const string & key, const string & value) { | |
words[key] = value; | |
} | |
void Dictionary::Remove(const string & key) { | |
words.erase(key); | |
} | |
string Dictionary::Translate(const string & key) const { | |
return words.at(key); | |
} | |
istream& Dictionary::ReadFrom(istream& is) { | |
return is; | |
} | |
istream& Dictionary::ReadPair(istream & is) { | |
return is; | |
} | |
istream& operator >> (istream& is, Dictionary& dico) { | |
return is; | |
} | |
ostream& Dictionary::printOn(ostream & os) const { | |
os << "(" << Size() << ") " ; | |
const_iterator it = words.begin(); | |
for(; it != words.end(); ++it) { | |
os << endl << (*it).first <<'\t'<< (*it).second; | |
// os << (*it).first << "->" << (*it).second << "," << endl; | |
} | |
os << endl; | |
return os; | |
} | |
ostream& Dictionary::PrintOn(ostream& os) const { | |
const_iterator it = words.begin(); | |
for(;it != words.end();++it) | |
os << endl << (*it).first <<'\t'<< (*it).second; | |
return os; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment