mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
Adding more to the option parser.
Adding instruction on how to test it.
This commit is contained in:
parent
732b17a368
commit
633c9becd9
4 changed files with 40 additions and 6 deletions
8
util.cpp
8
util.cpp
|
@ -6,7 +6,7 @@ namespace util
|
|||
{
|
||||
std::map<std::string, std::string> mapArgs;
|
||||
|
||||
void ParseArguments(int argc, const char* const argv[])
|
||||
void OptionParser(int argc, const char* const argv[])
|
||||
{
|
||||
mapArgs.clear();
|
||||
for (int i = 1; i < argc; i++)
|
||||
|
@ -33,11 +33,11 @@ int GetIntArg(const std::string& strArg, int nDefault)
|
|||
return nDefault;
|
||||
}
|
||||
|
||||
std::string GetStringArg(const std::string& strArg, std::string nDefault)
|
||||
const char* GetCharArg(const std::string& strArg, const std::string& nDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
return mapArgs[strArg];
|
||||
return nDefault;
|
||||
return mapArgs[strArg].c_str();
|
||||
return nDefault.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue