summaryrefslogtreecommitdiff
path: root/cli/options.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'cli/options.hxx')
-rw-r--r--cli/options.hxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/cli/options.hxx b/cli/options.hxx
index a865148..6533432 100644
--- a/cli/options.hxx
+++ b/cli/options.hxx
@@ -12,6 +12,7 @@
//
// End prologue.
+#include <list>
#include <deque>
#include <iosfwd>
#include <string>
@@ -339,6 +340,19 @@ namespace cli
virtual void
skip ();
+ // Return the file path if the peeked at argument came from a file and
+ // the empty string otherwise. The reference is guaranteed to be valid
+ // till the end of the scanner lifetime.
+ //
+ const std::string&
+ peek_file ();
+
+ // Return the 1-based line number if the peeked at argument came from
+ // a file and zero otherwise.
+ //
+ std::size_t
+ peek_line ();
+
private:
const option_info*
find (const char*) const;
@@ -353,7 +367,15 @@ namespace cli
const option_info* options_;
std::size_t options_count_;
- std::deque<std::string> args_;
+ struct arg
+ {
+ std::string value;
+ const std::string* file;
+ std::size_t line;
+ };
+
+ std::deque<arg> args_;
+ std::list<std::string> files_;
// Circular buffer of two arguments.
//
@@ -363,6 +385,7 @@ namespace cli
bool skip_;
static int zero_argc_;
+ static std::string empty_string_;
};
template <typename X>