VoiceMan
Public Types | Public Member Functions | List of all members
StringDelimitedIterator< T > Class Template Reference

Enumerates sequences in string separated by characters from specified set. More...

Public Types

typedef T::value_type CHAR
 

Public Member Functions

T::size_type end () const
 Returns index of the ending character of current sequence. More...
 
bool match (CHAR c) const
 Checks if specified character is in set of characters to find sequences with. More...
 
bool next ()
 Go to next sequence of enumeration. More...
 
T::size_type start () const
 Returns index of the starting character of current sequence. More...
 
str () const
 Returns current sequence. More...
 
 StringDelimitedIterator (const T &str, const T &chars)
 The constructor. More...
 

Detailed Description

template<class T>
class StringDelimitedIterator< T >

This class takes two string at the construction: first string specifies string to look through, second string specifies set of characters to separate parts to enumerate. During the enumeration this class returnes all substrings of maximum length separated by specified characters.

See also
StringIterator

Constructor & Destructor Documentation

template<class T >
StringDelimitedIterator< T >::StringDelimitedIterator ( const T &  str,
const T &  chars 
)
inline
Parameters
[in]strThe string to look through
[in]charsThe set of characters to separate substrings

Member Function Documentation

template<class T >
T::size_type StringDelimitedIterator< T >::end ( ) const
inline

Use this method to get index of ending character of the current sequence.

Returns
Index of ending character of sequence in string
template<class T >
bool StringDelimitedIterator< T >::match ( CHAR  c) const
inline

Use this method to check, if specified character can be included in sequences to return.

Parameters
[in]cThe character to check
Returns
Non-zero if character can be included in sequences to return
template<class T >
bool StringDelimitedIterator< T >::next ( )
inline

This method allows enumeration over all sequences of specified string. Just call it until it is returned false.

Returns
Non-zero if there is left sequences or zero otherwise
template<class T >
T::size_type StringDelimitedIterator< T >::start ( ) const
inline

Use this method to get index of starting character of the current sequence.

Returns
Index of starting character of sequence in string
template<class T >
T StringDelimitedIterator< T >::str ( ) const
inline

Use this method to get value of the sequence iterator is points to.

Returns
The current sequence