diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-03-21 13:19:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-03-21 13:19:18 +0200 |
commit | 6520b63cb25580420e477cba2c776b2639cbf21b (patch) | |
tree | b166ff171780389a0f079ae587dd8cc75fb0d68e /cli/options.hxx | |
parent | 1dea398d6f864c99b9e1c34e4a718239cfd3d8ac (diff) |
Guarantee validity of values returned by scanner for two arguments
Diffstat (limited to 'cli/options.hxx')
-rw-r--r-- | cli/options.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/options.hxx b/cli/options.hxx index cc9d897..a3dffd2 100644 --- a/cli/options.hxx +++ b/cli/options.hxx @@ -224,6 +224,12 @@ namespace cli std::string argument_; }; + // Command line argument scanner interface. + // + // The values returned by next() are guaranteed to be valid + // for the two previous arguments up until a call to a third + // peek() or next(). + // class scanner { public: @@ -335,8 +341,13 @@ namespace cli const option_info* options_; std::size_t options_count_; - std::string hold_; std::deque<std::string> args_; + + // Circular buffer of two arguments. + // + std::string hold_[2]; + std::size_t i_; + bool skip_; }; |