You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
946 B

#include "CommandLineParams.h"
#include <vector>
namespace {
std::vector<std::string> params;
}
void initCLParams(int argc, char *argv[]) {
params = std::vector<std::string> (argv, argv + argc);
}
bool getCLParam(std::string const& param) {
for (auto const& p : params) {
if (p == param) {
return true;
}
}
return false;
}
std::string getCLParamByIndex(unsigned int i) {
if (i < params.size()) {
return params[i];
}
return "";
}
std::string getRelativeCLParam(std::string const& param, int i) {
for (unsigned int index = 0; index < params.size(); ++index) {
if (params[index] == param) {
int si = static_cast<int>(index);
unsigned int finalPos = static_cast<unsigned int>(si + i);
if (finalPos < params.size()) {
return params[finalPos];
}
return "";
}
}
return "";
}