From 02c8a08780f10791e39331ba77e4d1c1558cbf7c Mon Sep 17 00:00:00 2001 From: "John W. Horigan" Date: Sat, 27 May 2017 11:48:53 -0700 Subject: Fix variables shadowing the help member --- args.hxx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/args.hxx b/args.hxx index 93e4464..b12c69c 100644 --- a/args.hxx +++ b/args.hxx @@ -1048,7 +1048,7 @@ namespace args /** Pass the help menu into an ostream */ - void Help(std::ostream &help) const + void Help(std::ostream &help_) const { bool hasoptions = false; bool hasarguments = false; @@ -1081,22 +1081,22 @@ namespace args auto progit = std::begin(proglines); if (progit != std::end(proglines)) { - help << std::string(helpParams.progindent, ' ') << *progit << '\n'; + help_ << std::string(helpParams.progindent, ' ') << *progit << '\n'; ++progit; } for (; progit != std::end(proglines); ++progit) { - help << std::string(helpParams.progtailindent, ' ') << *progit << '\n'; + help_ << std::string(helpParams.progtailindent, ' ') << *progit << '\n'; } - help << '\n'; + help_ << '\n'; for (const auto &line: description_text) { - help << std::string(helpParams.descriptionindent, ' ') << line << "\n"; + help_ << std::string(helpParams.descriptionindent, ' ') << line << "\n"; } - help << "\n"; - help << std::string(helpParams.progindent, ' ') << "OPTIONS:\n\n"; + help_ << "\n"; + help_ << std::string(helpParams.progindent, ' ') << "OPTIONS:\n\n"; for (const auto &desc: GetChildDescriptions(shortprefix, longprefix, allowJoinedShortValue ? "" : " ", allowJoinedLongValue ? longseparator : " ")) { const auto groupindent = std::get<2>(desc) * helpParams.eachgroupindent; @@ -1108,9 +1108,9 @@ namespace args { if (flagsit != std::begin(flags)) { - help << '\n'; + help_ << '\n'; } - help << std::string(groupindent + helpParams.flagindent, ' ') << *flagsit; + help_ << std::string(groupindent + helpParams.flagindent, ' ') << *flagsit; flagssize = Glyphs(*flagsit); } @@ -1118,30 +1118,30 @@ namespace args // groupindent is on both sides of this inequality, and therefore can be removed if ((helpParams.flagindent + flagssize + helpParams.gutter) > helpParams.helpindent || infoit == std::end(info)) { - help << '\n'; + help_ << '\n'; } else { // groupindent is on both sides of the minus sign, and therefore doesn't actually need to be in here - help << std::string(helpParams.helpindent - (helpParams.flagindent + flagssize), ' ') << *infoit << '\n'; + help_ << std::string(helpParams.helpindent - (helpParams.flagindent + flagssize), ' ') << *infoit << '\n'; ++infoit; } for (; infoit != std::end(info); ++infoit) { - help << std::string(groupindent + helpParams.helpindent, ' ') << *infoit << '\n'; + help_ << std::string(groupindent + helpParams.helpindent, ' ') << *infoit << '\n'; } } if (hasoptions && hasarguments && helpParams.showTerminator) { for (const auto &item: Wrap(std::string("\"") + terminator + "\" can be used to terminate flag options and force all following arguments to be treated as positional options", helpParams.width - helpParams.flagindent)) { - help << std::string(helpParams.flagindent, ' ') << item << '\n'; + help_ << std::string(helpParams.flagindent, ' ') << item << '\n'; } } - help << "\n"; + help_ << "\n"; for (const auto &line: epilog_text) { - help << std::string(helpParams.descriptionindent, ' ') << line << "\n"; + help_ << std::string(helpParams.descriptionindent, ' ') << line << "\n"; } } @@ -1151,9 +1151,9 @@ namespace args */ std::string Help() const { - std::ostringstream help; - Help(help); - return help.str(); + std::ostringstream help_; + Help(help_); + return help_.str(); } /** Parse all arguments. -- cgit v1.2.1