stuff-from-scratch/src/core/CommandLineArgs.cpp
2022-10-03 07:45:10 +01:00

50 lines
907 B
C++

#include "CommandLineArgs.h"
CommandLineArgs::CommandLineArgs()
: mArugments(),
mLaunchPath()
{
}
std::unique_ptr<CommandLineArgs> CommandLineArgs::Create()
{
return std::make_unique<CommandLineArgs>();
}
std::filesystem::path CommandLineArgs::getLaunchPath()
{
return mLaunchPath;
}
void CommandLineArgs::recordLaunchPath()
{
mLaunchPath = std::filesystem::current_path();
}
void CommandLineArgs::process(int argc, char *argv[])
{
for(int idx=0; idx<argc; idx++)
{
mArugments.push_back(std::string(argv[idx]));
}
}
void CommandLineArgs::process(const std::vector<std::string>& args)
{
mArugments = args;
}
std::size_t CommandLineArgs::getNumberOfArgs() const
{
return mArugments.size();
}
std::string CommandLineArgs::getArg(std::size_t index) const
{
if(index<mArugments.size())
{
return mArugments[index];
}
return "";
}