From 77f0b35782edcfad2c73cc75784b926c1e8b9a74 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 2 Sep 2022 21:22:18 +0300 Subject: Add odb and cli conditional build-time dependencies --- build/root.build | 26 +- manifest | 2 + mod/.gitignore | 2 +- mod/buildfile | 79 +- mod/pregenerated/mod/module-options.cxx | 9974 ++++++++++++++++++++++ mod/pregenerated/mod/module-options.hxx | 4546 ++++++++++ mod/pregenerated/mod/module-options.ixx | 3435 ++++++++ monitor/.gitignore | 4 +- monitor/buildfile | 70 +- monitor/pregenerated/monitor/module-options.cxx | 495 ++ monitor/pregenerated/monitor/module-options.hxx | 91 + monitor/pregenerated/monitor/module-options.ixx | 24 + monitor/pregenerated/monitor/monitor-options.cxx | 863 ++ monitor/pregenerated/monitor/monitor-options.hxx | 200 + monitor/pregenerated/monitor/monitor-options.ixx | 168 + repositories.manifest | 99 +- 16 files changed, 19996 insertions(+), 82 deletions(-) create mode 100644 mod/pregenerated/mod/module-options.cxx create mode 100644 mod/pregenerated/mod/module-options.hxx create mode 100644 mod/pregenerated/mod/module-options.ixx create mode 100644 monitor/pregenerated/monitor/module-options.cxx create mode 100644 monitor/pregenerated/monitor/module-options.hxx create mode 100644 monitor/pregenerated/monitor/module-options.ixx create mode 100644 monitor/pregenerated/monitor/monitor-options.cxx create mode 100644 monitor/pregenerated/monitor/monitor-options.hxx create mode 100644 monitor/pregenerated/monitor/monitor-options.ixx diff --git a/build/root.build b/build/root.build index 11c109f..cbbbe4b 100644 --- a/build/root.build +++ b/build/root.build @@ -1,6 +1,10 @@ # file : build/root.build # license : MIT; see accompanying LICENSE file +config [bool] config.brep.develop ?= false + +develop = $config.brep.develop + cxx.std = latest using cxx @@ -19,14 +23,6 @@ if ($cxx.id == 'gcc') cxx.poptions =+ "-I$out_root" "-I$src_root" -# Load the cli module but only if it's available. This way a distribution -# that includes pre-generated files can be built without installing cli. -# This is also the reason why we need to explicitly spell out individual -# source file prerequisites instead of using the cli.cxx{} group (it won't -# be there unless the module is configured). -# -using? cli - # Bash. # using bash @@ -35,6 +31,9 @@ brep/bash{*}: install.subdirs = true # Define commonly used target types. # +define cli: file +cli{*}: extension = cli + define css: file css{*}: extension = css @@ -56,7 +55,10 @@ test.target = $cxx.target # Extract the copyright notice from the LICENSE file. # -copyright = $process.run_regex( \ - cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+) \(see the AUTHORS and LEGAL files\)\.', \ - '\1') +# Note that cat is a builtin which means this is both portable and fast. +# +if ($build.mode != 'skeleton') + copyright = $process.run_regex( \ + cat $src_root/LICENSE, \ + 'Copyright \(c\) (.+) \(see the AUTHORS and LEGAL files\)\.', \ + '\1') diff --git a/manifest b/manifest index a9b9b06..7ef7f93 100644 --- a/manifest +++ b/manifest @@ -34,3 +34,5 @@ depends: libbpkg [0.16.0-a.0.1 0.16.0-a.1) depends: libbbot [0.16.0-a.0.1 0.16.0-a.1) depends: libbutl.bash [0.16.0-a.0.1 0.16.0-a.1) depends: bpkg-util [0.16.0-a.0.1 0.16.0-a.1) +depends: * cli ^1.2.0- ? ($config.brep.develop) +depends: * odb ^2.5.0- ? ($config.brep.develop) diff --git a/mod/.gitignore b/mod/.gitignore index 6b64ad0..619050a 100644 --- a/mod/.gitignore +++ b/mod/.gitignore @@ -1 +1 @@ -*-options.?xx +/*-options.?xx diff --git a/mod/buildfile b/mod/buildfile index 58a3caf..b5865cd 100644 --- a/mod/buildfile +++ b/mod/buildfile @@ -31,38 +31,73 @@ mod{brep}: {hxx ixx txx cxx}{* -module-options -{$libu_src}} \ libus{mod} ../libbrep/lib{brep} ../web/server/libus{web-server} \ $libs -{libue libus}{mod}: {hxx ixx cxx}{module-options} \ - {hxx ixx txx cxx}{+{$libu_src} } \ - $libs +{libue libus}{mod}: {hxx ixx txx cxx}{+{$libu_src}} $libs libus{mod}: ../web/xhtml/libus{xhtml} libue{mod}: ../web/xhtml/libue{xhtml} -# Generated options parser. +## Consumption build ($develop == false). +# + +# Use pregenerated versions in the consumption build. +# +{libue libus}{mod}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop) + +if! $develop + cxx.poptions =+ "-I($src_base/pregenerated)" + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{hxx ixx cxx}{*}: dist = (!$develop) + +# +## + +## Development build ($develop == true). # -if $cli.configured -{ - cli.cxx{module-options}: cli{module} +{libue libus}{mod}: {hxx ixx cxx}{module-options}: include = $develop + +if $develop + import! [metadata] cli = cli%exe{cli} + +# In the development build distribute regenerated +# {hxx ixx cxx}{module-options}, remapping their locations to the paths of the +# pregenerated versions (which are only distributed in the consumption build; +# see above). This way we make sure that the distributed files are always +# up-to-date. +# +<{hxx ixx cxx}{module-options}>: cli{module} $cli +{ # Set option prefix to the empty value to handle all unknown request # parameters uniformly with a single catch block. # - cli.options += --std c++11 -I $src_root --include-with-brackets \ ---include-prefix mod --guard-prefix MOD --generate-specifier \ ---cxx-prologue "#include " \ ---cli-namespace brep::cli --generate-file-scanner --option-length 46 \ ---generate-modifier --generate-description --option-prefix "" - - # Include the generated cli files into the distribution and don't remove - # them when cleaning in src (so that clean results in a state identical to - # distributed). - # - cli.cxx{*}: - { - dist = true - clean = ($src_root != $out_root) - } + options = --std c++11 -I $src_root --include-with-brackets \ + --include-prefix mod --guard-prefix MOD --generate-specifier \ + --cxx-prologue "#include " \ + --cli-namespace brep::cli --generate-file-scanner \ + --option-length 46 --generate-modifier --generate-description \ + --option-prefix "" --output-suffix "-options" } +% +if $develop +{{ + diag cli ($<[0]) + ($<[1]) $options -o $out_base/ $path($<[0]) + + if diff $src_base/pregenerated/mod/module-options.hxx $path($>[0]) >- && \ + diff $src_base/pregenerated/mod/module-options.ixx $path($>[1]) >- && \ + diff $src_base/pregenerated/mod/module-options.cxx $path($>[2]) >- + exit + end + + cp $path($>[0]) $src_base/pregenerated/mod/module-options.hxx + cp $path($>[1]) $src_base/pregenerated/mod/module-options.ixx + cp $path($>[2]) $src_base/pregenerated/mod/module-options.cxx +}} + +# +## # Don't install any of the module's headers. # diff --git a/mod/pregenerated/mod/module-options.cxx b/mod/pregenerated/mod/module-options.cxx new file mode 100644 index 0000000..33daa91 --- /dev/null +++ b/mod/pregenerated/mod/module-options.cxx @@ -0,0 +1,9974 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +// Begin prologue. +// +#include +// +// End prologue. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace brep +{ + namespace cli + { + // unknown_option + // + unknown_option:: + ~unknown_option () throw () + { + } + + void unknown_option:: + print (::std::ostream& os) const + { + os << "unknown option '" << option ().c_str () << "'"; + } + + const char* unknown_option:: + what () const throw () + { + return "unknown option"; + } + + // unknown_argument + // + unknown_argument:: + ~unknown_argument () throw () + { + } + + void unknown_argument:: + print (::std::ostream& os) const + { + os << "unknown argument '" << argument ().c_str () << "'"; + } + + const char* unknown_argument:: + what () const throw () + { + return "unknown argument"; + } + + // missing_value + // + missing_value:: + ~missing_value () throw () + { + } + + void missing_value:: + print (::std::ostream& os) const + { + os << "missing value for option '" << option ().c_str () << "'"; + } + + const char* missing_value:: + what () const throw () + { + return "missing option value"; + } + + // invalid_value + // + invalid_value:: + ~invalid_value () throw () + { + } + + void invalid_value:: + print (::std::ostream& os) const + { + os << "invalid value '" << value ().c_str () << "' for option '" + << option ().c_str () << "'"; + + if (!message ().empty ()) + os << ": " << message ().c_str (); + } + + const char* invalid_value:: + what () const throw () + { + return "invalid option value"; + } + + // eos_reached + // + void eos_reached:: + print (::std::ostream& os) const + { + os << what (); + } + + const char* eos_reached:: + what () const throw () + { + return "end of argument stream reached"; + } + + // file_io_failure + // + file_io_failure:: + ~file_io_failure () throw () + { + } + + void file_io_failure:: + print (::std::ostream& os) const + { + os << "unable to open file '" << file ().c_str () << "' or read failure"; + } + + const char* file_io_failure:: + what () const throw () + { + return "unable to open file or read failure"; + } + + // unmatched_quote + // + unmatched_quote:: + ~unmatched_quote () throw () + { + } + + void unmatched_quote:: + print (::std::ostream& os) const + { + os << "unmatched quote in argument '" << argument ().c_str () << "'"; + } + + const char* unmatched_quote:: + what () const throw () + { + return "unmatched quote"; + } + + // scanner + // + scanner:: + ~scanner () + { + } + + // argv_scanner + // + bool argv_scanner:: + more () + { + return i_ < argc_; + } + + const char* argv_scanner:: + peek () + { + if (i_ < argc_) + return argv_[i_]; + else + throw eos_reached (); + } + + const char* argv_scanner:: + next () + { + if (i_ < argc_) + { + const char* r (argv_[i_]); + + if (erase_) + { + for (int i (i_ + 1); i < argc_; ++i) + argv_[i - 1] = argv_[i]; + + --argc_; + argv_[argc_] = 0; + } + else + ++i_; + + ++start_position_; + return r; + } + else + throw eos_reached (); + } + + void argv_scanner:: + skip () + { + if (i_ < argc_) + { + ++i_; + ++start_position_; + } + else + throw eos_reached (); + } + + std::size_t argv_scanner:: + position () + { + return start_position_; + } + + // argv_file_scanner + // + int argv_file_scanner::zero_argc_ = 0; + std::string argv_file_scanner::empty_string_; + + bool argv_file_scanner:: + more () + { + if (!args_.empty ()) + return true; + + while (base::more ()) + { + // See if the next argument is the file option. + // + const char* a (base::peek ()); + const option_info* oi = 0; + const char* ov = 0; + + if (!skip_) + { + if ((oi = find (a)) != 0) + { + base::next (); + + if (!base::more ()) + throw missing_value (a); + + ov = base::next (); + } + } + + if (oi != 0) + { + if (oi->search_func != 0) + { + std::string f (oi->search_func (ov, oi->arg)); + + if (!f.empty ()) + load (f); + } + else + load (ov); + + if (!args_.empty ()) + return true; + } + else + { + if (!skip_) + skip_ = (std::strcmp (a, "--") == 0); + + return true; + } + } + + return false; + } + + const char* argv_file_scanner:: + peek () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? base::peek () : args_.front ().value.c_str (); + } + + const std::string& argv_file_scanner:: + peek_file () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? empty_string_ : *args_.front ().file; + } + + std::size_t argv_file_scanner:: + peek_line () + { + if (!more ()) + throw eos_reached (); + + return args_.empty () ? 0 : args_.front ().line; + } + + const char* argv_file_scanner:: + next () + { + if (!more ()) + throw eos_reached (); + + if (args_.empty ()) + return base::next (); + else + { + hold_[i_ == 0 ? ++i_ : --i_].swap (args_.front ().value); + args_.pop_front (); + ++start_position_; + return hold_[i_].c_str (); + } + } + + void argv_file_scanner:: + skip () + { + if (!more ()) + throw eos_reached (); + + if (args_.empty ()) + return base::skip (); + else + { + args_.pop_front (); + ++start_position_; + } + } + + const argv_file_scanner::option_info* argv_file_scanner:: + find (const char* a) const + { + for (std::size_t i (0); i < options_count_; ++i) + if (std::strcmp (a, options_[i].option) == 0) + return &options_[i]; + + return 0; + } + + std::size_t argv_file_scanner:: + position () + { + return start_position_; + } + + void argv_file_scanner:: + load (const std::string& file) + { + using namespace std; + + ifstream is (file.c_str ()); + + if (!is.is_open ()) + throw file_io_failure (file); + + files_.push_back (file); + + arg a; + a.file = &*files_.rbegin (); + + for (a.line = 1; !is.eof (); ++a.line) + { + string line; + getline (is, line); + + if (is.fail () && !is.eof ()) + throw file_io_failure (file); + + string::size_type n (line.size ()); + + // Trim the line from leading and trailing whitespaces. + // + if (n != 0) + { + const char* f (line.c_str ()); + const char* l (f + n); + + const char* of (f); + while (f < l && (*f == ' ' || *f == '\t' || *f == '\r')) + ++f; + + --l; + + const char* ol (l); + while (l > f && (*l == ' ' || *l == '\t' || *l == '\r')) + --l; + + if (f != of || l != ol) + line = f <= l ? string (f, l - f + 1) : string (); + } + + // Ignore empty lines, those that start with #. + // + if (line.empty () || line[0] == '#') + continue; + + string::size_type p (string::npos); + p = line.find (' '); + + string s1; + if (p != string::npos) + { + s1.assign (line, 0, p); + + // Skip leading whitespaces in the argument. + // + n = line.size (); + for (++p; p < n; ++p) + { + char c (line[p]); + if (c != ' ' && c != '\t' && c != '\r') + break; + } + } + else if (!skip_) + skip_ = (line == "--"); + + string s2 (line, p != string::npos ? p : 0); + + // If the string (which is an option value or argument) is + // wrapped in quotes, remove them. + // + n = s2.size (); + char cf (s2[0]), cl (s2[n - 1]); + + if (cf == '"' || cf == '\'' || cl == '"' || cl == '\'') + { + if (n == 1 || cf != cl) + throw unmatched_quote (s2); + + s2 = string (s2, 1, n - 2); + } + + if (!s1.empty ()) + { + // See if this is another file option. + // + const option_info* oi; + if (!skip_ && (oi = find (s1.c_str ()))) + { + if (s2.empty ()) + throw missing_value (oi->option); + + if (oi->search_func != 0) + { + string f (oi->search_func (s2.c_str (), oi->arg)); + if (!f.empty ()) + load (f); + } + else + { + // If the path of the file being parsed is not simple and the + // path of the file that needs to be loaded is relative, then + // complete the latter using the former as a base. + // +#ifndef _WIN32 + string::size_type p (file.find_last_of ('/')); + bool c (p != string::npos && s2[0] != '/'); +#else + string::size_type p (file.find_last_of ("/\\")); + bool c (p != string::npos && s2[1] != ':'); +#endif + if (c) + s2.insert (0, file, 0, p + 1); + + load (s2); + } + + continue; + } + + a.value = s1; + args_.push_back (a); + } + + a.value = s2; + args_.push_back (a); + } + } + + void options:: + push_back (const option& o) + { + container_type::size_type n (size ()); + container_type::push_back (o); + map_[o.name ()] = n; + + for (option_names::const_iterator i (o.aliases ().begin ()); + i != o.aliases ().end (); ++i) + map_[*i] = n; + } + + template + struct parser + { + static void + parse (X& x, bool& xs, scanner& s) + { + using namespace std; + + const char* o (s.next ()); + if (s.more ()) + { + string v (s.next ()); + istringstream is (v); + if (!(is >> x && is.peek () == istringstream::traits_type::eof ())) + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (bool& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + const char* v (s.next ()); + + if (std::strcmp (v, "1") == 0 || + std::strcmp (v, "true") == 0 || + std::strcmp (v, "TRUE") == 0 || + std::strcmp (v, "True") == 0) + x = true; + else if (std::strcmp (v, "0") == 0 || + std::strcmp (v, "false") == 0 || + std::strcmp (v, "FALSE") == 0 || + std::strcmp (v, "False") == 0) + x = false; + else + throw invalid_value (o, v); + } + else + throw missing_value (o); + + xs = true; + } + }; + + template <> + struct parser + { + static void + parse (std::string& x, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + x = s.next (); + else + throw missing_value (o); + + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::pair& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser::parse (x.first, xs, s); + } + }; + + template + struct parser > + { + static void + parse (std::vector& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.push_back (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::set& c, bool& xs, scanner& s) + { + X x; + bool dummy; + parser::parse (x, dummy, s); + c.insert (x); + xs = true; + } + }; + + template + struct parser > + { + static void + parse (std::map& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser::parse (v, dummy, s); + } + + m[k] = v; + } + else + throw missing_value (o); + + xs = true; + } + }; + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, s); + } + + template + void + thunk (X& x, scanner& s) + { + s.next (); + x.*M = true; + } + + template + void + thunk (X& x, scanner& s) + { + parser::parse (x.*M, x.*S, s); + } + } +} + +#include + +namespace brep +{ + namespace options + { + // handler + // + + handler:: + handler () + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + } + + handler:: + handler (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + handler:: + handler (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + handler:: + handler (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + handler:: + handler (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + handler:: + handler (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : email_ (), + email_specified_ (false), + host_ (), + host_specified_ (false), + root_ ("/"), + root_specified_ (false), + tenant_name_ ("tenant"), + tenant_name_specified_ (false), + verbosity_ (0), + verbosity_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para handler:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "email Repository email." << ::std::endl; + + os << "host Repository host." << ::std::endl; + + os << "root Repository root." << ::std::endl; + + os << "tenant-name Name to call the tenant values" << ::std::endl + << " on web pages." << ::std::endl; + + os << "verbosity Trace verbosity level." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_handler_desc_type: ::brep::cli::options + { + _cli_handler_desc_type () + { + ::brep::options::handler::fill (*this); + } + }; + + void handler:: + fill (::brep::cli::options& os) + { + // email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("email", a, false, dv); + os.push_back (o); + } + + // host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("host", a, false, dv); + os.push_back (o); + } + + // root + // + { + ::brep::cli::option_names a; + std::string dv ("/"); + ::brep::cli::option o ("root", a, false, dv); + os.push_back (o); + } + + // tenant-name + // + { + ::brep::cli::option_names a; + std::string dv ("tenant"); + ::brep::cli::option o ("tenant-name", a, false, dv); + os.push_back (o); + } + + // verbosity + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("verbosity", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& handler:: + description () + { + static _cli_handler_desc_type _cli_handler_desc_; + return _cli_handler_desc_; + } + + typedef + std::map + _cli_handler_map; + + static _cli_handler_map _cli_handler_map_; + + struct _cli_handler_map_init + { + _cli_handler_map_init () + { + _cli_handler_map_["email"] = + &::brep::cli::thunk< handler, string, &handler::email_, + &handler::email_specified_ >; + _cli_handler_map_["host"] = + &::brep::cli::thunk< handler, string, &handler::host_, + &handler::host_specified_ >; + _cli_handler_map_["root"] = + &::brep::cli::thunk< handler, dir_path, &handler::root_, + &handler::root_specified_ >; + _cli_handler_map_["tenant-name"] = + &::brep::cli::thunk< handler, string, &handler::tenant_name_, + &handler::tenant_name_specified_ >; + _cli_handler_map_["verbosity"] = + &::brep::cli::thunk< handler, uint16_t, &handler::verbosity_, + &handler::verbosity_specified_ >; + } + }; + + static _cli_handler_map_init _cli_handler_map_init_; + + bool handler:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_handler_map::const_iterator i (_cli_handler_map_.find (o)); + + if (i != _cli_handler_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool handler:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // openssl_options + // + + openssl_options:: + openssl_options () + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + } + + openssl_options:: + openssl_options (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + openssl_options:: + openssl_options (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + openssl_options:: + openssl_options (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + openssl_options:: + openssl_options (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + openssl_options:: + openssl_options (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : openssl_ ("openssl"), + openssl_specified_ (false), + openssl_option_ (), + openssl_option_specified_ (false), + openssl_envvar_ (), + openssl_envvar_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para openssl_options:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "openssl The openssl program to be used" << ::std::endl + << " for crypto operations." << ::std::endl; + + os << "openssl-option Additional option to be passed" << ::std::endl + << " to the openssl program (see" << ::std::endl + << " openssl for details)." << ::std::endl; + + os << "openssl-envvar [=value] Environment variable to be set" << ::std::endl + << " (=) or unset (just" << ::std::endl + << " ) for the openssl program" << ::std::endl + << " (see openssl for details)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_openssl_options_desc_type: ::brep::cli::options + { + _cli_openssl_options_desc_type () + { + ::brep::options::openssl_options::fill (*this); + } + }; + + void openssl_options:: + fill (::brep::cli::options& os) + { + // openssl + // + { + ::brep::cli::option_names a; + std::string dv ("openssl"); + ::brep::cli::option o ("openssl", a, false, dv); + os.push_back (o); + } + + // openssl-option + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("openssl-option", a, false, dv); + os.push_back (o); + } + + // openssl-envvar + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("openssl-envvar", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& openssl_options:: + description () + { + static _cli_openssl_options_desc_type _cli_openssl_options_desc_; + return _cli_openssl_options_desc_; + } + + typedef + std::map + _cli_openssl_options_map; + + static _cli_openssl_options_map _cli_openssl_options_map_; + + struct _cli_openssl_options_map_init + { + _cli_openssl_options_map_init () + { + _cli_openssl_options_map_["openssl"] = + &::brep::cli::thunk< openssl_options, path, &openssl_options::openssl_, + &openssl_options::openssl_specified_ >; + _cli_openssl_options_map_["openssl-option"] = + &::brep::cli::thunk< openssl_options, strings, &openssl_options::openssl_option_, + &openssl_options::openssl_option_specified_ >; + _cli_openssl_options_map_["openssl-envvar"] = + &::brep::cli::thunk< openssl_options, strings, &openssl_options::openssl_envvar_, + &openssl_options::openssl_envvar_specified_ >; + } + }; + + static _cli_openssl_options_map_init _cli_openssl_options_map_init_; + + bool openssl_options:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_openssl_options_map::const_iterator i (_cli_openssl_options_map_.find (o)); + + if (i != _cli_openssl_options_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool openssl_options:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_db + // + + package_db:: + package_db () + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + } + + package_db:: + package_db (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_db:: + package_db (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_db:: + package_db (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_db:: + package_db (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_db:: + package_db (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_db_user_ (), + package_db_user_specified_ (false), + package_db_role_ ("brep"), + package_db_role_specified_ (false), + package_db_password_ (), + package_db_password_specified_ (false), + package_db_name_ ("brep_package"), + package_db_name_specified_ (false), + package_db_host_ (), + package_db_host_specified_ (false), + package_db_port_ (0), + package_db_port_specified_ (false), + package_db_max_connections_ (5), + package_db_max_connections_specified_ (false), + package_db_retry_ (10), + package_db_retry_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_db:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package-db-user Package database login user" << ::std::endl + << " name." << ::std::endl; + + os << "package-db-role Package database execution user" << ::std::endl + << " name." << ::std::endl; + + os << "package-db-password Package database password." << ::std::endl; + + os << "package-db-name Package database name." << ::std::endl; + + os << "package-db-host Package database host name," << ::std::endl + << " address, or socket." << ::std::endl; + + os << "package-db-port Package database port number." << ::std::endl; + + os << "package-db-max-connections The maximum number of concurrent" << ::std::endl + << " package database connections per" << ::std::endl + << " web server process." << ::std::endl; + + os << "package-db-retry The maximum number of times to" << ::std::endl + << " retry package database" << ::std::endl + << " transactions in the face of" << ::std::endl + << " recoverable failures (deadlock," << ::std::endl + << " loss of connection, etc)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_db_desc_type: ::brep::cli::options + { + _cli_package_db_desc_type () + { + ::brep::options::package_db::fill (*this); + } + }; + + void package_db:: + fill (::brep::cli::options& os) + { + // package-db-user + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-user", a, false, dv); + os.push_back (o); + } + + // package-db-role + // + { + ::brep::cli::option_names a; + std::string dv ("brep"); + ::brep::cli::option o ("package-db-role", a, false, dv); + os.push_back (o); + } + + // package-db-password + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-password", a, false, dv); + os.push_back (o); + } + + // package-db-name + // + { + ::brep::cli::option_names a; + std::string dv ("brep_package"); + ::brep::cli::option o ("package-db-name", a, false, dv); + os.push_back (o); + } + + // package-db-host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package-db-host", a, false, dv); + os.push_back (o); + } + + // package-db-port + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("package-db-port", a, false, dv); + os.push_back (o); + } + + // package-db-max-connections + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("package-db-max-connections", a, false, dv); + os.push_back (o); + } + + // package-db-retry + // + { + ::brep::cli::option_names a; + std::string dv ("10"); + ::brep::cli::option o ("package-db-retry", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_db:: + description () + { + static _cli_package_db_desc_type _cli_package_db_desc_; + return _cli_package_db_desc_; + } + + typedef + std::map + _cli_package_db_map; + + static _cli_package_db_map _cli_package_db_map_; + + struct _cli_package_db_map_init + { + _cli_package_db_map_init () + { + _cli_package_db_map_["package-db-user"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_user_, + &package_db::package_db_user_specified_ >; + _cli_package_db_map_["package-db-role"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_role_, + &package_db::package_db_role_specified_ >; + _cli_package_db_map_["package-db-password"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_password_, + &package_db::package_db_password_specified_ >; + _cli_package_db_map_["package-db-name"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_name_, + &package_db::package_db_name_specified_ >; + _cli_package_db_map_["package-db-host"] = + &::brep::cli::thunk< package_db, string, &package_db::package_db_host_, + &package_db::package_db_host_specified_ >; + _cli_package_db_map_["package-db-port"] = + &::brep::cli::thunk< package_db, uint16_t, &package_db::package_db_port_, + &package_db::package_db_port_specified_ >; + _cli_package_db_map_["package-db-max-connections"] = + &::brep::cli::thunk< package_db, size_t, &package_db::package_db_max_connections_, + &package_db::package_db_max_connections_specified_ >; + _cli_package_db_map_["package-db-retry"] = + &::brep::cli::thunk< package_db, size_t, &package_db::package_db_retry_, + &package_db::package_db_retry_specified_ >; + } + }; + + static _cli_package_db_map_init _cli_package_db_map_init_; + + bool package_db:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_db_map::const_iterator i (_cli_package_db_map_.find (o)); + + if (i != _cli_package_db_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_db:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build + // + + build:: + build () + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + } + + build:: + build (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build:: + build (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build:: + build (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build:: + build (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build:: + build (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_ (), + build_config_specified_ (false), + build_bot_agent_keys_ (), + build_bot_agent_keys_specified_ (false), + build_forced_rebuild_timeout_ (600), + build_forced_rebuild_timeout_specified_ (false), + build_soft_rebuild_timeout_ (86400), + build_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_timeout_ (), + build_alt_soft_rebuild_timeout_specified_ (false), + build_alt_soft_rebuild_start_ (), + build_alt_soft_rebuild_start_specified_ (false), + build_alt_soft_rebuild_stop_ (), + build_alt_soft_rebuild_stop_specified_ (false), + build_hard_rebuild_timeout_ (604800), + build_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_timeout_ (), + build_alt_hard_rebuild_timeout_specified_ (false), + build_alt_hard_rebuild_start_ (), + build_alt_hard_rebuild_start_specified_ (false), + build_alt_hard_rebuild_stop_ (), + build_alt_hard_rebuild_stop_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // openssl_options base + // + p = ::brep::options::openssl_options::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-config Build configuration file." << ::std::endl; + + os << "build-bot-agent-keys Directory containing build bot" << ::std::endl + << " agent public keys." << ::std::endl; + + os << "build-forced-rebuild-timeout Time to wait before considering" << ::std::endl + << " a package for a forced rebuild." << ::std::endl; + + os << "build-soft-rebuild-timeout Time to wait before considering" << ::std::endl + << " a package for a soft rebuild" << ::std::endl + << " (only to be performed if the" << ::std::endl + << " build environment or any of the" << ::std::endl + << " package dependencies have" << ::std::endl + << " changed)." << ::std::endl; + + os << "build-alt-soft-rebuild-timeout Alternative package soft rebuild" << ::std::endl + << " timeout to use instead of the" << ::std::endl + << " soft rebuild timeout (see" << ::std::endl + << " build-soft-rebuild-timeout for" << ::std::endl + << " details) during the time" << ::std::endl + << " interval specified with the" << ::std::endl + << " build-alt-soft-rebuild-start and" << ::std::endl + << " build-alt-soft-rebuild-stop" << ::std::endl + << " options." << ::std::endl; + + os << "build-alt-soft-rebuild-start : The start time of the" << ::std::endl + << " alternative package soft rebuild" << ::std::endl + << " timeout (see" << ::std::endl + << " build-alt-soft-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-alt-soft-rebuild-stop : The end time of the alternative" << ::std::endl + << " package soft rebuild timeout" << ::std::endl + << " (see" << ::std::endl + << " build-alt-soft-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-hard-rebuild-timeout Time to wait before considering" << ::std::endl + << " a package for a hard rebuild (to" << ::std::endl + << " be performed unconditionally)." << ::std::endl; + + os << "build-alt-hard-rebuild-timeout Alternative package hard rebuild" << ::std::endl + << " timeout." << ::std::endl; + + os << "build-alt-hard-rebuild-start : The start time of the" << ::std::endl + << " alternative package hard rebuild" << ::std::endl + << " timeout (see" << ::std::endl + << " build-alt-hard-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + os << "build-alt-hard-rebuild-stop : The end time of the alternative" << ::std::endl + << " package hard rebuild timeout" << ::std::endl + << " (see" << ::std::endl + << " build-alt-hard-rebuild-timeout" << ::std::endl + << " for details)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_desc_type: ::brep::cli::options + { + _cli_build_desc_type () + { + ::brep::options::build::fill (*this); + } + }; + + void build:: + fill (::brep::cli::options& os) + { + // openssl_options base + // + ::brep::options::openssl_options::fill (os); + + // build-config + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-config", a, false, dv); + os.push_back (o); + } + + // build-bot-agent-keys + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-bot-agent-keys", a, false, dv); + os.push_back (o); + } + + // build-forced-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("600"); + ::brep::cli::option o ("build-forced-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-soft-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("86400"); + ::brep::cli::option o ("build-soft-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-start + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-start", a, false, dv); + os.push_back (o); + } + + // build-alt-soft-rebuild-stop + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-soft-rebuild-stop", a, false, dv); + os.push_back (o); + } + + // build-hard-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("604800"); + ::brep::cli::option o ("build-hard-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-timeout", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-start + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-start", a, false, dv); + os.push_back (o); + } + + // build-alt-hard-rebuild-stop + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-alt-hard-rebuild-stop", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build:: + description () + { + static _cli_build_desc_type _cli_build_desc_; + return _cli_build_desc_; + } + + typedef + std::map + _cli_build_map; + + static _cli_build_map _cli_build_map_; + + struct _cli_build_map_init + { + _cli_build_map_init () + { + _cli_build_map_["build-config"] = + &::brep::cli::thunk< build, path, &build::build_config_, + &build::build_config_specified_ >; + _cli_build_map_["build-bot-agent-keys"] = + &::brep::cli::thunk< build, dir_path, &build::build_bot_agent_keys_, + &build::build_bot_agent_keys_specified_ >; + _cli_build_map_["build-forced-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_forced_rebuild_timeout_, + &build::build_forced_rebuild_timeout_specified_ >; + _cli_build_map_["build-soft-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_soft_rebuild_timeout_, + &build::build_soft_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_alt_soft_rebuild_timeout_, + &build::build_alt_soft_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-start"] = + &::brep::cli::thunk< build, duration, &build::build_alt_soft_rebuild_start_, + &build::build_alt_soft_rebuild_start_specified_ >; + _cli_build_map_["build-alt-soft-rebuild-stop"] = + &::brep::cli::thunk< build, duration, &build::build_alt_soft_rebuild_stop_, + &build::build_alt_soft_rebuild_stop_specified_ >; + _cli_build_map_["build-hard-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_hard_rebuild_timeout_, + &build::build_hard_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-timeout"] = + &::brep::cli::thunk< build, size_t, &build::build_alt_hard_rebuild_timeout_, + &build::build_alt_hard_rebuild_timeout_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-start"] = + &::brep::cli::thunk< build, duration, &build::build_alt_hard_rebuild_start_, + &build::build_alt_hard_rebuild_start_specified_ >; + _cli_build_map_["build-alt-hard-rebuild-stop"] = + &::brep::cli::thunk< build, duration, &build::build_alt_hard_rebuild_stop_, + &build::build_alt_hard_rebuild_stop_specified_ >; + } + }; + + static _cli_build_map_init _cli_build_map_init_; + + bool build:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_map::const_iterator i (_cli_build_map_.find (o)); + + if (i != _cli_build_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // openssl_options base + // + if (::brep::options::openssl_options::_parse (o, s)) + return true; + + return false; + } + + bool build:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_db + // + + build_db:: + build_db () + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + } + + build_db:: + build_db (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_db:: + build_db (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_db:: + build_db (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_db:: + build_db (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_db:: + build_db (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_db_user_ (), + build_db_user_specified_ (false), + build_db_role_ ("brep"), + build_db_role_specified_ (false), + build_db_password_ (), + build_db_password_specified_ (false), + build_db_name_ ("brep_build"), + build_db_name_specified_ (false), + build_db_host_ (), + build_db_host_specified_ (false), + build_db_port_ (0), + build_db_port_specified_ (false), + build_db_max_connections_ (5), + build_db_max_connections_specified_ (false), + build_db_retry_ (10), + build_db_retry_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_db:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-db-user Build database login user name." << ::std::endl; + + os << "build-db-role Build database execution user" << ::std::endl + << " name." << ::std::endl; + + os << "build-db-password Build database password." << ::std::endl; + + os << "build-db-name Build database name." << ::std::endl; + + os << "build-db-host Build database host name," << ::std::endl + << " address, or socket." << ::std::endl; + + os << "build-db-port Build database port number." << ::std::endl; + + os << "build-db-max-connections The maximum number of concurrent" << ::std::endl + << " build database connections per" << ::std::endl + << " web server process." << ::std::endl; + + os << "build-db-retry The maximum number of times to" << ::std::endl + << " retry build database" << ::std::endl + << " transactions in the face of" << ::std::endl + << " recoverable failures (deadlock," << ::std::endl + << " loss of connection, etc)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_db_desc_type: ::brep::cli::options + { + _cli_build_db_desc_type () + { + ::brep::options::build_db::fill (*this); + } + }; + + void build_db:: + fill (::brep::cli::options& os) + { + // build-db-user + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-user", a, false, dv); + os.push_back (o); + } + + // build-db-role + // + { + ::brep::cli::option_names a; + std::string dv ("brep"); + ::brep::cli::option o ("build-db-role", a, false, dv); + os.push_back (o); + } + + // build-db-password + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-password", a, false, dv); + os.push_back (o); + } + + // build-db-name + // + { + ::brep::cli::option_names a; + std::string dv ("brep_build"); + ::brep::cli::option o ("build-db-name", a, false, dv); + os.push_back (o); + } + + // build-db-host + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-db-host", a, false, dv); + os.push_back (o); + } + + // build-db-port + // + { + ::brep::cli::option_names a; + std::string dv ("0"); + ::brep::cli::option o ("build-db-port", a, false, dv); + os.push_back (o); + } + + // build-db-max-connections + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-db-max-connections", a, false, dv); + os.push_back (o); + } + + // build-db-retry + // + { + ::brep::cli::option_names a; + std::string dv ("10"); + ::brep::cli::option o ("build-db-retry", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_db:: + description () + { + static _cli_build_db_desc_type _cli_build_db_desc_; + return _cli_build_db_desc_; + } + + typedef + std::map + _cli_build_db_map; + + static _cli_build_db_map _cli_build_db_map_; + + struct _cli_build_db_map_init + { + _cli_build_db_map_init () + { + _cli_build_db_map_["build-db-user"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_user_, + &build_db::build_db_user_specified_ >; + _cli_build_db_map_["build-db-role"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_role_, + &build_db::build_db_role_specified_ >; + _cli_build_db_map_["build-db-password"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_password_, + &build_db::build_db_password_specified_ >; + _cli_build_db_map_["build-db-name"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_name_, + &build_db::build_db_name_specified_ >; + _cli_build_db_map_["build-db-host"] = + &::brep::cli::thunk< build_db, string, &build_db::build_db_host_, + &build_db::build_db_host_specified_ >; + _cli_build_db_map_["build-db-port"] = + &::brep::cli::thunk< build_db, uint16_t, &build_db::build_db_port_, + &build_db::build_db_port_specified_ >; + _cli_build_db_map_["build-db-max-connections"] = + &::brep::cli::thunk< build_db, size_t, &build_db::build_db_max_connections_, + &build_db::build_db_max_connections_specified_ >; + _cli_build_db_map_["build-db-retry"] = + &::brep::cli::thunk< build_db, size_t, &build_db::build_db_retry_, + &build_db::build_db_retry_specified_ >; + } + }; + + static _cli_build_db_map_init _cli_build_db_map_init_; + + bool build_db:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_db_map::const_iterator i (_cli_build_db_map_.find (o)); + + if (i != _cli_build_db_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_db:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // page + // + + page:: + page () + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + } + + page:: + page (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + page:: + page (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + page:: + page (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + page:: + page (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + page:: + page (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : logo_ (), + logo_specified_ (false), + menu_ (), + menu_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para page:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "logo Web page logo." << ::std::endl; + + os << "menu Web page menu." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_page_desc_type: ::brep::cli::options + { + _cli_page_desc_type () + { + ::brep::options::page::fill (*this); + } + }; + + void page:: + fill (::brep::cli::options& os) + { + // logo + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("logo", a, false, dv); + os.push_back (o); + } + + // menu + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("menu", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& page:: + description () + { + static _cli_page_desc_type _cli_page_desc_; + return _cli_page_desc_; + } + + typedef + std::map + _cli_page_map; + + static _cli_page_map _cli_page_map_; + + struct _cli_page_map_init + { + _cli_page_map_init () + { + _cli_page_map_["logo"] = + &::brep::cli::thunk< page, web::xhtml::fragment, &page::logo_, + &page::logo_specified_ >; + _cli_page_map_["menu"] = + &::brep::cli::thunk< page, vector, &page::menu_, + &page::menu_specified_ >; + } + }; + + static _cli_page_map_init _cli_page_map_init_; + + bool page:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_page_map::const_iterator i (_cli_page_map_.find (o)); + + if (i != _cli_page_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool page:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // search + // + + search:: + search () + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + } + + search:: + search (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + search:: + search (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + search:: + search (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + search:: + search (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + search:: + search (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_page_entries_ (20), + search_page_entries_specified_ (false), + search_pages_ (5), + search_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para search:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "search-page-entries Number of packages per page." << ::std::endl; + + os << "search-pages Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_search_desc_type: ::brep::cli::options + { + _cli_search_desc_type () + { + ::brep::options::search::fill (*this); + } + }; + + void search:: + fill (::brep::cli::options& os) + { + // search-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("search-page-entries", a, false, dv); + os.push_back (o); + } + + // search-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("search-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& search:: + description () + { + static _cli_search_desc_type _cli_search_desc_; + return _cli_search_desc_; + } + + typedef + std::map + _cli_search_map; + + static _cli_search_map _cli_search_map_; + + struct _cli_search_map_init + { + _cli_search_map_init () + { + _cli_search_map_["search-page-entries"] = + &::brep::cli::thunk< search, uint16_t, &search::search_page_entries_, + &search::search_page_entries_specified_ >; + _cli_search_map_["search-pages"] = + &::brep::cli::thunk< search, uint16_t, &search::search_pages_, + &search::search_pages_specified_ >; + } + }; + + static _cli_search_map_init _cli_search_map_init_; + + bool search:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_search_map::const_iterator i (_cli_search_map_.find (o)); + + if (i != _cli_search_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool search:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package + // + + package:: + package () + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + } + + package:: + package (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package:: + package (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package:: + package (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package:: + package (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package:: + package (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_description_ (500), + package_description_specified_ (false), + package_changes_ (5000), + package_changes_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package-description Number of package description" << ::std::endl + << " characters to display in brief" << ::std::endl + << " pages." << ::std::endl; + + os << "package-changes Number of package changes" << ::std::endl + << " characters to display in brief" << ::std::endl + << " pages." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_desc_type: ::brep::cli::options + { + _cli_package_desc_type () + { + ::brep::options::package::fill (*this); + } + }; + + void package:: + fill (::brep::cli::options& os) + { + // package-description + // + { + ::brep::cli::option_names a; + std::string dv ("500"); + ::brep::cli::option o ("package-description", a, false, dv); + os.push_back (o); + } + + // package-changes + // + { + ::brep::cli::option_names a; + std::string dv ("5000"); + ::brep::cli::option o ("package-changes", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package:: + description () + { + static _cli_package_desc_type _cli_package_desc_; + return _cli_package_desc_; + } + + typedef + std::map + _cli_package_map; + + static _cli_package_map _cli_package_map_; + + struct _cli_package_map_init + { + _cli_package_map_init () + { + _cli_package_map_["package-description"] = + &::brep::cli::thunk< package, uint16_t, &package::package_description_, + &package::package_description_specified_ >; + _cli_package_map_["package-changes"] = + &::brep::cli::thunk< package, uint16_t, &package::package_changes_, + &package::package_changes_specified_ >; + } + }; + + static _cli_package_map_init _cli_package_map_init_; + + bool package:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_map::const_iterator i (_cli_package_map_.find (o)); + + if (i != _cli_package_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // packages + // + + packages:: + packages () + : search_title_ ("Packages"), + search_title_specified_ (false) + { + } + + packages:: + packages (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : search_title_ ("Packages"), + search_title_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para packages:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // search base + // + p = ::brep::options::search::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "search-title Package search page title." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_packages_desc_type: ::brep::cli::options + { + _cli_packages_desc_type () + { + ::brep::options::packages::fill (*this); + } + }; + + void packages:: + fill (::brep::cli::options& os) + { + // search base + // + ::brep::options::search::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // search-title + // + { + ::brep::cli::option_names a; + std::string dv ("Packages"); + ::brep::cli::option o ("search-title", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& packages:: + description () + { + static _cli_packages_desc_type _cli_packages_desc_; + return _cli_packages_desc_; + } + + typedef + std::map + _cli_packages_map; + + static _cli_packages_map _cli_packages_map_; + + struct _cli_packages_map_init + { + _cli_packages_map_init () + { + _cli_packages_map_["search-title"] = + &::brep::cli::thunk< packages, string, &packages::search_title_, + &packages::search_title_specified_ >; + } + }; + + static _cli_packages_map_init _cli_packages_map_init_; + + bool packages:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_packages_map::const_iterator i (_cli_packages_map_.find (o)); + + if (i != _cli_packages_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // search base + // + if (::brep::options::search::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool packages:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_details + // + + package_details:: + package_details () + { + } + + package_details:: + package_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package base + // + p = ::brep::options::package::print_usage (os, p); + + // search base + // + p = ::brep::options::search::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_package_details_desc_type: ::brep::cli::options + { + _cli_package_details_desc_type () + { + ::brep::options::package_details::fill (*this); + } + }; + + void package_details:: + fill (::brep::cli::options& os) + { + // package base + // + ::brep::options::package::fill (os); + + // search base + // + ::brep::options::search::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& package_details:: + description () + { + static _cli_package_details_desc_type _cli_package_details_desc_; + return _cli_package_details_desc_; + } + + typedef + std::map + _cli_package_details_map; + + static _cli_package_details_map _cli_package_details_map_; + + struct _cli_package_details_map_init + { + _cli_package_details_map_init () + { + } + }; + + static _cli_package_details_map_init _cli_package_details_map_init_; + + bool package_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_details_map::const_iterator i (_cli_package_details_map_.find (o)); + + if (i != _cli_package_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package base + // + if (::brep::options::package::_parse (o, s)) + return true; + + // search base + // + if (::brep::options::search::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool package_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_version_details + // + + package_version_details:: + package_version_details () + { + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_version_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package base + // + p = ::brep::options::package::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_package_version_details_desc_type: ::brep::cli::options + { + _cli_package_version_details_desc_type () + { + ::brep::options::package_version_details::fill (*this); + } + }; + + void package_version_details:: + fill (::brep::cli::options& os) + { + // package base + // + ::brep::options::package::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& package_version_details:: + description () + { + static _cli_package_version_details_desc_type _cli_package_version_details_desc_; + return _cli_package_version_details_desc_; + } + + typedef + std::map + _cli_package_version_details_map; + + static _cli_package_version_details_map _cli_package_version_details_map_; + + struct _cli_package_version_details_map_init + { + _cli_package_version_details_map_init () + { + } + }; + + static _cli_package_version_details_map_init _cli_package_version_details_map_init_; + + bool package_version_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_version_details_map::const_iterator i (_cli_package_version_details_map_.find (o)); + + if (i != _cli_package_version_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package base + // + if (::brep::options::package::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool package_version_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_details + // + + repository_details:: + repository_details () + { + } + + repository_details:: + repository_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_repository_details_desc_type: ::brep::cli::options + { + _cli_repository_details_desc_type () + { + ::brep::options::repository_details::fill (*this); + } + }; + + void repository_details:: + fill (::brep::cli::options& os) + { + // package_db base + // + ::brep::options::package_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& repository_details:: + description () + { + static _cli_repository_details_desc_type _cli_repository_details_desc_; + return _cli_repository_details_desc_; + } + + typedef + std::map + _cli_repository_details_map; + + static _cli_repository_details_map _cli_repository_details_map_; + + struct _cli_repository_details_map_init + { + _cli_repository_details_map_init () + { + } + }; + + static _cli_repository_details_map_init _cli_repository_details_map_init_; + + bool repository_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_details_map::const_iterator i (_cli_repository_details_map_.find (o)); + + if (i != _cli_repository_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool repository_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_task + // + + build_task:: + build_task () + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + } + + build_task:: + build_task (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_task_request_max_size_ (102400), + build_task_request_max_size_specified_ (false), + build_result_timeout_ (10800), + build_result_timeout_specified_ (false), + build_interactive_login_ (), + build_interactive_login_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_task:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-task-request-max-size The maximum size of the build" << ::std::endl + << " task request manifest accepted." << ::std::endl; + + os << "build-result-timeout Time to wait before considering" << ::std::endl + << " the expected task result lost." << ::std::endl; + + os << "build-interactive-login Regular expressions for" << ::std::endl + << " transforming the interactive" << ::std::endl + << " build login information, for" << ::std::endl + << " example, into the actual command" << ::std::endl + << " that can be used by the user." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_task_desc_type: ::brep::cli::options + { + _cli_build_task_desc_type () + { + ::brep::options::build_task::fill (*this); + } + }; + + void build_task:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-task-request-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("102400"); + ::brep::cli::option o ("build-task-request-max-size", a, false, dv); + os.push_back (o); + } + + // build-result-timeout + // + { + ::brep::cli::option_names a; + std::string dv ("10800"); + ::brep::cli::option o ("build-result-timeout", a, false, dv); + os.push_back (o); + } + + // build-interactive-login + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-interactive-login", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_task:: + description () + { + static _cli_build_task_desc_type _cli_build_task_desc_; + return _cli_build_task_desc_; + } + + typedef + std::map + _cli_build_task_map; + + static _cli_build_task_map _cli_build_task_map_; + + struct _cli_build_task_map_init + { + _cli_build_task_map_init () + { + _cli_build_task_map_["build-task-request-max-size"] = + &::brep::cli::thunk< build_task, size_t, &build_task::build_task_request_max_size_, + &build_task::build_task_request_max_size_specified_ >; + _cli_build_task_map_["build-result-timeout"] = + &::brep::cli::thunk< build_task, size_t, &build_task::build_result_timeout_, + &build_task::build_result_timeout_specified_ >; + _cli_build_task_map_["build-interactive-login"] = + &::brep::cli::thunk< build_task, vector>, &build_task::build_interactive_login_, + &build_task::build_interactive_login_specified_ >; + } + }; + + static _cli_build_task_map_init _cli_build_task_map_init_; + + bool build_task:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_task_map::const_iterator i (_cli_build_task_map_.find (o)); + + if (i != _cli_build_task_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_task:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_result + // + + build_result:: + build_result () + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + } + + build_result:: + build_result (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_result_request_max_size_ (10240000), + build_result_request_max_size_specified_ (false), + build_toolchain_email_ (), + build_toolchain_email_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_result:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // package_db base + // + p = ::brep::options::package_db::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-result-request-max-size The maximum size of the build" << ::std::endl + << " result manifest accepted." << ::std::endl; + + os << "build-toolchain-email = Enable or disable package build" << ::std::endl + << " notification emails." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_result_desc_type: ::brep::cli::options + { + _cli_build_result_desc_type () + { + ::brep::options::build_result::fill (*this); + } + }; + + void build_result:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // package_db base + // + ::brep::options::package_db::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-result-request-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("10240000"); + ::brep::cli::option o ("build-result-request-max-size", a, false, dv); + os.push_back (o); + } + + // build-toolchain-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("build-toolchain-email", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_result:: + description () + { + static _cli_build_result_desc_type _cli_build_result_desc_; + return _cli_build_result_desc_; + } + + typedef + std::map + _cli_build_result_map; + + static _cli_build_result_map _cli_build_result_map_; + + struct _cli_build_result_map_init + { + _cli_build_result_map_init () + { + _cli_build_result_map_["build-result-request-max-size"] = + &::brep::cli::thunk< build_result, size_t, &build_result::build_result_request_max_size_, + &build_result::build_result_request_max_size_specified_ >; + _cli_build_result_map_["build-toolchain-email"] = + &::brep::cli::thunk< build_result, std::map, &build_result::build_toolchain_email_, + &build_result::build_toolchain_email_specified_ >; + } + }; + + static _cli_build_result_map_init _cli_build_result_map_init_; + + bool build_result:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_result_map::const_iterator i (_cli_build_result_map_.find (o)); + + if (i != _cli_build_result_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // package_db base + // + if (::brep::options::package_db::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_result:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_log + // + + build_log:: + build_log () + { + } + + build_log:: + build_log (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_log:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_build_log_desc_type: ::brep::cli::options + { + _cli_build_log_desc_type () + { + ::brep::options::build_log::fill (*this); + } + }; + + void build_log:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& build_log:: + description () + { + static _cli_build_log_desc_type _cli_build_log_desc_; + return _cli_build_log_desc_; + } + + typedef + std::map + _cli_build_log_map; + + static _cli_build_log_map _cli_build_log_map_; + + struct _cli_build_log_map_init + { + _cli_build_log_map_init () + { + } + }; + + static _cli_build_log_map_init _cli_build_log_map_init_; + + bool build_log:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_log_map::const_iterator i (_cli_build_log_map_.find (o)); + + if (i != _cli_build_log_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_log:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_force + // + + build_force:: + build_force () + { + } + + build_force:: + build_force (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_force:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + return p; + } + + struct _cli_build_force_desc_type: ::brep::cli::options + { + _cli_build_force_desc_type () + { + ::brep::options::build_force::fill (*this); + } + }; + + void build_force:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + } + + const ::brep::cli::options& build_force:: + description () + { + static _cli_build_force_desc_type _cli_build_force_desc_; + return _cli_build_force_desc_; + } + + typedef + std::map + _cli_build_force_map; + + static _cli_build_force_map _cli_build_force_map_; + + struct _cli_build_force_map_init + { + _cli_build_force_map_init () + { + } + }; + + static _cli_build_force_map_init _cli_build_force_map_init_; + + bool build_force:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_force_map::const_iterator i (_cli_build_force_map_.find (o)); + + if (i != _cli_build_force_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_force:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // builds + // + + builds:: + builds () + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + } + + builds:: + builds (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_page_entries_ (20), + build_page_entries_specified_ (false), + build_pages_ (5), + build_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para builds:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // build_db base + // + p = ::brep::options::build_db::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-page-entries Number of builds per page." << ::std::endl; + + os << "build-pages Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_builds_desc_type: ::brep::cli::options + { + _cli_builds_desc_type () + { + ::brep::options::builds::fill (*this); + } + }; + + void builds:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // build_db base + // + ::brep::options::build_db::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("build-page-entries", a, false, dv); + os.push_back (o); + } + + // build-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& builds:: + description () + { + static _cli_builds_desc_type _cli_builds_desc_; + return _cli_builds_desc_; + } + + typedef + std::map + _cli_builds_map; + + static _cli_builds_map _cli_builds_map_; + + struct _cli_builds_map_init + { + _cli_builds_map_init () + { + _cli_builds_map_["build-page-entries"] = + &::brep::cli::thunk< builds, uint16_t, &builds::build_page_entries_, + &builds::build_page_entries_specified_ >; + _cli_builds_map_["build-pages"] = + &::brep::cli::thunk< builds, uint16_t, &builds::build_pages_, + &builds::build_pages_specified_ >; + } + }; + + static _cli_builds_map_init _cli_builds_map_init_; + + bool builds:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_builds_map::const_iterator i (_cli_builds_map_.find (o)); + + if (i != _cli_builds_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // build_db base + // + if (::brep::options::build_db::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool builds:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_configs + // + + build_configs:: + build_configs () + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + } + + build_configs:: + build_configs (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : build_config_page_entries_ (20), + build_config_page_entries_specified_ (false), + build_config_pages_ (5), + build_config_pages_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_configs:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // build base + // + p = ::brep::options::build::print_usage (os, p); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "build-config-page-entries Number of build configurations" << ::std::endl + << " per page." << ::std::endl; + + os << "build-config-pages Number of pages in navigation" << ::std::endl + << " (pager)." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_configs_desc_type: ::brep::cli::options + { + _cli_build_configs_desc_type () + { + ::brep::options::build_configs::fill (*this); + } + }; + + void build_configs:: + fill (::brep::cli::options& os) + { + // build base + // + ::brep::options::build::fill (os); + + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // build-config-page-entries + // + { + ::brep::cli::option_names a; + std::string dv ("20"); + ::brep::cli::option o ("build-config-page-entries", a, false, dv); + os.push_back (o); + } + + // build-config-pages + // + { + ::brep::cli::option_names a; + std::string dv ("5"); + ::brep::cli::option o ("build-config-pages", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_configs:: + description () + { + static _cli_build_configs_desc_type _cli_build_configs_desc_; + return _cli_build_configs_desc_; + } + + typedef + std::map + _cli_build_configs_map; + + static _cli_build_configs_map _cli_build_configs_map_; + + struct _cli_build_configs_map_init + { + _cli_build_configs_map_init () + { + _cli_build_configs_map_["build-config-page-entries"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::build_config_page_entries_, + &build_configs::build_config_page_entries_specified_ >; + _cli_build_configs_map_["build-config-pages"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::build_config_pages_, + &build_configs::build_config_pages_specified_ >; + } + }; + + static _cli_build_configs_map_init _cli_build_configs_map_init_; + + bool build_configs:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_configs_map::const_iterator i (_cli_build_configs_map_.find (o)); + + if (i != _cli_build_configs_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // build base + // + if (::brep::options::build::_parse (o, s)) + return true; + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool build_configs:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // submit + // + + submit:: + submit () + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + } + + submit:: + submit (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : submit_data_ (), + submit_data_specified_ (false), + submit_temp_ (), + submit_temp_specified_ (false), + submit_max_size_ (10485760), + submit_max_size_specified_ (false), + submit_form_ (), + submit_form_specified_ (false), + submit_email_ (), + submit_email_specified_ (false), + submit_handler_ (), + submit_handler_specified_ (false), + submit_handler_argument_ (), + submit_handler_argument_specified_ (false), + submit_handler_timeout_ (), + submit_handler_timeout_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para submit:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "submit-data The directory to save final" << ::std::endl + << " submission data to." << ::std::endl; + + os << "submit-temp The directory to save temporary" << ::std::endl + << " submission data to." << ::std::endl; + + os << "submit-max-size The maximum size of the" << ::std::endl + << " submission data accepted." << ::std::endl; + + os << "submit-form The package submission form" << ::std::endl + << " fragment." << ::std::endl; + + os << "submit-email The package submission email." << ::std::endl; + + os << "submit-handler The handler program to be" << ::std::endl + << " executed on package submission." << ::std::endl; + + os << "submit-handler-argument Additional arguments to be" << ::std::endl + << " passed to the submission handler" << ::std::endl + << " program (see submit-handler for" << ::std::endl + << " details)." << ::std::endl; + + os << "submit-handler-timeout The submission handler program" << ::std::endl + << " timeout in seconds." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_submit_desc_type: ::brep::cli::options + { + _cli_submit_desc_type () + { + ::brep::options::submit::fill (*this); + } + }; + + void submit:: + fill (::brep::cli::options& os) + { + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // submit-data + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-data", a, false, dv); + os.push_back (o); + } + + // submit-temp + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-temp", a, false, dv); + os.push_back (o); + } + + // submit-max-size + // + { + ::brep::cli::option_names a; + std::string dv ("10485760"); + ::brep::cli::option o ("submit-max-size", a, false, dv); + os.push_back (o); + } + + // submit-form + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-form", a, false, dv); + os.push_back (o); + } + + // submit-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-email", a, false, dv); + os.push_back (o); + } + + // submit-handler + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler", a, false, dv); + os.push_back (o); + } + + // submit-handler-argument + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler-argument", a, false, dv); + os.push_back (o); + } + + // submit-handler-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("submit-handler-timeout", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& submit:: + description () + { + static _cli_submit_desc_type _cli_submit_desc_; + return _cli_submit_desc_; + } + + typedef + std::map + _cli_submit_map; + + static _cli_submit_map _cli_submit_map_; + + struct _cli_submit_map_init + { + _cli_submit_map_init () + { + _cli_submit_map_["submit-data"] = + &::brep::cli::thunk< submit, dir_path, &submit::submit_data_, + &submit::submit_data_specified_ >; + _cli_submit_map_["submit-temp"] = + &::brep::cli::thunk< submit, dir_path, &submit::submit_temp_, + &submit::submit_temp_specified_ >; + _cli_submit_map_["submit-max-size"] = + &::brep::cli::thunk< submit, size_t, &submit::submit_max_size_, + &submit::submit_max_size_specified_ >; + _cli_submit_map_["submit-form"] = + &::brep::cli::thunk< submit, path, &submit::submit_form_, + &submit::submit_form_specified_ >; + _cli_submit_map_["submit-email"] = + &::brep::cli::thunk< submit, string, &submit::submit_email_, + &submit::submit_email_specified_ >; + _cli_submit_map_["submit-handler"] = + &::brep::cli::thunk< submit, path, &submit::submit_handler_, + &submit::submit_handler_specified_ >; + _cli_submit_map_["submit-handler-argument"] = + &::brep::cli::thunk< submit, strings, &submit::submit_handler_argument_, + &submit::submit_handler_argument_specified_ >; + _cli_submit_map_["submit-handler-timeout"] = + &::brep::cli::thunk< submit, size_t, &submit::submit_handler_timeout_, + &submit::submit_handler_timeout_specified_ >; + } + }; + + static _cli_submit_map_init _cli_submit_map_init_; + + bool submit:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_submit_map::const_iterator i (_cli_submit_map_.find (o)); + + if (i != _cli_submit_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool submit:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci + // + + ci:: + ci () + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + } + + ci:: + ci (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : ci_data_ (), + ci_data_specified_ (false), + ci_form_ (), + ci_form_specified_ (false), + ci_email_ (), + ci_email_specified_ (false), + ci_handler_ (), + ci_handler_specified_ (false), + ci_handler_argument_ (), + ci_handler_argument_specified_ (false), + ci_handler_timeout_ (), + ci_handler_timeout_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // page base + // + p = ::brep::options::page::print_usage (os, p); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "ci-data The directory to save CI request" << ::std::endl + << " data to." << ::std::endl; + + os << "ci-form The package CI form fragment." << ::std::endl; + + os << "ci-email The package CI email." << ::std::endl; + + os << "ci-handler The handler program to be" << ::std::endl + << " executed on CI request." << ::std::endl; + + os << "ci-handler-argument Additional arguments to be" << ::std::endl + << " passed to the CI handler program" << ::std::endl + << " (see ci-handler for details)." << ::std::endl; + + os << "ci-handler-timeout The CI handler program timeout" << ::std::endl + << " in seconds." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_ci_desc_type: ::brep::cli::options + { + _cli_ci_desc_type () + { + ::brep::options::ci::fill (*this); + } + }; + + void ci:: + fill (::brep::cli::options& os) + { + // page base + // + ::brep::options::page::fill (os); + + // handler base + // + ::brep::options::handler::fill (os); + + // ci-data + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-data", a, false, dv); + os.push_back (o); + } + + // ci-form + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-form", a, false, dv); + os.push_back (o); + } + + // ci-email + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-email", a, false, dv); + os.push_back (o); + } + + // ci-handler + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler", a, false, dv); + os.push_back (o); + } + + // ci-handler-argument + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler-argument", a, false, dv); + os.push_back (o); + } + + // ci-handler-timeout + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("ci-handler-timeout", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& ci:: + description () + { + static _cli_ci_desc_type _cli_ci_desc_; + return _cli_ci_desc_; + } + + typedef + std::map + _cli_ci_map; + + static _cli_ci_map _cli_ci_map_; + + struct _cli_ci_map_init + { + _cli_ci_map_init () + { + _cli_ci_map_["ci-data"] = + &::brep::cli::thunk< ci, dir_path, &ci::ci_data_, + &ci::ci_data_specified_ >; + _cli_ci_map_["ci-form"] = + &::brep::cli::thunk< ci, path, &ci::ci_form_, + &ci::ci_form_specified_ >; + _cli_ci_map_["ci-email"] = + &::brep::cli::thunk< ci, string, &ci::ci_email_, + &ci::ci_email_specified_ >; + _cli_ci_map_["ci-handler"] = + &::brep::cli::thunk< ci, path, &ci::ci_handler_, + &ci::ci_handler_specified_ >; + _cli_ci_map_["ci-handler-argument"] = + &::brep::cli::thunk< ci, strings, &ci::ci_handler_argument_, + &ci::ci_handler_argument_specified_ >; + _cli_ci_map_["ci-handler-timeout"] = + &::brep::cli::thunk< ci, size_t, &ci::ci_handler_timeout_, + &ci::ci_handler_timeout_specified_ >; + } + }; + + static _cli_ci_map_init _cli_ci_map_init_; + + bool ci:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_map::const_iterator i (_cli_ci_map_.find (o)); + + if (i != _cli_ci_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // page base + // + if (::brep::options::page::_parse (o, s)) + return true; + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool ci:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_root + // + + repository_root:: + repository_root () + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + } + + repository_root:: + repository_root (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_root:: + repository_root (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_root:: + repository_root (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_root:: + repository_root (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_root:: + repository_root (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : root_global_view_ ("packages"), + root_global_view_specified_ (false), + root_tenant_view_ ("packages"), + root_tenant_view_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_root:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + // handler base + // + p = ::brep::options::handler::print_usage (os, p); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "root-global-view The default view to display for" << ::std::endl + << " the global repository root." << ::std::endl; + + os << "root-tenant-view The default view to display for" << ::std::endl + << " the tenant repository root." << ::std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_repository_root_desc_type: ::brep::cli::options + { + _cli_repository_root_desc_type () + { + ::brep::options::repository_root::fill (*this); + } + }; + + void repository_root:: + fill (::brep::cli::options& os) + { + // handler base + // + ::brep::options::handler::fill (os); + + // root-global-view + // + { + ::brep::cli::option_names a; + std::string dv ("packages"); + ::brep::cli::option o ("root-global-view", a, false, dv); + os.push_back (o); + } + + // root-tenant-view + // + { + ::brep::cli::option_names a; + std::string dv ("packages"); + ::brep::cli::option o ("root-tenant-view", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& repository_root:: + description () + { + static _cli_repository_root_desc_type _cli_repository_root_desc_; + return _cli_repository_root_desc_; + } + + typedef + std::map + _cli_repository_root_map; + + static _cli_repository_root_map _cli_repository_root_map_; + + struct _cli_repository_root_map_init + { + _cli_repository_root_map_init () + { + _cli_repository_root_map_["root-global-view"] = + &::brep::cli::thunk< repository_root, string, &repository_root::root_global_view_, + &repository_root::root_global_view_specified_ >; + _cli_repository_root_map_["root-tenant-view"] = + &::brep::cli::thunk< repository_root, string, &repository_root::root_tenant_view_, + &repository_root::root_tenant_view_specified_ >; + } + }; + + static _cli_repository_root_map_init _cli_repository_root_map_init_; + + bool repository_root:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_root_map::const_iterator i (_cli_repository_root_map_.find (o)); + + if (i != _cli_repository_root_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + // handler base + // + if (::brep::options::handler::_parse (o, s)) + return true; + + return false; + } + + bool repository_root:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } + + namespace params + { + // packages + // + + packages:: + packages () + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + } + + packages:: + packages (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + packages:: + packages (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + packages:: + packages (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + q_ (), + q_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para packages:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p " << std::endl; + + os << "q|_ " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_packages_desc_type: ::brep::cli::options + { + _cli_packages_desc_type () + { + ::brep::params::packages::fill (*this); + } + }; + + void packages:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // q + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("q", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& packages:: + description () + { + static _cli_packages_desc_type _cli_packages_desc_; + return _cli_packages_desc_; + } + + typedef + std::map + _cli_packages_map; + + static _cli_packages_map _cli_packages_map_; + + struct _cli_packages_map_init + { + _cli_packages_map_init () + { + _cli_packages_map_["page"] = + &::brep::cli::thunk< packages, uint16_t, &packages::page_, + &packages::page_specified_ >; + _cli_packages_map_["p"] = + &::brep::cli::thunk< packages, uint16_t, &packages::page_, + &packages::page_specified_ >; + _cli_packages_map_["q"] = + &::brep::cli::thunk< packages, string, &packages::q_, + &packages::q_specified_ >; + _cli_packages_map_["_"] = + &::brep::cli::thunk< packages, string, &packages::q_, + &packages::q_specified_ >; + } + }; + + static _cli_packages_map_init _cli_packages_map_init_; + + bool packages:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_packages_map::const_iterator i (_cli_packages_map_.find (o)); + + if (i != _cli_packages_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool packages:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_details + // + + package_details:: + package_details () + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + } + + package_details:: + package_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_details:: + package_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_details:: + package_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + query_ (), + query_specified_ (false), + form_ (page_form::brief), + form_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p " << std::endl; + + os << "query|q " << std::endl; + + os << "form|f " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_details_desc_type: ::brep::cli::options + { + _cli_package_details_desc_type () + { + ::brep::params::package_details::fill (*this); + } + }; + + void package_details:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // query + // + { + ::brep::cli::option_names a; + a.push_back ("q"); + std::string dv; + ::brep::cli::option o ("query", a, false, dv); + os.push_back (o); + } + + // form + // + { + ::brep::cli::option_names a; + a.push_back ("f"); + std::string dv; + ::brep::cli::option o ("form", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_details:: + description () + { + static _cli_package_details_desc_type _cli_package_details_desc_; + return _cli_package_details_desc_; + } + + typedef + std::map + _cli_package_details_map; + + static _cli_package_details_map _cli_package_details_map_; + + struct _cli_package_details_map_init + { + _cli_package_details_map_init () + { + _cli_package_details_map_["page"] = + &::brep::cli::thunk< package_details, uint16_t, &package_details::page_, + &package_details::page_specified_ >; + _cli_package_details_map_["p"] = + &::brep::cli::thunk< package_details, uint16_t, &package_details::page_, + &package_details::page_specified_ >; + _cli_package_details_map_["query"] = + &::brep::cli::thunk< package_details, string, &package_details::query_, + &package_details::query_specified_ >; + _cli_package_details_map_["q"] = + &::brep::cli::thunk< package_details, string, &package_details::query_, + &package_details::query_specified_ >; + _cli_package_details_map_["form"] = + &::brep::cli::thunk< package_details, page_form, &package_details::form_, + &package_details::form_specified_ >; + _cli_package_details_map_["f"] = + &::brep::cli::thunk< package_details, page_form, &package_details::form_, + &package_details::form_specified_ >; + } + }; + + static _cli_package_details_map_init _cli_package_details_map_init_; + + bool package_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_details_map::const_iterator i (_cli_package_details_map_.find (o)); + + if (i != _cli_package_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // package_version_details + // + + package_version_details:: + package_version_details () + : form_ (page_form::brief), + form_specified_ (false) + { + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + package_version_details:: + package_version_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + package_version_details:: + package_version_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : form_ (page_form::brief), + form_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para package_version_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "form|f " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_package_version_details_desc_type: ::brep::cli::options + { + _cli_package_version_details_desc_type () + { + ::brep::params::package_version_details::fill (*this); + } + }; + + void package_version_details:: + fill (::brep::cli::options& os) + { + // form + // + { + ::brep::cli::option_names a; + a.push_back ("f"); + std::string dv; + ::brep::cli::option o ("form", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& package_version_details:: + description () + { + static _cli_package_version_details_desc_type _cli_package_version_details_desc_; + return _cli_package_version_details_desc_; + } + + typedef + std::map + _cli_package_version_details_map; + + static _cli_package_version_details_map _cli_package_version_details_map_; + + struct _cli_package_version_details_map_init + { + _cli_package_version_details_map_init () + { + _cli_package_version_details_map_["form"] = + &::brep::cli::thunk< package_version_details, page_form, &package_version_details::form_, + &package_version_details::form_specified_ >; + _cli_package_version_details_map_["f"] = + &::brep::cli::thunk< package_version_details, page_form, &package_version_details::form_, + &package_version_details::form_specified_ >; + } + }; + + static _cli_package_version_details_map_init _cli_package_version_details_map_init_; + + bool package_version_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_package_version_details_map::const_iterator i (_cli_package_version_details_map_.find (o)); + + if (i != _cli_package_version_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool package_version_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // repository_details + // + + repository_details:: + repository_details () + { + } + + repository_details:: + repository_details (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + repository_details:: + repository_details (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + repository_details:: + repository_details (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para repository_details:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_repository_details_desc_type: ::brep::cli::options + { + _cli_repository_details_desc_type () + { + ::brep::params::repository_details::fill (*this); + } + }; + + void repository_details:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& repository_details:: + description () + { + static _cli_repository_details_desc_type _cli_repository_details_desc_; + return _cli_repository_details_desc_; + } + + typedef + std::map + _cli_repository_details_map; + + static _cli_repository_details_map _cli_repository_details_map_; + + struct _cli_repository_details_map_init + { + _cli_repository_details_map_init () + { + } + }; + + static _cli_repository_details_map_init _cli_repository_details_map_init_; + + bool repository_details:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_repository_details_map::const_iterator i (_cli_repository_details_map_.find (o)); + + if (i != _cli_repository_details_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool repository_details:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_task + // + + build_task:: + build_task () + : repository_ (), + repository_specified_ (false) + { + } + + build_task:: + build_task (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_task:: + build_task (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_task:: + build_task (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_task:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "repository|r " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_task_desc_type: ::brep::cli::options + { + _cli_build_task_desc_type () + { + ::brep::params::build_task::fill (*this); + } + }; + + void build_task:: + fill (::brep::cli::options& os) + { + // repository + // + { + ::brep::cli::option_names a; + a.push_back ("r"); + std::string dv; + ::brep::cli::option o ("repository", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_task:: + description () + { + static _cli_build_task_desc_type _cli_build_task_desc_; + return _cli_build_task_desc_; + } + + typedef + std::map + _cli_build_task_map; + + static _cli_build_task_map _cli_build_task_map_; + + struct _cli_build_task_map_init + { + _cli_build_task_map_init () + { + _cli_build_task_map_["repository"] = + &::brep::cli::thunk< build_task, vector, &build_task::repository_, + &build_task::repository_specified_ >; + _cli_build_task_map_["r"] = + &::brep::cli::thunk< build_task, vector, &build_task::repository_, + &build_task::repository_specified_ >; + } + }; + + static _cli_build_task_map_init _cli_build_task_map_init_; + + bool build_task:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_task_map::const_iterator i (_cli_build_task_map_.find (o)); + + if (i != _cli_build_task_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_task:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_result + // + + build_result:: + build_result () + { + } + + build_result:: + build_result (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_result:: + build_result (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_result:: + build_result (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_result:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_build_result_desc_type: ::brep::cli::options + { + _cli_build_result_desc_type () + { + ::brep::params::build_result::fill (*this); + } + }; + + void build_result:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& build_result:: + description () + { + static _cli_build_result_desc_type _cli_build_result_desc_; + return _cli_build_result_desc_; + } + + typedef + std::map + _cli_build_result_map; + + static _cli_build_result_map _cli_build_result_map_; + + struct _cli_build_result_map_init + { + _cli_build_result_map_init () + { + } + }; + + static _cli_build_result_map_init _cli_build_result_map_init_; + + bool build_result:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_result_map::const_iterator i (_cli_build_result_map_.find (o)); + + if (i != _cli_build_result_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_result:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_log + // + + build_log:: + build_log () + { + } + + build_log:: + build_log (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_log:: + build_log (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_log:: + build_log (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_log:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + return p; + } + + struct _cli_build_log_desc_type: ::brep::cli::options + { + _cli_build_log_desc_type () + { + ::brep::params::build_log::fill (*this); + } + }; + + void build_log:: + fill (::brep::cli::options&) + { + } + + const ::brep::cli::options& build_log:: + description () + { + static _cli_build_log_desc_type _cli_build_log_desc_; + return _cli_build_log_desc_; + } + + typedef + std::map + _cli_build_log_map; + + static _cli_build_log_map _cli_build_log_map_; + + struct _cli_build_log_map_init + { + _cli_build_log_map_init () + { + } + }; + + static _cli_build_log_map_init _cli_build_log_map_init_; + + bool build_log:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_log_map::const_iterator i (_cli_build_log_map_.find (o)); + + if (i != _cli_build_log_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_log:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_force + // + + build_force:: + build_force () + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + } + + build_force:: + build_force (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_force:: + build_force (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_force:: + build_force (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : package_ (), + package_specified_ (false), + version_ (), + version_specified_ (false), + configuration_ (), + configuration_specified_ (false), + target_ (), + target_specified_ (false), + toolchain_name_ (), + toolchain_name_specified_ (false), + toolchain_version_ (), + toolchain_version_specified_ (false), + reason_ (), + reason_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_force:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "package|pn " << std::endl; + + os << "version|pv " << std::endl; + + os << "configuration|cf " << std::endl; + + os << "target|tg " << std::endl; + + os << "toolchain_name|tn " << std::endl; + + os << "toolchain_version|tv " << std::endl; + + os << "reason " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_force_desc_type: ::brep::cli::options + { + _cli_build_force_desc_type () + { + ::brep::params::build_force::fill (*this); + } + }; + + void build_force:: + fill (::brep::cli::options& os) + { + // package + // + { + ::brep::cli::option_names a; + a.push_back ("pn"); + std::string dv; + ::brep::cli::option o ("package", a, false, dv); + os.push_back (o); + } + + // version + // + { + ::brep::cli::option_names a; + a.push_back ("pv"); + std::string dv; + ::brep::cli::option o ("version", a, false, dv); + os.push_back (o); + } + + // configuration + // + { + ::brep::cli::option_names a; + a.push_back ("cf"); + std::string dv; + ::brep::cli::option o ("configuration", a, false, dv); + os.push_back (o); + } + + // target + // + { + ::brep::cli::option_names a; + a.push_back ("tg"); + std::string dv; + ::brep::cli::option o ("target", a, false, dv); + os.push_back (o); + } + + // toolchain_name + // + { + ::brep::cli::option_names a; + a.push_back ("tn"); + std::string dv; + ::brep::cli::option o ("toolchain_name", a, false, dv); + os.push_back (o); + } + + // toolchain_version + // + { + ::brep::cli::option_names a; + a.push_back ("tv"); + std::string dv; + ::brep::cli::option o ("toolchain_version", a, false, dv); + os.push_back (o); + } + + // reason + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("reason", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_force:: + description () + { + static _cli_build_force_desc_type _cli_build_force_desc_; + return _cli_build_force_desc_; + } + + typedef + std::map + _cli_build_force_map; + + static _cli_build_force_map _cli_build_force_map_; + + struct _cli_build_force_map_init + { + _cli_build_force_map_init () + { + _cli_build_force_map_["package"] = + &::brep::cli::thunk< build_force, string, &build_force::package_, + &build_force::package_specified_ >; + _cli_build_force_map_["pn"] = + &::brep::cli::thunk< build_force, string, &build_force::package_, + &build_force::package_specified_ >; + _cli_build_force_map_["version"] = + &::brep::cli::thunk< build_force, string, &build_force::version_, + &build_force::version_specified_ >; + _cli_build_force_map_["pv"] = + &::brep::cli::thunk< build_force, string, &build_force::version_, + &build_force::version_specified_ >; + _cli_build_force_map_["configuration"] = + &::brep::cli::thunk< build_force, string, &build_force::configuration_, + &build_force::configuration_specified_ >; + _cli_build_force_map_["cf"] = + &::brep::cli::thunk< build_force, string, &build_force::configuration_, + &build_force::configuration_specified_ >; + _cli_build_force_map_["target"] = + &::brep::cli::thunk< build_force, string, &build_force::target_, + &build_force::target_specified_ >; + _cli_build_force_map_["tg"] = + &::brep::cli::thunk< build_force, string, &build_force::target_, + &build_force::target_specified_ >; + _cli_build_force_map_["toolchain_name"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_name_, + &build_force::toolchain_name_specified_ >; + _cli_build_force_map_["tn"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_name_, + &build_force::toolchain_name_specified_ >; + _cli_build_force_map_["toolchain_version"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_version_, + &build_force::toolchain_version_specified_ >; + _cli_build_force_map_["tv"] = + &::brep::cli::thunk< build_force, string, &build_force::toolchain_version_, + &build_force::toolchain_version_specified_ >; + _cli_build_force_map_["reason"] = + &::brep::cli::thunk< build_force, string, &build_force::reason_, + &build_force::reason_specified_ >; + } + }; + + static _cli_build_force_map_init _cli_build_force_map_init_; + + bool build_force:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_force_map::const_iterator i (_cli_build_force_map_.find (o)); + + if (i != _cli_build_force_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_force:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // builds + // + + builds:: + builds () + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + } + + builds:: + builds (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + builds:: + builds (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + builds:: + builds (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : page_ (), + page_specified_ (false), + name_ (), + name_specified_ (false), + name_legacy_ (), + name_legacy_specified_ (false), + version_ (), + version_specified_ (false), + toolchain_ ("*"), + toolchain_specified_ (false), + configuration_ (), + configuration_specified_ (false), + machine_ (), + machine_specified_ (false), + target_ (), + target_specified_ (false), + result_ ("*"), + result_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para builds:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "page|p " << std::endl; + + os << "name|_ " << std::endl; + + os << "name_legacy|pn " << std::endl; + + os << "version|pv " << std::endl; + + os << "toolchain|tc " << std::endl; + + os << "configuration|cf " << std::endl; + + os << "machine|mn " << std::endl; + + os << "target|tg " << std::endl; + + os << "result|rs " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_builds_desc_type: ::brep::cli::options + { + _cli_builds_desc_type () + { + ::brep::params::builds::fill (*this); + } + }; + + void builds:: + fill (::brep::cli::options& os) + { + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + + // name + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("name", a, false, dv); + os.push_back (o); + } + + // name_legacy + // + { + ::brep::cli::option_names a; + a.push_back ("pn"); + std::string dv; + ::brep::cli::option o ("name_legacy", a, false, dv); + os.push_back (o); + } + + // version + // + { + ::brep::cli::option_names a; + a.push_back ("pv"); + std::string dv; + ::brep::cli::option o ("version", a, false, dv); + os.push_back (o); + } + + // toolchain + // + { + ::brep::cli::option_names a; + a.push_back ("tc"); + std::string dv ("*"); + ::brep::cli::option o ("toolchain", a, false, dv); + os.push_back (o); + } + + // configuration + // + { + ::brep::cli::option_names a; + a.push_back ("cf"); + std::string dv; + ::brep::cli::option o ("configuration", a, false, dv); + os.push_back (o); + } + + // machine + // + { + ::brep::cli::option_names a; + a.push_back ("mn"); + std::string dv; + ::brep::cli::option o ("machine", a, false, dv); + os.push_back (o); + } + + // target + // + { + ::brep::cli::option_names a; + a.push_back ("tg"); + std::string dv; + ::brep::cli::option o ("target", a, false, dv); + os.push_back (o); + } + + // result + // + { + ::brep::cli::option_names a; + a.push_back ("rs"); + std::string dv ("*"); + ::brep::cli::option o ("result", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& builds:: + description () + { + static _cli_builds_desc_type _cli_builds_desc_; + return _cli_builds_desc_; + } + + typedef + std::map + _cli_builds_map; + + static _cli_builds_map _cli_builds_map_; + + struct _cli_builds_map_init + { + _cli_builds_map_init () + { + _cli_builds_map_["page"] = + &::brep::cli::thunk< builds, uint16_t, &builds::page_, + &builds::page_specified_ >; + _cli_builds_map_["p"] = + &::brep::cli::thunk< builds, uint16_t, &builds::page_, + &builds::page_specified_ >; + _cli_builds_map_["name"] = + &::brep::cli::thunk< builds, string, &builds::name_, + &builds::name_specified_ >; + _cli_builds_map_["_"] = + &::brep::cli::thunk< builds, string, &builds::name_, + &builds::name_specified_ >; + _cli_builds_map_["name_legacy"] = + &::brep::cli::thunk< builds, string, &builds::name_legacy_, + &builds::name_legacy_specified_ >; + _cli_builds_map_["pn"] = + &::brep::cli::thunk< builds, string, &builds::name_legacy_, + &builds::name_legacy_specified_ >; + _cli_builds_map_["version"] = + &::brep::cli::thunk< builds, string, &builds::version_, + &builds::version_specified_ >; + _cli_builds_map_["pv"] = + &::brep::cli::thunk< builds, string, &builds::version_, + &builds::version_specified_ >; + _cli_builds_map_["toolchain"] = + &::brep::cli::thunk< builds, string, &builds::toolchain_, + &builds::toolchain_specified_ >; + _cli_builds_map_["tc"] = + &::brep::cli::thunk< builds, string, &builds::toolchain_, + &builds::toolchain_specified_ >; + _cli_builds_map_["configuration"] = + &::brep::cli::thunk< builds, string, &builds::configuration_, + &builds::configuration_specified_ >; + _cli_builds_map_["cf"] = + &::brep::cli::thunk< builds, string, &builds::configuration_, + &builds::configuration_specified_ >; + _cli_builds_map_["machine"] = + &::brep::cli::thunk< builds, string, &builds::machine_, + &builds::machine_specified_ >; + _cli_builds_map_["mn"] = + &::brep::cli::thunk< builds, string, &builds::machine_, + &builds::machine_specified_ >; + _cli_builds_map_["target"] = + &::brep::cli::thunk< builds, string, &builds::target_, + &builds::target_specified_ >; + _cli_builds_map_["tg"] = + &::brep::cli::thunk< builds, string, &builds::target_, + &builds::target_specified_ >; + _cli_builds_map_["result"] = + &::brep::cli::thunk< builds, string, &builds::result_, + &builds::result_specified_ >; + _cli_builds_map_["rs"] = + &::brep::cli::thunk< builds, string, &builds::result_, + &builds::result_specified_ >; + } + }; + + static _cli_builds_map_init _cli_builds_map_init_; + + bool builds:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_builds_map::const_iterator i (_cli_builds_map_.find (o)); + + if (i != _cli_builds_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool builds:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // build_configs + // + + build_configs:: + build_configs () + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + } + + build_configs:: + build_configs (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + build_configs:: + build_configs (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + build_configs:: + build_configs (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : class_name_ ("all"), + class_name_specified_ (false), + page_ (), + page_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para build_configs:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "class_name|_ " << std::endl; + + os << "page|p " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_build_configs_desc_type: ::brep::cli::options + { + _cli_build_configs_desc_type () + { + ::brep::params::build_configs::fill (*this); + } + }; + + void build_configs:: + fill (::brep::cli::options& os) + { + // class_name + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv ("all"); + ::brep::cli::option o ("class_name", a, false, dv); + os.push_back (o); + } + + // page + // + { + ::brep::cli::option_names a; + a.push_back ("p"); + std::string dv; + ::brep::cli::option o ("page", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& build_configs:: + description () + { + static _cli_build_configs_desc_type _cli_build_configs_desc_; + return _cli_build_configs_desc_; + } + + typedef + std::map + _cli_build_configs_map; + + static _cli_build_configs_map _cli_build_configs_map_; + + struct _cli_build_configs_map_init + { + _cli_build_configs_map_init () + { + _cli_build_configs_map_["class_name"] = + &::brep::cli::thunk< build_configs, string, &build_configs::class_name_, + &build_configs::class_name_specified_ >; + _cli_build_configs_map_["_"] = + &::brep::cli::thunk< build_configs, string, &build_configs::class_name_, + &build_configs::class_name_specified_ >; + _cli_build_configs_map_["page"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::page_, + &build_configs::page_specified_ >; + _cli_build_configs_map_["p"] = + &::brep::cli::thunk< build_configs, uint16_t, &build_configs::page_, + &build_configs::page_specified_ >; + } + }; + + static _cli_build_configs_map_init _cli_build_configs_map_init_; + + bool build_configs:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_build_configs_map::const_iterator i (_cli_build_configs_map_.find (o)); + + if (i != _cli_build_configs_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool build_configs:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // submit + // + + submit:: + submit () + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + } + + submit:: + submit (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + submit:: + submit (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + submit:: + submit (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : archive_ (), + archive_specified_ (false), + sha256sum_ (), + sha256sum_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para submit:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "archive " << std::endl; + + os << "sha256sum " << std::endl; + + os << "simulate " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_submit_desc_type: ::brep::cli::options + { + _cli_submit_desc_type () + { + ::brep::params::submit::fill (*this); + } + }; + + void submit:: + fill (::brep::cli::options& os) + { + // archive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("archive", a, false, dv); + os.push_back (o); + } + + // sha256sum + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("sha256sum", a, false, dv); + os.push_back (o); + } + + // simulate + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("simulate", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& submit:: + description () + { + static _cli_submit_desc_type _cli_submit_desc_; + return _cli_submit_desc_; + } + + typedef + std::map + _cli_submit_map; + + static _cli_submit_map _cli_submit_map_; + + struct _cli_submit_map_init + { + _cli_submit_map_init () + { + _cli_submit_map_["archive"] = + &::brep::cli::thunk< submit, string, &submit::archive_, + &submit::archive_specified_ >; + _cli_submit_map_["sha256sum"] = + &::brep::cli::thunk< submit, string, &submit::sha256sum_, + &submit::sha256sum_specified_ >; + _cli_submit_map_["simulate"] = + &::brep::cli::thunk< submit, string, &submit::simulate_, + &submit::simulate_specified_ >; + } + }; + + static _cli_submit_map_init _cli_submit_map_init_; + + bool submit:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_submit_map::const_iterator i (_cli_submit_map_.find (o)); + + if (i != _cli_submit_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool submit:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + + // ci + // + + ci:: + ci () + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + } + + ci:: + ci (int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int start, + int& argc, + char** argv, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + } + + ci:: + ci (int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (int start, + int& argc, + char** argv, + int& end, + bool erase, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + ::brep::cli::argv_scanner s (start, argc, argv, erase); + _parse (s, opt, arg); + end = s.end (); + } + + ci:: + ci (::brep::cli::scanner& s, + ::brep::cli::unknown_mode opt, + ::brep::cli::unknown_mode arg) + : repository_ (), + repository_specified_ (false), + package_ (), + package_specified_ (false), + overrides_ (), + overrides_specified_ (false), + interactive_ (), + interactive_specified_ (false), + simulate_ (), + simulate_specified_ (false) + { + _parse (s, opt, arg); + } + + ::brep::cli::usage_para ci:: + print_usage (::std::ostream& os, ::brep::cli::usage_para p) + { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::brep::cli::usage_para::text) + os << ::std::endl; + + os << "repository|_ " << std::endl; + + os << "package " << std::endl; + + os << "overrides " << std::endl; + + os << "interactive " << std::endl; + + os << "simulate " << std::endl; + + p = ::brep::cli::usage_para::option; + + return p; + } + + struct _cli_ci_desc_type: ::brep::cli::options + { + _cli_ci_desc_type () + { + ::brep::params::ci::fill (*this); + } + }; + + void ci:: + fill (::brep::cli::options& os) + { + // repository + // + { + ::brep::cli::option_names a; + a.push_back ("_"); + std::string dv; + ::brep::cli::option o ("repository", a, false, dv); + os.push_back (o); + } + + // package + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("package", a, false, dv); + os.push_back (o); + } + + // overrides + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("overrides", a, false, dv); + os.push_back (o); + } + + // interactive + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("interactive", a, false, dv); + os.push_back (o); + } + + // simulate + // + { + ::brep::cli::option_names a; + std::string dv; + ::brep::cli::option o ("simulate", a, false, dv); + os.push_back (o); + } + } + + const ::brep::cli::options& ci:: + description () + { + static _cli_ci_desc_type _cli_ci_desc_; + return _cli_ci_desc_; + } + + typedef + std::map + _cli_ci_map; + + static _cli_ci_map _cli_ci_map_; + + struct _cli_ci_map_init + { + _cli_ci_map_init () + { + _cli_ci_map_["repository"] = + &::brep::cli::thunk< ci, bpkg::repository_location, &ci::repository_, + &ci::repository_specified_ >; + _cli_ci_map_["_"] = + &::brep::cli::thunk< ci, bpkg::repository_location, &ci::repository_, + &ci::repository_specified_ >; + _cli_ci_map_["package"] = + &::brep::cli::thunk< ci, strings, &ci::package_, + &ci::package_specified_ >; + _cli_ci_map_["overrides"] = + &::brep::cli::thunk< ci, string, &ci::overrides_, + &ci::overrides_specified_ >; + _cli_ci_map_["interactive"] = + &::brep::cli::thunk< ci, string, &ci::interactive_, + &ci::interactive_specified_ >; + _cli_ci_map_["simulate"] = + &::brep::cli::thunk< ci, string, &ci::simulate_, + &ci::simulate_specified_ >; + } + }; + + static _cli_ci_map_init _cli_ci_map_init_; + + bool ci:: + _parse (const char* o, ::brep::cli::scanner& s) + { + _cli_ci_map::const_iterator i (_cli_ci_map_.find (o)); + + if (i != _cli_ci_map_.end ()) + { + (*(i->second)) (*this, s); + return true; + } + + return false; + } + + bool ci:: + _parse (::brep::cli::scanner& s, + ::brep::cli::unknown_mode, + ::brep::cli::unknown_mode arg_mode) + { + bool r = false; + bool opt = true; + + while (s.more ()) + { + const char* o = s.peek (); + + if (std::strcmp (o, "--") == 0) + { + opt = false; + s.skip (); + r = true; + continue; + } + + if (opt) + { + if (_parse (o, s)) + { + r = true; + continue; + } + } + + switch (arg_mode) + { + case ::brep::cli::unknown_mode::skip: + { + s.skip (); + r = true; + continue; + } + case ::brep::cli::unknown_mode::stop: + { + break; + } + case ::brep::cli::unknown_mode::fail: + { + throw ::brep::cli::unknown_argument (o); + } + } + + break; + } + + return r; + } + } +} + +// Begin epilogue. +// +// +// End epilogue. + diff --git a/mod/pregenerated/mod/module-options.hxx b/mod/pregenerated/mod/module-options.hxx new file mode 100644 index 0000000..c206d8b --- /dev/null +++ b/mod/pregenerated/mod/module-options.hxx @@ -0,0 +1,4546 @@ +// -*- C++ -*- +// +// This file was generated by CLI, a command line interface +// compiler for C++. +// + +#ifndef MOD_MODULE_OPTIONS_HXX +#define MOD_MODULE_OPTIONS_HXX + +// Begin prologue. +// +// +// End prologue. + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef CLI_POTENTIALLY_UNUSED +# if defined(_MSC_VER) || defined(__xlC__) +# define CLI_POTENTIALLY_UNUSED(x) (void*)&x +# else +# define CLI_POTENTIALLY_UNUSED(x) (void)x +# endif +#endif + +namespace brep +{ + namespace cli + { + class usage_para + { + public: + enum value + { + none, + text, + option + }; + + usage_para (value); + + operator value () const + { + return v_; + } + + private: + value v_; + }; + + class unknown_mode + { + public: + enum value + { + skip, + stop, + fail + }; + + unknown_mode (value); + + operator value () const + { + return v_; + } + + private: + value v_; + }; + + // Exceptions. + // + + class exception: public std::exception + { + public: + virtual void + print (::std::ostream&) const = 0; + }; + + ::std::ostream& + operator<< (::std::ostream&, const exception&); + + class unknown_option: public exception + { + public: + virtual + ~unknown_option () throw (); + + unknown_option (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string option_; + }; + + class unknown_argument: public exception + { + public: + virtual + ~unknown_argument () throw (); + + unknown_argument (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string argument_; + }; + + class missing_value: public exception + { + public: + virtual + ~missing_value () throw (); + + missing_value (const std::string& option); + + const std::string& + option () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string option_; + }; + + class invalid_value: public exception + { + public: + virtual + ~invalid_value () throw (); + + invalid_value (const std::string& option, + const std::string& value, + const std::string& message = std::string ()); + + const std::string& + option () const; + + const std::string& + value () const; + + const std::string& + message () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string option_; + std::string value_; + std::string message_; + }; + + class eos_reached: public exception + { + public: + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + }; + + class file_io_failure: public exception + { + public: + virtual + ~file_io_failure () throw (); + + file_io_failure (const std::string& file); + + const std::string& + file () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string file_; + }; + + class unmatched_quote: public exception + { + public: + virtual + ~unmatched_quote () throw (); + + unmatched_quote (const std::string& argument); + + const std::string& + argument () const; + + virtual void + print (::std::ostream&) const; + + virtual const char* + what () const throw (); + + private: + std::string argument_; + }; + + // Command line argument scanner interface. + // + // The values returned by next() are guaranteed to be valid + // for the two previous arguments up until a call to a third + // peek() or next(). + // + // The position() function returns a monotonically-increasing + // number which, if stored, can later be used to determine the + // relative position of the argument returned by the following + // call to next(). Note that if multiple scanners are used to + // extract arguments from multiple sources, then the end + // position of the previous scanner should be used as the + // start position of the next. + // + class scanner + { + public: + virtual + ~scanner (); + + virtual bool + more () = 0; + + virtual const char* + peek () = 0; + + virtual const char* + next () = 0; + + virtual void + skip () = 0; + + virtual std::size_t + position () = 0; + }; + + class argv_scanner: public scanner + { + public: + argv_scanner (int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + argv_scanner (int start, + int& argc, + char** argv, + bool erase = false, + std::size_t start_position = 0); + + int + end () const; + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + protected: + std::size_t start_position_; + int i_; + int& argc_; + char** argv_; + bool erase_; + }; + + class argv_file_scanner: public argv_scanner + { + public: + argv_file_scanner (int& argc, + char** argv, + const std::string& option, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (int start, + int& argc, + char** argv, + const std::string& option, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (const std::string& file, + const std::string& option, + std::size_t start_position = 0); + + struct option_info + { + // If search_func is not NULL, it is called, with the arg + // value as the second argument, to locate the options file. + // If it returns an empty string, then the file is ignored. + // + const char* option; + std::string (*search_func) (const char*, void* arg); + void* arg; + }; + + argv_file_scanner (int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (int start, + int& argc, + char** argv, + const option_info* options, + std::size_t options_count, + bool erase = false, + std::size_t start_position = 0); + + argv_file_scanner (const std::string& file, + const option_info* options = 0, + std::size_t options_count = 0, + std::size_t start_position = 0); + + virtual bool + more (); + + virtual const char* + peek (); + + virtual const char* + next (); + + virtual void + skip (); + + virtual std::size_t + position (); + + // 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; + + void + load (const std::string& file); + + typedef argv_scanner base; + + const std::string option_; + option_info option_info_; + const option_info* options_; + std::size_t options_count_; + + struct arg + { + std::string value; + const std::string* file; + std::size_t line; + }; + + std::deque args_; + std::list files_; + + // Circular buffer of two arguments. + // + std::string hold_[2]; + std::size_t i_; + + bool skip_; + + static int zero_argc_; + static std::string empty_string_; + }; + + typedef std::vector option_names; + + class option + { + public: + + const std::string& + name () const; + + const option_names& + aliases () const; + + bool + flag () const; + + const std::string& + default_value () const; + + public:option (); + option (const std::string& name, + const option_names& aliases, + bool flag, + const std::string& default_value); + + private: + std::string name_; + option_names aliases_; + bool flag_; + std::string default_value_; + }; + + class options: public std::vector