Added propper error handling

This commit is contained in:
2019-03-07 12:38:22 -05:00
parent 80ebb77040
commit b33f790243
4 changed files with 91 additions and 23 deletions

View File

@@ -14,6 +14,23 @@
class Playfair{
private:
//Classed to help with error handling
class letterNotFound{
private:
char letter;
public:
letterNotFound(char letter): letter(letter) {}
char getLetter(){ return letter; }
};
class invalidGrid{
private:
std::string type;
unsigned int size;
public:
invalidGrid(std::string type, unsigned int size): type(type), size(size) {}
std::string getType(){ return type; }
int getSize(){ return size; }
};
static char REPLACED; //The letter that will need to be replaced in the grid and any input string or keyword
static char REPLACER; //The letter that replaced REPLACED in any input string or keyword
static char DOUBLED; //The letter that will be placed between double letters in the input string if necessary or to make the string length even

View File

@@ -14,6 +14,7 @@
class Vigenere{
protected:
class emptyKeyword{}; //A class to help with error handling
std::string inputString; //This is the string that you want to encode or decode
std::string outputString; //This is the string that is output from encoding or decoding
std::string keyword; //This is the keyword that is the resposible for determining the offsets that you change each character by