Changed containers the two containers that help actions and flags respectively to std::array, removed some unneeded functions
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define ACTIONMANAGER_H_
|
||||
|
||||
#include<string>
|
||||
#include<array>
|
||||
#include<vector>
|
||||
|
||||
#include"Models/Flags.h"
|
||||
@@ -21,8 +22,6 @@ namespace Managers
|
||||
bool isNumber(std::string);
|
||||
|
||||
void initialize();
|
||||
void initializeSupportedActions();
|
||||
void initializeSupportedFlags();
|
||||
void validateAction();
|
||||
void validateFlags();
|
||||
|
||||
@@ -33,8 +32,13 @@ namespace Managers
|
||||
void printFlags();
|
||||
|
||||
std::string action;
|
||||
std::vector<std::string> supportedActions;
|
||||
std::vector<std::string> supportedFlags;
|
||||
std::array<std::string, 4> supportedActions{
|
||||
"download", "upload", "retrieve", "delete"
|
||||
};
|
||||
std::array<std::string, 9> supportedFlags{
|
||||
"-u", "-p", "-t", "-h", "-s",
|
||||
"-d", "-D", "-b", "-rt"
|
||||
};
|
||||
std::vector<Models::Flags> flags;
|
||||
char **params;
|
||||
};
|
||||
|
||||
@@ -20,10 +20,6 @@ namespace Managers
|
||||
{
|
||||
this->params = param;
|
||||
|
||||
action = string{params[1]};
|
||||
transform(action.begin(), action.end(),
|
||||
action.begin(), ::tolower);
|
||||
|
||||
initialize();
|
||||
}
|
||||
#pragma Constructors
|
||||
@@ -59,23 +55,11 @@ namespace Managers
|
||||
|
||||
void ActionManager::initialize()
|
||||
{
|
||||
initializeSupportedActions();
|
||||
validateAction();
|
||||
validateFlags();
|
||||
}
|
||||
void ActionManager::initializeSupportedActions()
|
||||
{
|
||||
supportedActions = vector<string>{
|
||||
"download", "delete",
|
||||
"retrieve", "upload"
|
||||
};
|
||||
}
|
||||
void ActionManager::initializeSupportedFlags()
|
||||
{
|
||||
supportedFlags = vector<string>{
|
||||
"-u", "-p", "-t", "-h", "-s",
|
||||
"-d", "-D", "-b", "-rt"
|
||||
};
|
||||
|
||||
action = string{params[1]};
|
||||
transform(action.begin(), action.end(),
|
||||
action.begin(), ::tolower);
|
||||
}
|
||||
void ActionManager::validateAction()
|
||||
{
|
||||
@@ -100,7 +84,6 @@ namespace Managers
|
||||
cout<<"Validating flags"<<endl;
|
||||
|
||||
auto flagVals = parsedFlags();
|
||||
initializeSupportedFlags();
|
||||
|
||||
Flags flg{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user