stlencoders  1.1.3
Public Types | Public Member Functions | Protected Attributes | List of all members
stlencoders::line_wrap_iterator< Iterator, charT, traits > Class Template Reference

An output iterator adaptor used to wrap lines after a set number of characters. More...

Inheritance diagram for stlencoders::line_wrap_iterator< Iterator, charT, traits >:

Public Types

typedef Iterator iterator_type
 The underlying iterator type. More...
 
typedef charT char_type
 The character type. More...
 
typedef traits traits_type
 The character traits type. More...
 
typedef traits::off_type off_type
 An integral type holding the number of characters per line. More...
 

Public Member Functions

 line_wrap_iterator (Iterator i, off_type n, const charT *s)
 Constructs a line_wrap_iterator adaptor which will copy a delimiter string to the underlying iterator after every n characters. More...
 
Iterator base () const
 Returns current. More...
 
line_wrap_iteratoroperator= (char_type c)
 Copies a character to the underlying output iterator. More...
 
line_wrap_iteratoroperator* ()
 Returns *this. More...
 
line_wrap_iteratoroperator++ ()
 Returns *this. More...
 
line_wrap_iteratoroperator++ (int)
 Returns *this. More...
 

Protected Attributes

Iterator current
 The underlying iterator. More...
 

Detailed Description

template<class Iterator, class charT, class traits = std::char_traits<charT>>
class stlencoders::line_wrap_iterator< Iterator, charT, traits >

An output iterator adaptor used to wrap lines after a set number of characters.

Template Parameters
Iteratorthe underlying iterator class
charTthe output character type
traitsthe output character traits type

Member Typedef Documentation

template<class Iterator , class charT , class traits = std::char_traits<charT>>
typedef charT stlencoders::line_wrap_iterator< Iterator, charT, traits >::char_type

The character type.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
typedef Iterator stlencoders::line_wrap_iterator< Iterator, charT, traits >::iterator_type

The underlying iterator type.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
typedef traits::off_type stlencoders::line_wrap_iterator< Iterator, charT, traits >::off_type

An integral type holding the number of characters per line.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
typedef traits stlencoders::line_wrap_iterator< Iterator, charT, traits >::traits_type

The character traits type.

Constructor & Destructor Documentation

template<class Iterator , class charT , class traits = std::char_traits<charT>>
stlencoders::line_wrap_iterator< Iterator, charT, traits >::line_wrap_iterator ( Iterator  i,
off_type  n,
const charT *  s 
)
inline

Constructs a line_wrap_iterator adaptor which will copy a delimiter string to the underlying iterator after every n characters.

Parameters
ithe underlying iterator
nthe number of characters per line
sthe line delimiter string

Member Function Documentation

template<class Iterator , class charT , class traits = std::char_traits<charT>>
Iterator stlencoders::line_wrap_iterator< Iterator, charT, traits >::base ( ) const
inline

Returns current.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
line_wrap_iterator& stlencoders::line_wrap_iterator< Iterator, charT, traits >::operator* ( )
inline

Returns *this.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
line_wrap_iterator& stlencoders::line_wrap_iterator< Iterator, charT, traits >::operator++ ( )
inline

Returns *this.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
line_wrap_iterator& stlencoders::line_wrap_iterator< Iterator, charT, traits >::operator++ ( int  )
inline

Returns *this.

template<class Iterator , class charT , class traits = std::char_traits<charT>>
line_wrap_iterator& stlencoders::line_wrap_iterator< Iterator, charT, traits >::operator= ( char_type  c)
inline

Copies a character to the underlying output iterator.

If the maximum number of characters per line has been reached, copies the delimiter string to the underlying output iterator. Then outputs the given character and increments the underlying iterator.

Parameters
cthe character to be written
Returns
*this

Member Data Documentation

template<class Iterator , class charT , class traits = std::char_traits<charT>>
Iterator stlencoders::line_wrap_iterator< Iterator, charT, traits >::current
protected

The underlying iterator.