Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages
more::io::cmdline Class Reference
A command line parser.
More...
#include <more/io/cmdline.h>
List of all members.
Public Types
Public Methods
- cmdline (flag_type fl=0)
- Construct the parser. More...
- template<typename UnaryFunction> void insert_functional (std::string const &opt, std::string const &doc, UnaryFunction f)
- Insert an option which will call f with its argument. More...
- template<typename T> void insert_reference (std::string const &opt, std::string const &doc, T &x, bool ¬ify=null_notify)
- Insert an option which will set x to its argument. More...
- template<typename T> void insert_setter (std::string const &opt, std::string const &doc, T &x, T const &v)
- Insert an option which takes no arugment and causes
x=v
. More...
- template<typename T, typename OutputIterator> void insert_copier (std::string const &opt, std::string const &doc, OutputIterator it)
- Insert a reader which will copy each argument to opt to it. More...
- void optional ()
- Make the remaining arguments optional. More...
- void parse (int argc, char **argv)
- Parse (arg, argv) as given to
main
. More...
- void print_help (std::ostream &) const
- Print the documentation for the options. More...
Static Public Methods
Static Public Attributes
Detailed Description
A command line parser.
Make sure to catch the relax
exception. If you need to take control of the --help
option, you may alternatively detect it before calling parse
and possibly call print_help
within your own help printing code.
The following environment variables are handled by cmdline::parse
and causes set_tslang
to be called on the standard output streams.
MORE_IO_MARKUP
is the default markup language to use MORE_IO_COUT_MARKUP
overrides the ML for stdout. MORE_IO_CERR_MARKUP
overrides the ML for stderr.
Also, if MORE_IO_CMDLINE_ASSIGN
is set to true
or is unset parse
accepts assignment style long-options without the “--
” prefix, and if it is set to false
the “--
” prefix is required.
Member Typedef Documentation
typedef unsigned int more::io::cmdline::flag_type
|
|
typedef std::size_t more::io::cmdline::size_type
|
|
Constructor & Destructor Documentation
more::io::cmdline::cmdline |
( |
flag_type |
fl = 0 |
) |
[explicit] |
|
Member Function Documentation
int more::io::cmdline::debug |
( |
|
) |
[inline, static] |
|
template<typename T, typename OutputIterator> |
void more::io::cmdline::insert_copier |
( |
std::string const & |
opt, |
|
|
std::string const & |
doc, |
|
|
OutputIterator |
it |
|
) |
[inline] |
|
|
Insert a reader which will copy each argument to opt to it.
|
template<typename UnaryFunction> |
void more::io::cmdline::insert_functional |
( |
std::string const & |
opt, |
|
|
std::string const & |
doc, |
|
|
UnaryFunction |
f |
|
) |
[inline] |
|
|
Insert an option which will call f with its argument.
This is the general form. |
template<typename T> |
void more::io::cmdline::insert_reference |
( |
std::string const & |
opt, |
|
|
std::string const & |
doc, |
|
|
T & |
x, |
|
|
bool & |
notify = null_notify |
|
) |
[inline] |
|
|
Insert an option which will set x to its argument.
|
template<typename T> |
void more::io::cmdline::insert_setter |
( |
std::string const & |
opt, |
|
|
std::string const & |
doc, |
|
|
T & |
x, |
|
|
T const & |
v |
|
) |
[inline] |
|
|
Insert an option which takes no arugment and causes x=v .
|
void more::io::cmdline::optional |
( |
|
) |
[inline] |
|
|
Make the remaining arguments optional.
|
void more::io::cmdline::parse |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
|
|
|
Parse (arg, argv) as given to main .
|
void more::io::cmdline::print_help |
( |
std::ostream & |
|
) |
const |
|
|
Print the documentation for the options.
This is done automatically when the --help option is given, provided you catch relax . |
std::string const& more::io::cmdline::program_name |
( |
|
) |
[inline, static] |
|
|
Return argv[0] as passed to parse .
|
int more::io::cmdline::verbose |
( |
|
) |
[inline, static] |
|
Member Data Documentation
flag_type const more::io::cmdline::disable_assignment_style = 2 [static]
|
|
flag_type const more::io::cmdline::enable_assignment_style = 1 [static]
|
|
The documentation for this class was generated from the following file:
Generated on Sat Sep 7 19:12:42 2002 for more with Doxygen
1.2.13.1. Doxygen 1.2.13.1 is written and copyright
1997-2002 by Dimitri van
Heesch.