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

expander::expvartype_list< StringType, ItemType > Class Template Reference

The class that supplies the list vartype. More...

#include <expandlib-vartype-list.h>

Inherits expander::expandvartype< StringType >< StringType >.

Inheritance diagram for expander::expvartype_list< StringType, ItemType >:

Inheritance graph
Collaboration diagram for expander::expvartype_list< StringType, ItemType >:

Collaboration graph
List of all members.

Public Methods

 expvartype_list (const _TCHAR *const is=_T(","))
 Default contructor, inits the list to nothing.

 expvartype_list (const StringType &s, const _TCHAR *const is=_T(","))
 Constructor with a parameter of type StringType, inits the string to 's'.

 expvartype_list (const _TCHAR *s, const _TCHAR *const is=_T(","))
 Constructor with a C-style string as parameter, inits the string to 's'.

template<class T>  expvartype_list (T beg, const T end, const _TCHAR *const is=_T(","))
 Constructor using a begin and end iterator.

template<class T>  expvartype_list (const::std::vector< ItemType >::size_type n, const T val, const _TCHAR *const is=_T(","))
 Constructor using a count and a value (generates n elements with value v).

virtual void AppendValue (StringType &dest) const throw ()
 Appends the value of the var to a string.

virtual void AppendValue (StringType &dest, const FParamVectorType &params, const FVarMapType &vars, ExpandResultsType &results) const throw ()
 Appends the value of the var to a string, using params and rvars, putting any expanding results into results.

virtual void SetValue (const StringType &s)
 Sets this variable to the string specified.

inline::std::vector< ItemType > & get_list ()

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).


Protected Attributes

::std::vector< ItemType > list
const _TCHAR *const ItemSeparator

Detailed Description

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
class expander::expvartype_list< StringType, ItemType >

The class that supplies the list vartype.

This class can be used in the program using ExpandLib for lists of variables of a specific type.

Normally this will return a list of the elements separated by a comma and a space. It can however also receive parameters, the syntax for this is: ${listvar([(index|separator|'|')[,extraparams]])} If a number is given as the first parameter it is interpreted as an index into the list, it this index is -1 it will return the last item in the list. extraparams is passed on to each item in the list. If a | (pipe) is given as the first parameter extraparams will just be passed on to each item in the list. If neither a pipe nor a number is given as the first parameter it is used as separator. extraparams is passed on to each item in the list.

Since this class is also derived from std::vector<ItemType> any of its member functions can also be used on this type.

Definition at line 65 of file expandlib-vartype-list.h.


Member Typedef Documentation

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

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 52 of file expandlib-vartype.h.

Referenced by expander::expvartype_list< StringType, ItemType >::AppendValue().

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

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 53 of file expandlib-vartype.h.


Constructor & Destructor Documentation

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
expander::expvartype_list< StringType, ItemType >::expvartype_list const _TCHAR *const    is = _T(", ") [inline]
 

Default contructor, inits the list to nothing.

Definition at line 73 of file expandlib-vartype-list.h.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
expander::expvartype_list< StringType, ItemType >::expvartype_list const StringType &    s,
const _TCHAR *const    is = _T(", ")
[inline]
 

Constructor with a parameter of type StringType, inits the string to 's'.

Definition at line 76 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::SetValue().

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
expander::expvartype_list< StringType, ItemType >::expvartype_list const _TCHAR *    s,
const _TCHAR *const    is = _T(", ")
[inline]
 

Constructor with a C-style string as parameter, inits the string to 's'.

Definition at line 79 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::SetValue().

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
template<class T>
expander::expvartype_list< StringType, ItemType >::expvartype_list   beg,
const T    end,
const _TCHAR *const    is = _T(", ")
[inline]
 

Constructor using a begin and end iterator.

This constructor lets you initialize the list with another list (or in general anything that can be behave as an iterator).

Definition at line 85 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::list.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
template<class T>
expander::expvartype_list< StringType, ItemType >::expvartype_list const ::std::vector< ItemType >::size_type    n,
const T    val,
const _TCHAR *const    is = _T(", ")
[inline]
 

Constructor using a count and a value (generates n elements with value v).

Definition at line 93 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::list.


Member Function Documentation

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
virtual void expander::expvartype_list< StringType, ItemType >::AppendValue StringType &    dest,
const FParamVectorType   params,
const FVarMapType   vars,
ExpandResultsType   results
const throw () [inline, virtual]
 

Appends the value of the var to a string, using params and rvars, putting any expanding results into results.

This is called directly from 'expandable<StringType>::expand', when a variable with parameters has been found.

Implements expander::expandvartype< StringType >.

Definition at line 105 of file expandlib-vartype-list.h.

References expander::expandvartype< StringType >::FParamVectorType, and expander::expvartype_list< StringType, ItemType >::list.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
virtual void expander::expvartype_list< StringType, ItemType >::AppendValue StringType &    dest const throw () [inline, virtual]
 

Appends the value of the var to a string.

This is called by operator+=(StringType &s,::expander::expandvartype<StringType> *v), which is called by 'expandable<StringType>::expand' when a variable without parameters has been found.

Implements expander::expandvartype< StringType >.

Definition at line 95 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::list.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
inline ::std::vector<ItemType>& expander::expvartype_list< StringType, ItemType >::get_list   [inline]
 

Definition at line 179 of file expandlib-vartype-list.h.

References expander::expvartype_list< StringType, ItemType >::list.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
virtual void expander::expvartype_list< StringType, ItemType >::SetValue const StringType &    s [inline, virtual]
 

Sets this variable to the string specified.

Todo:
Have to make it possible to set a list with a string, using a tokenizer(?)

Implements expander::expandvartype< StringType >.

Definition at line 177 of file expandlib-vartype-list.h.

Referenced by expander::expvartype_list< StringType, ItemType >::expvartype_list().


Member Data Documentation

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
const _TCHAR* const expander::expvartype_list< StringType, ItemType >::ItemSeparator [protected]
 

Definition at line 68 of file expandlib-vartype-list.h.

template<class StringType = ::std::string, class ItemType = expvartype_text< StringType >>
::std::vector<ItemType> expander::expvartype_list< StringType, ItemType >::list [protected]
 

Definition at line 67 of file expandlib-vartype-list.h.

Referenced by expander::expvartype_list< StringType, ItemType >::AppendValue(), expander::expvartype_list< StringType, ItemType >::expvartype_list(), and expander::expvartype_list< StringType, ItemType >::get_list().


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