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

expander::expandcmd< StringType > Class Template Reference

An abstract base class for the commands. More...

#include <expandlib-cmd.h>

Inherited by expander::expcmd_abbr< StringType >, expander::expcmd_bpad< StringType >, expander::expcmd_btrunc< StringType >, expander::expcmd_fpad< StringType >, expander::expcmd_ftrunc< StringType >, expander::expcmd_if< StringType >, expander::expcmd_knownvars< StringType >, expander::expcmd_lower< StringType >, expander::expcmd_ltrim< StringType >, expander::expcmd_numvars< StringType >, expander::expcmd_rtrim< StringType >, expander::expcmd_trim< StringType >, expander::expcmd_unknownvars< StringType >, and expander::expcmd_upper< StringType >.

Inheritance diagram for expander::expandcmd< StringType >:

Inheritance graph
Collaboration diagram for expander::expandcmd< StringType >:

Collaboration graph
List of all members.

Public Methods

 expandcmd (expandable< StringType > *const eobj, const StringType cn)
 The only constructor allowable.

virtual void operator() (StringType &dest, const FParamVectorType &params, const FVarMapType &vars, ExpandResultsType &results) const=0
 Appends the outcome of the command to 'dest'.

void Register ()
 Registers this command with 'expobj'.


Protected Types

typedef ::std::vector< StringType > FParamVectorType
 The type used for the parameter vectors (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).

typedef ::std::map< StringType,
::expander::expandvartype<
StringType > * > 
FVarMapType
 The type used for the map of variables (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).

typedef ::std::map< StringType,
::expander::expandcmd< StringType > * > 
FCmdMapType
 The type used for the map of commands (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).


Protected Attributes

expandable< StringType
> *const 
expobj
 A const pointer to the expander::expandable object this command belongs to.

const StringType cmdname
 A const string containing the name of this command.


Private Methods

 expandcmd ()
 Private constructor to prevent incorrect construction.


Detailed Description

template<class StringType = ::std::string>
class expander::expandcmd< StringType >

An abstract base class for the commands.

This class is the class that all commands derive from. It's an abstract class because a NOP command doesn't make any sense and should therefor not be needed. This could change in the future, but for now this works perfectly.

It also holds a few typedefs that the commands inherit.

Definition at line 60 of file expandlib-cmd.h.


Member Typedef Documentation

template<class StringType = ::std::string>
typedef ::std::map<StringType, ::expander::expandcmd<StringType>*> expander::expandcmd< StringType >::FCmdMapType [protected]
 

The type used for the map of commands (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).

Definition at line 68 of file expandlib-cmd.h.

template<class StringType = ::std::string>
typedef ::std::vector<StringType> expander::expandcmd< StringType >::FParamVectorType [protected]
 

The type used for the parameter vectors (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).

Definition at line 66 of file expandlib-cmd.h.

template<class StringType = ::std::string>
typedef ::std::map<StringType, ::expander::expandvartype<StringType>*> expander::expandcmd< StringType >::FVarMapType [protected]
 

The type used for the map of variables (MSVC wouldn't allow me to use template arguments in these typedefs, or I don't know how it should be done).

Definition at line 67 of file expandlib-cmd.h.


Constructor & Destructor Documentation

template<class StringType = ::std::string>
expander::expandcmd< StringType >::expandcmd   [inline, private]
 

Private constructor to prevent incorrect construction.

Definition at line 63 of file expandlib-cmd.h.

template<class StringType = ::std::string>
expander::expandcmd< StringType >::expandcmd expandable< StringType > *const    eobj,
const StringType    cn
[inline]
 

The only constructor allowable.

It stores eobj and sets cmdname to cn.

Definition at line 83 of file expandlib-cmd.h.


Member Function Documentation

template<class StringType = ::std::string>
virtual void expander::expandcmd< StringType >::operator() StringType &    dest,
const FParamVectorType   params,
const FVarMapType   vars,
ExpandResultsType   results
const [pure virtual]
 

Appends the outcome of the command to 'dest'.

The () operator of a command will process the params (using the vars and keeping statistics in results) and APPEND the outcome to dest.

Implemented in expander::expcmd_abbr< StringType >, expander::expcmd_bpad< StringType >, expander::expcmd_btrunc< StringType >, expander::expcmd_fpad< StringType >, expander::expcmd_ftrunc< StringType >, expander::expcmd_if< StringType >, expander::expcmd_knownvars< StringType >, expander::expcmd_lower< StringType >, expander::expcmd_ltrim< StringType >, expander::expcmd_numvars< StringType >, expander::expcmd_rtrim< StringType >, expander::expcmd_trim< StringType >, expander::expcmd_unknownvars< StringType >, and expander::expcmd_upper< StringType >.

template<class StringType = ::std::string>
void expander::expandcmd< StringType >::Register   [inline]
 

Registers this command with 'expobj'.

Register adds itself to the expandable::cmdmap in expobj. But since there are no expandcmd instances (it's an abstract class), this will only be done by derived classes (which fill cmdname and expobj through the constructor).

Definition at line 96 of file expandlib-cmd.h.

References expander::expandable< StringType >::cmdmap.


Member Data Documentation

template<class StringType = ::std::string>
const StringType expander::expandcmd< StringType >::cmdname [protected]
 

A const string containing the name of this command.

This string is used by expandcmd::Register and initialized by the constructor, which is called by the constructor of a derived class (which passes its name to this class, so expandcmd::cmdname contains the right name.

Definition at line 77 of file expandlib-cmd.h.

template<class StringType = ::std::string>
expandable<StringType>* const expander::expandcmd< StringType >::expobj [protected]
 

A const pointer to the expander::expandable object this command belongs to.

Definition at line 71 of file expandlib-cmd.h.

Referenced by expander::expcmd_upper< StringType >::operator()(), expander::expcmd_unknownvars< StringType >::operator()(), expander::expcmd_trim< StringType >::operator()(), expander::expcmd_rtrim< StringType >::operator()(), expander::expcmd_numvars< StringType >::operator()(), expander::expcmd_ltrim< StringType >::operator()(), expander::expcmd_lower< StringType >::operator()(), expander::expcmd_knownvars< StringType >::operator()(), expander::expcmd_if< StringType >::operator()(), expander::expcmd_ftrunc< StringType >::operator()(), expander::expcmd_fpad< StringType >::operator()(), expander::expcmd_btrunc< StringType >::operator()(), expander::expcmd_bpad< StringType >::operator()(), and expander::expcmd_abbr< StringType >::operator()().


The documentation for this class was generated from the following file:
Generated on Tue Feb 4 17:24:25 2003 for ExpandLib by doxygen1.3-rc2