summaryrefslogtreecommitdiff
path: root/odb/options.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-03-31 12:40:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-03-31 12:40:54 +0200
commit59e7ca8e3c83b7fee8282c043107acf4d7c3bab1 (patch)
treec2acee74aa984b7ec1d5e1f10752f322318ca750 /odb/options.hxx
parent4264df570c04a85ef4c36fdd0ff197cfe3bb557c (diff)
Regenerate options parsing code
Diffstat (limited to 'odb/options.hxx')
-rw-r--r--odb/options.hxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/odb/options.hxx b/odb/options.hxx
index 1615570..241c8a9 100644
--- a/odb/options.hxx
+++ b/odb/options.hxx
@@ -12,6 +12,7 @@
//
// End prologue.
+#include <list>
#include <deque>
#include <map>
#include <vector>
@@ -341,6 +342,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;
@@ -355,7 +369,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.
//
@@ -365,6 +387,7 @@ namespace cli
bool skip_;
static int zero_argc_;
+ static std::string empty_string_;
};
typedef std::vector<std::string> option_names;