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

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.

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 gen::unary_closure<std::istream&, void> more::io::cmdline::closure_type
 

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]
 

Construct the parser.


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.