![]() |
Home | Libraries | People | FAQ | More |
boost::program_options::basic_command_line_parser
// In header: <boost/program_options/parsers.hpp> template<typename charT> class basic_command_line_parser { public: // construct/copy/destruct (); (, ); // public member functions basic_command_line_parser & (options_description &); basic_command_line_parser & (positional_options_description &); basic_command_line_parser & (); basic_command_line_parser & (); basic_parsed_options< (); basic_command_line_parser & (); basic_command_line_parser & (); };
Command line parser.
The class allows one to specify all the information needed for parsing and to parse the command line. It is primarily needed to emulate named function parameters -- a regular function with 5 parameters will be hard to use and creating overloads with a smaller number of parameters will be confusing.
For the most common case, the function parse_command_line is a better alternative.
There are two typedefs -- command_line_parser and wcommand_line_parser, for charT == char and charT == wchar_t cases.
basic_command_line_parser
public member functionsbasic_command_line_parser & (options_description & desc);
Sets options descriptions to use.
basic_command_line_parser & (positional_options_description & desc);
Sets positional options description to use.
basic_command_line_parser & ();
Sets the command line style.
basic_command_line_parser & ();
Sets the extra parsers.
basic_parsed_options< ();
Parses the options and returns the result of parsing. Throws on error.
basic_command_line_parser & ();
Specifies that unregistered options are allowed and should be passed though. For each command like token that looks like an option but does not contain a recognized name, an instance of basic_option<charT> will be added to result, with 'unrecognized' field set to 'true'. It's possible to collect all unrecognized options with the 'collect_unrecognized' funciton.
basic_command_line_parser & ( s);