// Decodebook.h - holds codebook in a vector of Pairs // ordered on "code" from low to high // for ease of look up in decoding #ifndef DECODEBOOK_CLASS #define DECODEBOOK_CLASS #include #include #include "Pair.h" class Decodebook { private: std::vector code; public: // default constructor // sets private data member to default value Decodebook(); // reads the codebook.txt // creates a pair for code and plaintext // locates where to insert the pair // inserts the pair void reader(const char *); // makes a pair from a single line of input Pair makePair(std::string); // inserts pairs from codebook.txt into a vector // pairs are ordered on code rather than plaintext // order is low to high void insert(Pair); // locates the code string // ie "2954" (associated with "of") bool locate(std::string,std::vector::iterator &); // prints the vector // uses iterators to accomplish this void print() const; private: // you may put any private member functions here }; #endif // DECODEBOOK_CLASS