Refractoring

This commit is contained in:
amazing-username
2017-06-23 18:01:42 -05:00
parent d82b286ec9
commit 6c1f92ea30
14 changed files with 254 additions and 103 deletions
+52
View File
@@ -0,0 +1,52 @@
#include<fstream>
#include<iostream>
#include<ios>
#include"KeyRetrieval.h"
KeyRetrieval::KeyRetrieval()
{
retrieveKey();
addToList();
}
void KeyRetrieval::retrieveKey()
{
std::fstream readKeys{};
readKeys.open(fileName.c_str());
char keyChar[keySize];
while (!readKeys.eof())
{
readKeys.getline(keyChar, '\n');
if (keyChar[0]!='\0')
{
keys.push_back(keyChar);
}
}
}
void KeyRetrieval::addToList()
{
addRange(10, 10);
addRange(32, 47);
addRange(58, 64);
addRange(91, 96);
addRange(123, 126);
addRange(48, 57);
addRange(65, 90);
addRange(97, 122);
}
void KeyRetrieval::addRange(int from, const int to)
{
for (; from<=to; ++from)
codeCharacter.push_back(from);
}
std::vector<std::string> KeyRetrieval::keyStructure()
{
return keys;
}
std::vector<int> KeyRetrieval::codeCharacterStructure()
{
return codeCharacter;
}