Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

commandl::char_matcher Class Reference

A matcher class that matches only on the first char of a key. More...

#include <char_matcher.hpp>

Inheritance diagram for commandl::char_matcher:

commandl::matcher List of all members.

Public Methods

 char_matcher ()
 A constructor which should be followed by a call to set_arguments(). More...

 char_matcher (std::vector< argument * >)
 Primary constructor for this class. More...

virtual ~char_matcher ()
virtual argumentmatch (const std::string &) const
 This method will perform matching on a string. More...

virtual std::string usage_key (const std::string &) const
virtual std::vector< std::string > usage_keys (const std::vector< std::string > &) const
virtual std::map< std::string,
argument * > 
resolve_keys (const std::vector< argument * > &)
 This method performs the task of providing unique keys. More...

virtual char_matcher * clone () const
 This method returns a newed copy of this object. More...


Detailed Description

A matcher class that matches only on the first char of a key.

This matcher only matches single character keys.


Constructor & Destructor Documentation

commandl::char_matcher::char_matcher  
 

A constructor which should be followed by a call to set_arguments().

commandl::char_matcher::char_matcher std::vector< argument * >    arguments
 

Primary constructor for this class.

commandl::char_matcher::~char_matcher   [virtual]
 


Member Function Documentation

commandl::char_matcher * commandl::char_matcher::clone   const [virtual]
 

This method returns a newed copy of this object.

Since the pointer returned has been newed, it is imperative that callers of this method are sure to call delete on the pointer.

Implements commandl::matcher.

commandl::argument * commandl::char_matcher::match const std::string &    key const [virtual]
 

This method will perform matching on a string.

However, the string should only be a single character long. Anything else will cause an exception.

Implements commandl::matcher.

std::map< std::string, commandl::argument * > commandl::char_matcher::resolve_keys const std::vector< argument * > &    arguments [virtual]
 

This method performs the task of providing unique keys.

For this class, doing so involves taking only the first character from the potential keys provided by the arguments. If there is a conflict between the first letters of two potential keys (like "file" and "forget"), then this method will throw.

Implements commandl::matcher.

std::string commandl::char_matcher::usage_key const std::string &    const [virtual]
 

Implements commandl::matcher.

std::vector< std::string > commandl::char_matcher::usage_keys const std::vector< std::string > &    const [virtual]
 

Implements commandl::matcher.


The documentation for this class was generated from the following files:
Generated on Sat Apr 5 21:17:28 2003 for commandl Library by doxygen1.2.15