summaryrefslogtreecommitdiff
path: root/cli/runtime-header.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-01-20 15:38:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-01-20 15:38:10 +0200
commit0267ede2d356abdef7b3e9af19d4725605a58947 (patch)
tree169a57693ec56a1273f2556d311d8df0d5b72974 /cli/runtime-header.cxx
parent50a1ae06f83a353a3b9ff7d473122e60ad5f5636 (diff)
Add support for multiple file options and file search callbacks
Diffstat (limited to 'cli/runtime-header.cxx')
-rw-r--r--cli/runtime-header.cxx33
1 files changed, 30 insertions, 3 deletions
diff --git a/cli/runtime-header.cxx b/cli/runtime-header.cxx
index 1e4941b..41c56c9 100644
--- a/cli/runtime-header.cxx
+++ b/cli/runtime-header.cxx
@@ -21,6 +21,7 @@ generate_runtime_header (context& ctx)
os << "#include <iosfwd>" << endl
<< "#include <string>" << endl
+ << "#include <cstddef>" << endl
<< "#include <exception>" << endl
<< endl;
@@ -266,13 +267,32 @@ generate_runtime_header (context& ctx)
<< "public:" << endl
<< "argv_file_scanner (int& argc," << endl
<< "char** argv," << endl
- << "const std::string& file_option," << endl
+ << "const std::string& option," << endl
<< "bool erase = false);"
<< endl
<< "argv_file_scanner (int start," << endl
<< "int& argc," << endl
<< "char** argv," << endl
- << "const std::string& file_option," << endl
+ << "const std::string& option," << endl
+ << "bool erase = false);"
+ << endl
+ << "struct option_info"
+ << "{"
+ << " const char* option;"
+ << " std::string (*search_func) (const char*, void* arg);"
+ << " void* arg;"
+ << "};"
+ << "argv_file_scanner (int& argc," << endl
+ << "char** argv," << endl
+ << "const option_info* options," << endl
+ << "std::size_t options_count," << endl
+ << "bool erase = false);"
+ << endl
+ << "argv_file_scanner (int start," << endl
+ << "int& argc," << endl
+ << "char** argv," << endl
+ << "const option_info* options," << endl
+ << "std::size_t options_count," << endl
<< "bool erase = false);"
<< endl
<< "virtual bool" << endl
@@ -288,12 +308,19 @@ generate_runtime_header (context& ctx)
<< "skip ();"
<< endl
<< "private:" << endl
+ << "const option_info*" << endl
+ << "find (const char*) const;"
+ << endl
<< "void" << endl
- << "load (const char* file);"
+ << "load (const std::string& file);"
<< endl
<< "typedef argv_scanner base;"
<< endl
<< "const std::string option_;"
+ << "option_info option_info_;"
+ << "const option_info* options_;"
+ << "std::size_t options_count_;"
+ << endl
<< "std::string hold_;"
<< "std::deque<std::string> args_;";