Use new constructor of Argument in constructor of ArgumentParser

This commit is contained in:
Stephan van Veen 2019-05-10 17:20:12 +02:00
parent 10fab58969
commit 6d3be1927c

View File

@ -265,11 +265,10 @@ public:
class ArgumentParser { class ArgumentParser {
public: public:
explicit ArgumentParser(std::string aProgramName = "") : explicit ArgumentParser(std::string aProgramName = {}) :
mProgramName(std::move(aProgramName)), mProgramName(std::move(aProgramName))
mNextPositionalArgument(0) { {
std::shared_ptr<Argument> tArgument = std::make_shared<Argument>(); std::shared_ptr<Argument> tArgument = std::make_shared<Argument>("-h", "--help");
tArgument->mNames = { "-h", "--help" };
tArgument->mHelp = "show this help message and exit"; tArgument->mHelp = "show this help message and exit";
tArgument->mNumArgs = 0; tArgument->mNumArgs = 0;
tArgument->mDefaultValue = false; tArgument->mDefaultValue = false;
@ -654,7 +653,7 @@ class ArgumentParser {
std::vector<ArgumentParser> mParentParsers; std::vector<ArgumentParser> mParentParsers;
std::vector<std::shared_ptr<Argument>> mPositionalArguments; std::vector<std::shared_ptr<Argument>> mPositionalArguments;
std::vector<std::shared_ptr<Argument>> mOptionalArguments; std::vector<std::shared_ptr<Argument>> mOptionalArguments;
size_t mNextPositionalArgument; size_t mNextPositionalArgument = 0;
std::map<std::string, std::shared_ptr<Argument>> mArgumentMap; std::map<std::string, std::shared_ptr<Argument>> mArgumentMap;
}; };