iphreeqc/Dictionary.cpp
David L Parkhurst af2dbfdce2 Added changes for serializing.
Copied files from concrete_parallel, without merging or svn_copy.
Added Dictionary.cpp and Serializer.cxx + header files.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@10607 1feff8c3-07ed-0310-ac33-dd36852eb9cd
2015-12-28 23:35:36 +00:00

33 lines
597 B
C++

#include "Dictionary.h"
Dictionary::Dictionary(void)
{
}
Dictionary::Dictionary(std::string & words_string)
{
std::istringstream words_stream(words_string);
char str[256];
while (words_stream.getline(str,256))
{
this->Find(str);
}
}
Dictionary::~Dictionary(void)
{
}
int
Dictionary::Find(std::string str)
{
std::map<std::string, int>::iterator it = this->dictionary_map.find(str);
if (it != this->dictionary_map.end())
{
return it->second;
}
int i = this->MapSize();
this->dictionary_map[str] = i;
this->words.push_back(str);
this->dictionary_oss << str << "\n";
return i;
}