BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE > Class Template Reference

#include <bslfmt_format_imp.h>

Detailed Description

template<class t_ITERATOR, class t_VALUE_TYPE, class t_DIFF_TYPE>
class bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >

This component-private type provides a stateful output iterator whose purpose is to count the number of characters written for use by the formatted_size free functions. It holds an underlying output iterator (to which writes are delegated), a maximum character count permitted and a current character count to keep track of how many characters would be written if there were no limit.

See bslfmt_format_imp

Public Types

typedef bsl::output_iterator_tag iterator_category
 
typedef t_DIFF_TYPE difference_type
 
typedef t_VALUE_TYPE value_type
 
typedef void reference
 
typedef void pointer
 

Public Member Functions

 Format_Imp_TruncatingIterator (t_ITERATOR iterator, t_DIFF_TYPE limit)
 
Format_Imp_TruncatingIteratoroperator* ()
 
void operator= (t_VALUE_TYPE x)
 
Format_Imp_TruncatingIteratoroperator++ ()
 
t_DIFF_TYPE count () const
 
t_ITERATOR underlying () const
 

Member Typedef Documentation

◆ difference_type

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
typedef t_DIFF_TYPE bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::difference_type

◆ iterator_category

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
typedef bsl::output_iterator_tag bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::iterator_category

◆ pointer

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
typedef void bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::pointer

◆ reference

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
typedef void bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::reference

◆ value_type

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
typedef t_VALUE_TYPE bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::value_type

Constructor & Destructor Documentation

◆ Format_Imp_TruncatingIterator()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::Format_Imp_TruncatingIterator ( t_ITERATOR  iterator,
t_DIFF_TYPE  limit 
)

Create a instance containing a copy of the specified iterator as underlying iterater with the maximum character count set to the specified limit and the current character count set to zero.

Member Function Documentation

◆ count()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
t_DIFF_TYPE bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::count ( ) const

Return the current character count.

Note
Note that this is the number of calls to operator= regardless of whether the limit has been breached.

◆ operator*()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE > & bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::operator* ( )

Do nothing and return a reference to this object. This is included to ensure compliance with the C++ Standard's LegacyOutputIterator requirements.

◆ operator++()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE > & bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::operator++ ( )

Do nothing and return a reference to this object. This is included to ensure compliance with the C++ Standard's LegacyOutputIterator requirements.

◆ operator=()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
void bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::operator= ( t_VALUE_TYPE  x)

Increment the current character count. If the current character count is less than the maximum character count (set on construction), assign the specified x to the stored underlying iterator and increment the stored underlying iterator.

◆ underlying()

template<class t_ITERATOR , class t_VALUE_TYPE , class t_DIFF_TYPE >
t_ITERATOR bslfmt::Format_Imp_TruncatingIterator< t_ITERATOR, t_VALUE_TYPE, t_DIFF_TYPE >::underlying ( ) const

Return the underlying iterator.


The documentation for this class was generated from the following file: