Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

s11n::aliaser Class Reference

aliaser is a helper class for mapping single-token aliases to arbitrary strings, e.g., similarly to typical Unix shell alias support. More...

#include <aliaser.h>

List of all members.

Public Types

typedef std::map< std::string,
std::string > 
map_type
 The map used to store aliases.


Public Member Functions

map_typemap ()
 Returns the map of aliases-to-expansions.

const map_typemap () const
 Const form of map().

void alias (const std::string &al, const std::string &expanded)
 Aliases al as a shortcut for expanded.

std::string expand (const std::string &input) const
 Works similarly to Unix shells' alias expansion:.


Static Public Member Functions

aliaserinstance ()
 A shared instance of this object.

template<typename ContextType> aliasercontext ()
 context() is used for getting a "context singleton" - an instance of this object which is a quasi-singleton within the given ContextType.


Detailed Description

aliaser is a helper class for mapping single-token aliases to arbitrary strings, e.g., similarly to typical Unix shell alias support.

It is intended to be used in the creation of shell-like application interfaces, but may have uses elsewhere (e.g., aliases class names for class_loader<T>).

Definition at line 19 of file aliaser.h.


Member Function Documentation

void s11n::aliaser::alias const std::string &  al,
const std::string &  expanded
 

Aliases al as a shortcut for expanded.

al should be exactly one token.

If expanded is empty then any existing alias al is removed, and this is the way to unset an alias.

std::string s11n::aliaser::expand const std::string &  input  )  const
 

Works similarly to Unix shells' alias expansion:.

Expands the first input token as an alias. This expansion continues until the data can no longer be expanded to a new string.

It returns the expanded string, which may be identical to the input.

aliaser& s11n::aliaser::instance  )  [static]
 

A shared instance of this object.

Not post-main() safe.


The documentation for this class was generated from the following file:
Generated on Wed Jul 28 16:04:15 2004 for s11n by doxygen 1.3.7