Re-removed the clear checks for the class strings when adding to them

This commit is contained in:
2018-05-14 15:47:33 -04:00
parent fec425ae29
commit 3d340762de

View File

@@ -79,6 +79,8 @@ void Vigenere::setKeyword(std::string key){
} }
//If it is not a letter ignore it //If it is not a letter ignore it
} }
//Make sure offset is empty before adding to it
offset.clear();
setOffset(); setOffset();
} }
@@ -96,8 +98,6 @@ std::string Vigenere::getKeyword() const{
* *
*/ */
void Vigenere::setOffset(){ void Vigenere::setOffset(){
//Make sure offset is empty
offset.clear();
//Reserve the correct size to increase speed later //Reserve the correct size to increase speed later
offset.reserve(keyword.size()); offset.reserve(keyword.size());
@@ -123,7 +123,6 @@ std::vector<unsigned int> Vigenere::getOffsets() const{
* @return The encoded message * @return The encoded message
*/ */
std::string Vigenere::encode(){ std::string Vigenere::encode(){
outputString = "";
//Reserve the correct size for the output string to increase speed for longer messages //Reserve the correct size for the output string to increase speed for longer messages
outputString.reserve(inputString.size()); outputString.reserve(inputString.size());
@@ -168,7 +167,6 @@ std::string Vigenere::encode(std::string key, std::string input){
* @return The decoded message * @return The decoded message
*/ */
std::string Vigenere::decode(){ std::string Vigenere::decode(){
outputString = "";
//Reserve the correct size for the output string to increase speed for longer messages //Reserve the correct size for the output string to increase speed for longer messages
outputString.reserve(inputString.size()); outputString.reserve(inputString.size());