Added class to retrieve and store arguments

This commit is contained in:
amazing-username
2017-07-02 17:51:54 -05:00
parent 26848bfd93
commit 1a892f06fb
4 changed files with 48 additions and 12 deletions
+38
View File
@@ -0,0 +1,38 @@
#ifndef RETRIEVEARGUMENTS_H
#define RETRIEVEARGUMENTS_H
#include<vector>
#include<string>
class RetrieveArguments
{
public:
RetrieveArguments() = default;
RetrieveArguments(const int, char*[]);
void initilize(const int, char*[]);
std::vector<std::string> argumentElements() const;
private:
std::vector<std::string> arguments;
};
#endif
RetrieveArguments::RetrieveArguments(const int amountOfArguments, char* argumentsFromInit[])
{
for (auto index=1; index!=amountOfArguments; ++index)
{
arguments.push_back(std::string{*(argumentsFromInit + index)});
}
}
void RetrieveArguments::initilize(const int amountOfArguments, char* argumentsFromInit[])
{
for (auto index=1; index!=amountOfArguments; ++index)
arguments.push_back(std::string{*(argumentsFromInit + index)});
}
std::vector<std::string> RetrieveArguments::argumentElements() const
{
return arguments;
}