A command line menu. More...

#include <CommandLine.h>

Inheritance diagram for CommandLine::Menu:
Reference::Able Reference::HeapTracked

Public Member Functions

 Menu ()
 Construct with two default options: –help and –version.
virtual void set_help_header (const std::string &s)
 Set the help header (activates -h,–help)
std::string get_help_header () const
 Get the help header.
virtual void set_help_footer (const std::string &s)
 Set the help footer.
std::string get_help_footer () const
 Get the help footer.
virtual void add_help ()
 Add the –help command line option.
virtual void set_version (const std::string &s)
 Set the version information string (activates -i,–version)
virtual void add_version ()
 Add the –version command line option.
virtual void parse (int argc, char *const *argv)
 Parse the command line.
virtual int process_error (int code, char *const *argv)
 Process any option parsing error and return a new code.
virtual void add (Item *)
 Add an item to the menu.
virtual void remove (Item *)
 Remove an item from the menu.
template<typename T>
Argumentadd (T &value, char name, const char *type=0)
 Add a Value with only a single letter name.
template<typename T>
Argumentadd (T &value, const std::string &name, const char *type=0)
 Add a Value with only a long string name.
Argumentadd (Functor< void(const std::string &) > action, char name, const char *type=0)
 Add an parse action with only a single letter name.
Argumentadd (Functor< void(const std::string &) > action, const std::string &name, const char *type=0)
 Add a parse action with only a long string name.
template<class C, class B, typename T>
Argumentadd (C *ptr, void(B::*method)(T), char name, const char *type=0)
 Add an Attribute with only a single letter name.
template<class C, class B, typename T>
Argumentadd (C *ptr, void(B::*method)(T), const std::string &name, const char *type=0)
 Add an Attribute with only a long string name.
template<class C, typename M, typename P>
Argumentadd (C *ptr, M method, P parse, char name, const char *type)
 Add an Attribute with only a single letter name.
template<class C, typename M, typename P>
Argumentadd (C *ptr, M method, P parse, const std::string &name, const char *type)
 Add an Attribute with only a long string name.
template<class C, class B>
Argumentadd (C *ptr, void(B::*method)(), char name)
 Add an Action with only a single letter name.
template<class C, class B>
Argumentadd (C *ptr, void(B::*method)(), const std::string &name)
 Add an Action with only a long string name.
template<class C, class B, class T>
Argumentadd (C *ptr, void(B::*method)(T), char name, T arg)
 Add an UnaryAction with only a single letter name.
template<class C, class B, class T>
Argumentadd (C *ptr, void(B::*method)(T), const std::string &name, T arg)
 Add an UnaryAction with only a long string name.
Argumentfind (const std::string &name)
 Find the named Argument.
void add (const std::string &)
 Add a Heading with the given text.
void help (const std::string &)
 Print help and exit.
void version ()
 Print version and exit.
Public Member Functions inherited from Reference::Able
 Able ()
 Default constructor.
 Able (const Able &)
 Copy constructor.
Ableoperator= (const Able &)
 Assignment operator.
virtual ~Able ()
 Destructor.
unsigned get_reference_count () const
 Returns the number of references there are to this.
Public Member Functions inherited from Reference::HeapTracked
 HeapTracked ()
 Default constructor.
 HeapTracked (const HeapTracked &)
 Copy constructor.
HeapTrackedoperator= (const HeapTracked &)
 Assignment operator.
virtual ~HeapTracked ()
 Destructor.
bool __is_on_heap () const
 Return true if this instance is found in heap addresses.

Protected Member Functions

template<typename T, typename N, typename S>
Argumentadd_value (T &value, N name, S set, const char *type)
 Add a Value with only a long string name.
template<class C, typename M, typename P, typename N, typename S>
Argumentadd_attribute (C *ptr, M method, P parse, N name, S set, const char *type)
template<typename N, typename S>
Argumentadd_parser (Functor< void(const std::string &) > &action, N name, S set, const char *type)
template<class C, typename M, typename N, typename S>
Argumentadd_action (C *ptr, M method, N name, S set)
template<class C, typename M, typename N, typename S, typename T>
Argumentadd_action (C *ptr, M method, N name, S set, T arg)
Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 Add the address of a reference to this object.
void __dereference (bool auto_delete=true) const
 Remove the address of a reference to this object.

Protected Attributes

std::vector< Reference::To< Item > > item
std::string version_info
Argumentversion_item
std::string help_header
std::string help_footer
Argumenthelp_item

Additional Inherited Members

Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 Returns the current number instances in existence.
Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 Records the addresses of new instances allocated on the heap.
static void operator delete (void *location, void *ptr)
 Placement delete overload to match the placement new overload.
static void operator delete (void *location)
 Regular delete overload.
static size_t get_heap_queue_size ()
 Return the number of heap addresses awaiting processing.

Detailed Description

A command line menu.


The documentation for this class was generated from the following files:

Generated using doxygen 1.14.0