Moved getCipher() to remove occasional compile error

This commit is contained in:
2018-04-30 13:32:02 -04:00
parent 580bbd705d
commit 7f23ef0b73

View File

@@ -102,27 +102,6 @@ void setFlagStrings(){
flagStrings[OUTPUT_FILE] = "-o";
}
//Returns the correct function for the flags that are set
Fn getCipher(const bool cipherFlags[]){
if(cipherFlags[CAESAR]){
return runCaesar;
}
else if(cipherFlags[PLAYFAIR]){
return runPlayfair;
}
else if(cipherFlags[VIGENERE]){
return runVigenere;
}
else if(cipherFlags[ATBASH]){
return runAtbash;
}
//If it didn't trip one of the flags, there was an error before this
else{
std::cout << "There was an error selecting the appropriate function";
exit(0);
}
}
std::string runCaesar(std::ifstream& infile, bool encode){
std::string inputString, cipherString;
int offset;
@@ -246,4 +225,25 @@ std::string runAtbash(std::ifstream& infile, bool encode){
return cipherString;
}
//Returns the correct function for the flags that are set
Fn getCipher(const bool cipherFlags[]){
if(cipherFlags[CAESAR]){
return runCaesar;
}
else if(cipherFlags[PLAYFAIR]){
return runPlayfair;
}
else if(cipherFlags[VIGENERE]){
return runVigenere;
}
else if(cipherFlags[ATBASH]){
return runAtbash;
}
//If it didn't trip one of the flags, there was an error before this
else{
std::cout << "There was an error selecting the appropriate function";
exit(0);
}
}
#endif //HELPER_FUNCTIONS_HPP