8af7ad88a3
* Lua Script Debug Fix AND Get Args Params * restore wiArgs, change AttachScript as one liner * cleanups * revert argument changes Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com>
41 lines
672 B
C++
41 lines
672 B
C++
#include "wiArguments.h"
|
|
#include "wiHelper.h"
|
|
#include "wiUnorderedSet.h"
|
|
|
|
#include <sstream>
|
|
#include <iterator>
|
|
|
|
namespace wi::arguments
|
|
{
|
|
wi::unordered_set<std::string> params;
|
|
|
|
void Parse(const wchar_t* args)
|
|
{
|
|
std::wstring from = args;
|
|
std::string to;
|
|
wi::helper::StringConvert(from, to);
|
|
|
|
std::istringstream iss(to);
|
|
|
|
params =
|
|
{
|
|
std::istream_iterator<std::string>{iss},
|
|
std::istream_iterator<std::string>{}
|
|
};
|
|
|
|
}
|
|
|
|
void Parse(int argc, char *argv[])
|
|
{
|
|
for (int i = 1; i < argc; i++)
|
|
{
|
|
params.insert(std::string(argv[i]));
|
|
}
|
|
}
|
|
|
|
bool HasArgument(const std::string& value)
|
|
{
|
|
return params.find(value) != params.end();
|
|
}
|
|
}
|