Added documentation

This commit is contained in:
2018-05-05 16:44:16 -04:00
parent ed122085a9
commit d1b1dc5e77

View File

@@ -17,34 +17,34 @@ private:
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
std::string inputString;
std::string outputString;
std::string keyword;
char grid[5][5];
void createGrid();
bool checkGrid(const char letter) const;
void searchGrid(char letter, int& row, int& col);
void setInputString(std::string input);
void setKeyword(std::string key);
std::string encode();
std::string decode();
std::string inputString; //The message that needs to be encoded/decoded
std::string outputString; //The encoded/decoded message
std::string keyword; //The keyword used to create the grid
char grid[5][5]; //The grid used to encode/decode the message
void createGrid(); //Create the grid from the keyword
bool checkGrid(const char letter) const; //Returns true if the letter is found in the grid
void searchGrid(char letter, int& row, int& col); //Searches the grid for letter and sets row & col to its location in grid
void setInputString(std::string input); //Strips invalid characters from the string that needs encoded/decoded
void setKeyword(std::string key); //Strips invalid character from the keyword and creates the grid
std::string encode(); //Encodes inputString using the Playfair cipher and stores the result in outputString
std::string decode(); //Decodes inputString using the Playfair cipher and stores the result in outputString
public:
Playfair();
~Playfair();
std::string encode(std::string keyword, std::string input);
std::string decode(std::string keyword, std::string input);
std::string getKeyword() const;
std::string getInputString() const;
std::string getOutputString() const;
std::string getGrid() const;
void reset();
std::string encode(std::string keyword, std::string input); //Sets the keyword and inputString and encodes the message
std::string decode(std::string keyword, std::string input); //Sets the keyword and inputString and decodes the message
std::string getKeyword() const; //Returns the keyword used to create the grid
std::string getInputString() const; //Returns the string that needs encoded/decoded
std::string getOutputString() const; //Returns the encoded/decoded message
std::string getGrid() const; //Returns a string representation of the grid
void reset(); //Makes sure all variables are empty
//Change static variables
static char getReplaced();
static void setReplaced(const char replaced);
static char getReplacer();
static void setReplacer(const char replacer);
static char getDoubled();
static void setDoubled(const char doubled);
static char getReplaced(); //Returns the character that needs replaced in messages and the grid
static char getReplacer(); //Returns the character that replaces the character that needs replaced
static char getDoubled(); //Returns the character that is added between 2 adjacent characters that are the same
static void setReplaced(const char replaced); //Sets the character that needs replaced in messages and the grid
static void setReplacer(const char replacer); //Sets the character that replaces the character that needs replaced
static void setDoubled(const char doubled); //Sets the character that is added betwee 2 adjacent characters that are the same
};
#endif //PLAYFAIR_HPP