aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/options.cxx3
-rw-r--r--odb/options.hxx9
-rw-r--r--odb/options.ixx29
3 files changed, 40 insertions, 1 deletions
diff --git a/odb/options.cxx b/odb/options.cxx
index 98af4e9..829a96a 100644
--- a/odb/options.cxx
+++ b/odb/options.cxx
@@ -214,6 +214,8 @@ namespace cli
// argv_file_scanner
//
+ int argv_file_scanner::zero_argc_ = 0;
+
bool argv_file_scanner::
more ()
{
@@ -472,7 +474,6 @@ namespace cli
using namespace std;
const char* o (s.next ());
-
if (s.more ())
{
string v (s.next ());
diff --git a/odb/options.hxx b/odb/options.hxx
index 883ad20..1615570 100644
--- a/odb/options.hxx
+++ b/odb/options.hxx
@@ -298,6 +298,9 @@ namespace cli
const std::string& option,
bool erase = false);
+ argv_file_scanner (const std::string& file,
+ const std::string& option);
+
struct option_info
{
// If search_func is not NULL, it is called, with the arg
@@ -322,6 +325,10 @@ namespace cli
std::size_t options_count,
bool erase = false);
+ argv_file_scanner (const std::string& file,
+ const option_info* options = 0,
+ std::size_t options_count = 0);
+
virtual bool
more ();
@@ -356,6 +363,8 @@ namespace cli
std::size_t i_;
bool skip_;
+
+ static int zero_argc_;
};
typedef std::vector<std::string> option_names;
diff --git a/odb/options.ixx b/odb/options.ixx
index 8fafd73..e0317cb 100644
--- a/odb/options.ixx
+++ b/odb/options.ixx
@@ -194,6 +194,22 @@ namespace cli
}
inline argv_file_scanner::
+ argv_file_scanner (const std::string& file,
+ const std::string& option)
+ : argv_scanner (0, zero_argc_, 0),
+ option_ (option),
+ options_ (&option_info_),
+ options_count_ (1),
+ i_ (1),
+ skip_ (false)
+ {
+ option_info_.option = option_.c_str ();
+ option_info_.search_func = 0;
+
+ load (file);
+ }
+
+ inline argv_file_scanner::
argv_file_scanner (int& argc,
char** argv,
const option_info* options,
@@ -222,6 +238,19 @@ namespace cli
{
}
+ inline argv_file_scanner::
+ argv_file_scanner (const std::string& file,
+ const option_info* options,
+ std::size_t options_count)
+ : argv_scanner (0, zero_argc_, 0),
+ options_ (options),
+ options_count_ (options_count),
+ i_ (1),
+ skip_ (false)
+ {
+ load (file);
+ }
+
inline const std::string& option::
name () const
{