diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2019-01-11 11:35:07 -0700 |
---|---|---|
committer | Taylor C. Richberger <taywee@gmx.com> | 2019-01-11 11:35:07 -0700 |
commit | f68b7e186cd2a020cbddfe3194c1d8ddfeeb1013 (patch) | |
tree | 57641aba0a32a1ef43ada31ff81ef36f55401a92 /args.hxx | |
parent | fix default args for extra types (diff) | |
download | args.hxx-f68b7e186cd2a020cbddfe3194c1d8ddfeeb1013.tar.xz |
Fix default list processing6.2.2
The previous release had set up default arguments to add to the existing
default list. Now making a match will clear the list and replace it.
Diffstat (limited to 'args.hxx')
-rw-r--r-- | args.hxx | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -3506,6 +3506,17 @@ namespace args FlagBase::Reset(); values = defaultValues; } + + virtual FlagBase *Match(const EitherFlag &arg) override + { + const bool wasMatched = Matched(); + auto me = FlagBase::Match(arg); + if (me && !wasMatched) + { + values.clear(); + } + return me; + } }; /** An argument-accepting flag class that pushes the found values into a list @@ -3583,6 +3594,17 @@ namespace args values = defaultValues; } + virtual FlagBase *Match(const EitherFlag &arg) override + { + const bool wasMatched = Matched(); + auto me = FlagBase::Match(arg); + if (me && !wasMatched) + { + values.clear(); + } + return me; + } + iterator begin() noexcept { return values.begin(); @@ -3799,6 +3821,17 @@ namespace args values = defaultValues; } + virtual FlagBase *Match(const EitherFlag &arg) override + { + const bool wasMatched = Matched(); + auto me = FlagBase::Match(arg); + if (me && !wasMatched) + { + values.clear(); + } + return me; + } + iterator begin() noexcept { return values.begin(); @@ -3960,6 +3993,17 @@ namespace args values = defaultValues; } + virtual PositionalBase *GetNextPositional() override + { + const bool wasMatched = Matched(); + auto me = PositionalBase::GetNextPositional(); + if (me && !wasMatched) + { + values.clear(); + } + return me; + } + iterator begin() noexcept { return values.begin(); @@ -4170,6 +4214,17 @@ namespace args values = defaultValues; } + virtual PositionalBase *GetNextPositional() override + { + const bool wasMatched = Matched(); + auto me = PositionalBase::GetNextPositional(); + if (me && !wasMatched) + { + values.clear(); + } + return me; + } + iterator begin() noexcept { return values.begin(); |