From 2835794b28d482b1e391dc85f79dfa91f9e63d3e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 17 Feb 2022 16:33:27 +0300 Subject: Move parse_cmdline() to libbuild2 --- libbuild2/b-options.ixx | 585 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 585 insertions(+) create mode 100644 libbuild2/b-options.ixx (limited to 'libbuild2/b-options.ixx') diff --git a/libbuild2/b-options.ixx b/libbuild2/b-options.ixx new file mode 100644 index 0000000..62c8299 --- /dev/null +++ b/libbuild2/b-options.ixx @@ -0,0 +1,585 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +// +// End prologue. + +#include + +namespace build2 +{ + namespace build + { + namespace cli + { + // usage_para + // + inline usage_para:: + usage_para (value v) + : v_ (v) + { + } + + // unknown_mode + // + inline unknown_mode:: + unknown_mode (value v) + : v_ (v) + { + } + + // exception + // + inline ::std::ostream& + operator<< (::std::ostream& os, const exception& e) + { + e.print (os); + return os; + } + + // unknown_option + // + inline unknown_option:: + unknown_option (const std::string& option) + : option_ (option) + { + } + + inline const std::string& unknown_option:: + option () const + { + return option_; + } + + // unknown_argument + // + inline unknown_argument:: + unknown_argument (const std::string& argument) + : argument_ (argument) + { + } + + inline const std::string& unknown_argument:: + argument () const + { + return argument_; + } + + // missing_value + // + inline missing_value:: + missing_value (const std::string& option) + : option_ (option) + { + } + + inline const std::string& missing_value:: + option () const + { + return option_; + } + + // invalid_value + // + inline invalid_value:: + invalid_value (const std::string& option, + const std::string& value, + const std::string& message) + : option_ (option), + value_ (value), + message_ (message) + { + } + + inline const std::string& invalid_value:: + option () const + { + return option_; + } + + inline const std::string& invalid_value:: + value () const + { + return value_; + } + + inline const std::string& invalid_value:: + message () const + { + return message_; + } + + // file_io_failure + // + inline file_io_failure:: + file_io_failure (const std::string& file) + : file_ (file) + { + } + + inline const std::string& file_io_failure:: + file () const + { + return file_; + } + + // unmatched_quote + // + inline unmatched_quote:: + unmatched_quote (const std::string& argument) + : argument_ (argument) + { + } + + inline const std::string& unmatched_quote:: + argument () const + { + return argument_; + } + + // argv_scanner + // + inline argv_scanner:: + argv_scanner (int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + 1), + i_ (1), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline argv_scanner:: + argv_scanner (int start, + int& argc, + char** argv, + bool erase, + std::size_t sp) + : start_position_ (sp + static_cast (start)), + i_ (start), + argc_ (argc), + argv_ (argv), + erase_ (erase) + { + } + + inline int argv_scanner:: + end () const + { + return i_; + } + + // argv_file_scanner + // + inline argv_file_scanner:: + argv_file_scanner (int& argc, + char** argv, + const std::string& option, + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), + option_ (option), + options_ (&option_info_), + options_count_ (1), + i_ (1), + skip_ (false) + { + option_info_.option = option_.c_str (); + option_info_.search_func = 0; + } + + inline argv_file_scanner:: + argv_file_scanner (int start, + int& argc, + char** argv, + const std::string& option, + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), + option_ (option), + options_ (&option_info_), + options_count_ (1), + i_ (1), + skip_ (false) + { + option_info_.option = option_.c_str (); + option_info_.search_func = 0; + } + + inline argv_file_scanner:: + argv_file_scanner (const std::string& file, + const std::string& option, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), + 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, + std::size_t options_count, + bool erase, + std::size_t sp) + : argv_scanner (argc, argv, erase, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + } + + inline argv_file_scanner:: + argv_file_scanner (int start, + int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase, + std::size_t sp) + : argv_scanner (start, argc, argv, erase, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + } + + inline argv_file_scanner:: + argv_file_scanner (const std::string& file, + const option_info* options, + std::size_t options_count, + std::size_t sp) + : argv_scanner (0, zero_argc_, 0, sp), + options_ (options), + options_count_ (options_count), + i_ (1), + skip_ (false) + { + load (file); + } + } + } +} + +namespace build2 +{ + // options + // + + inline const uint64_t& options:: + build2_metadata () const + { + return this->build2_metadata_; + } + + inline bool options:: + build2_metadata_specified () const + { + return this->build2_metadata_specified_; + } + + inline const bool& options:: + v () const + { + return this->v_; + } + + inline const bool& options:: + V () const + { + return this->V_; + } + + inline const bool& options:: + quiet () const + { + return this->quiet_; + } + + inline const bool& options:: + silent () const + { + return this->silent_; + } + + inline const uint16_t& options:: + verbose () const + { + return this->verbose_; + } + + inline bool options:: + verbose_specified () const + { + return this->verbose_specified_; + } + + inline const bool& options:: + stat () const + { + return this->stat_; + } + + inline const std::set& options:: + dump () const + { + return this->dump_; + } + + inline bool options:: + dump_specified () const + { + return this->dump_specified_; + } + + inline const bool& options:: + progress () const + { + return this->progress_; + } + + inline const bool& options:: + no_progress () const + { + return this->no_progress_; + } + + inline const size_t& options:: + jobs () const + { + return this->jobs_; + } + + inline bool options:: + jobs_specified () const + { + return this->jobs_specified_; + } + + inline const size_t& options:: + max_jobs () const + { + return this->max_jobs_; + } + + inline bool options:: + max_jobs_specified () const + { + return this->max_jobs_specified_; + } + + inline const size_t& options:: + queue_depth () const + { + return this->queue_depth_; + } + + inline bool options:: + queue_depth_specified () const + { + return this->queue_depth_specified_; + } + + inline const string& options:: + file_cache () const + { + return this->file_cache_; + } + + inline bool options:: + file_cache_specified () const + { + return this->file_cache_specified_; + } + + inline const size_t& options:: + max_stack () const + { + return this->max_stack_; + } + + inline bool options:: + max_stack_specified () const + { + return this->max_stack_specified_; + } + + inline const bool& options:: + serial_stop () const + { + return this->serial_stop_; + } + + inline const bool& options:: + dry_run () const + { + return this->dry_run_; + } + + inline const bool& options:: + match_only () const + { + return this->match_only_; + } + + inline const bool& options:: + no_external_modules () const + { + return this->no_external_modules_; + } + + inline const bool& options:: + structured_result () const + { + return this->structured_result_; + } + + inline const bool& options:: + mtime_check () const + { + return this->mtime_check_; + } + + inline const bool& options:: + no_mtime_check () const + { + return this->no_mtime_check_; + } + + inline const bool& options:: + no_column () const + { + return this->no_column_; + } + + inline const bool& options:: + no_line () const + { + return this->no_line_; + } + + inline const path& options:: + buildfile () const + { + return this->buildfile_; + } + + inline bool options:: + buildfile_specified () const + { + return this->buildfile_specified_; + } + + inline const path& options:: + config_guess () const + { + return this->config_guess_; + } + + inline bool options:: + config_guess_specified () const + { + return this->config_guess_specified_; + } + + inline const path& options:: + config_sub () const + { + return this->config_sub_; + } + + inline bool options:: + config_sub_specified () const + { + return this->config_sub_specified_; + } + + inline const string& options:: + pager () const + { + return this->pager_; + } + + inline bool options:: + pager_specified () const + { + return this->pager_specified_; + } + + inline const strings& options:: + pager_option () const + { + return this->pager_option_; + } + + inline bool options:: + pager_option_specified () const + { + return this->pager_option_specified_; + } + + inline const string& options:: + options_file () const + { + return this->options_file_; + } + + inline bool options:: + options_file_specified () const + { + return this->options_file_specified_; + } + + inline const dir_path& options:: + default_options () const + { + return this->default_options_; + } + + inline bool options:: + default_options_specified () const + { + return this->default_options_specified_; + } + + inline const bool& options:: + no_default_options () const + { + return this->no_default_options_; + } + + inline const bool& options:: + help () const + { + return this->help_; + } + + inline const bool& options:: + version () const + { + return this->version_; + } +} + +// Begin epilogue. +// +// +// End epilogue. -- cgit v1.1