mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2026-02-03 19:22:29 -05:00
Moved getCipher() to remove occasional compile error
This commit is contained in:
@@ -102,27 +102,6 @@ void setFlagStrings(){
|
|||||||
flagStrings[OUTPUT_FILE] = "-o";
|
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 runCaesar(std::ifstream& infile, bool encode){
|
||||||
std::string inputString, cipherString;
|
std::string inputString, cipherString;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -246,4 +225,25 @@ std::string runAtbash(std::ifstream& infile, bool encode){
|
|||||||
return cipherString;
|
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
|
#endif //HELPER_FUNCTIONS_HPP
|
||||||
Reference in New Issue
Block a user