From 8b87e2d4a63dc24dd744b62524bd3565a5a2f5de Mon Sep 17 00:00:00 2001 From: "Taylor C. Richberger" Date: Thu, 5 May 2016 16:11:24 -0600 Subject: improve some of the logic --- args.hxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'args.hxx') diff --git a/args.hxx b/args.hxx index a797db4..9b9f033 100644 --- a/args.hxx +++ b/args.hxx @@ -277,7 +277,10 @@ namespace args std::get<1>(description) = help; return description; } - + virtual std::string Name() const + { + return name; + } }; /** Base class for all flag arguments @@ -315,7 +318,6 @@ namespace args virtual std::tuple GetDescription(const std::string &shortPrefix, const std::string &longPrefix) const override { std::tuple description; - const std::string upperName(name); const std::vector optStrings(matcher.GetOptionStrings(shortPrefix, longPrefix)); std::ostringstream flagstream; for (auto it = std::begin(optStrings); it != std::end(optStrings); ++it) @@ -344,7 +346,6 @@ namespace args virtual std::tuple GetDescription(const std::string &shortPrefix, const std::string &longPrefix) const override { std::tuple description; - const std::string upperName(name); const std::vector optStrings(matcher.GetOptionStrings(shortPrefix, longPrefix)); std::ostringstream flagstream; for (auto it = std::begin(optStrings); it != std::end(optStrings); ++it) @@ -353,7 +354,7 @@ namespace args { flagstream << ", "; } - flagstream << *it << ' ' << upperName; + flagstream << *it << ' ' << name; } std::get<0>(description) = flagstream.str(); std::get<1>(description) = help; @@ -378,10 +379,6 @@ namespace args } virtual void ParseArg(const std::string &value) = 0; - virtual std::string Name() const - { - return name; - } }; /** Class for all kinds of validating groups, including ArgumentParser -- cgit v1.2.1