Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::chrono::duration_put< CharT, OutputIterator > Class Template Reference

#include <duration_put.hpp>

Inheritance diagram for boost::chrono::duration_put< CharT, OutputIterator >:
Collaboration diagram for boost::chrono::duration_put< CharT, OutputIterator >:

Public Types

typedef CharT char_type
 Type of character the facet is instantiated on. More...
 
typedef std::basic_string< CharT > string_type
 Type of character string passed to member functions. More...
 
typedef OutputIterator iter_type
 Type of iterator used to write in the character buffer. More...
 

Public Member Functions

 duration_put (size_t refs=0)
 Construct a duration_put facet. More...
 
template<typename Rep , typename Period >
iter_type put (iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d, const CharT *pattern, const CharT *pat_end) const
 
template<typename Rep , typename Period >
iter_type put (duration_units< CharT > const &units_facet, iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d, const CharT *pattern, const CharT *pat_end) const
 
template<typename Rep , typename Period >
iter_type put (iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d) const
 
template<typename Rep , typename Period >
iter_type put_value (iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d) const
 
template<typename Rep , typename Period >
iter_type put_value (iter_type s, std::ios_base &ios, char_type fill, duration< process_times< Rep >, Period > const &d) const
 
template<typename Rep , typename Period >
iter_type put_unit (iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d) const
 
template<typename Rep , typename Period >
iter_type put_unit (duration_units< CharT > const &facet, iter_type s, std::ios_base &ios, char_type fill, duration< Rep, Period > const &d) const
 
template<typename Rep , typename Period >
iter_type put_unit (duration_units< CharT > const &facet, iter_type s, std::ios_base &ios, char_type fill, duration< process_times< Rep >, Period > const &d) const
 
 ~duration_put ()
 Destroy the facet More...
 

Static Public Attributes

static std::locale::id id
 Unique identifier for this type of facet. More...
 

Detailed Description

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
class boost::chrono::duration_put< CharT, OutputIterator >

Template Parameters
ChatTa character type
OutputIteratora model of OutputIterator

The duration_put facet provides facilities for formatted output of duration values. The member function of duration_put take a duration and format it into character string representation.

Member Typedef Documentation

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
typedef CharT boost::chrono::duration_put< CharT, OutputIterator >::char_type

Type of character the facet is instantiated on.

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
typedef OutputIterator boost::chrono::duration_put< CharT, OutputIterator >::iter_type

Type of iterator used to write in the character buffer.

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
typedef std::basic_string<CharT> boost::chrono::duration_put< CharT, OutputIterator >::string_type

Type of character string passed to member functions.

Constructor & Destructor Documentation

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
boost::chrono::duration_put< CharT, OutputIterator >::duration_put ( size_t  refs = 0)
inlineexplicit

Construct a duration_put facet.

Parameters
refsConstruct a duration_put facet. If the refs argument is 0 then destruction of the object is delegated to the locale, or locales, containing it. This allows the user to ignore lifetime management issues. On the other had, if refs is 1 then the object must be explicitly deleted; the locale will not do so. In this case, the object can be maintained across the lifetime of multiple locales.
template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
boost::chrono::duration_put< CharT, OutputIterator >::~duration_put ( )
inline

Destroy the facet

Member Function Documentation

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put ( iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d,
const CharT *  pattern,
const CharT *  pat_end 
) const
inline
Parameters
san output stream iterator
iosa reference to a ios_base
fillthe character used as filler
dthe duration
patternbegin of the formatting pattern
pat_endend of the formatting pattern

Steps through the sequence from pattern to pat_end, identifying characters that are part of a pattern sequence. Each character that is not part of a pattern sequence is written to s immediately, and each pattern sequence, as it is identified, results in a call to put_value or put_unit; thus, pattern elements and other characters are interleaved in the output in the order in which they appear in the pattern. Pattern sequences are identified by converting each character c to a char value as if by ct.narrow(c,0), where ct is a reference to ctype<charT> obtained from ios.getloc(). The first character of each sequence is equal to '', followed by a pattern specifier character spec, which can be 'v' for the duration value or 'u' for the duration unit. . For each valid pattern sequence identified, calls put_value(s, ios, fill, d) or put_unit(s, ios, fill, d).

An iterator pointing immediately after the last character produced.

Referenced by boost::chrono::operator<<(), boost::chrono::duration_put< CharT, OutputIterator >::put(), boost::chrono::time_point_put< CharT, OutputIterator >::put_duration(), boost::chrono::duration_put< CharT, OutputIterator >::put_unit(), and boost::chrono::duration_put< CharT, OutputIterator >::put_value().

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put ( duration_units< CharT > const &  units_facet,
iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d,
const CharT *  pattern,
const CharT *  pat_end 
) const
inline
template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put ( iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d 
) const
inline
Parameters
san output stream iterator
iosa reference to a ios_base
fillthe character used as filler
dthe duration imbue in ios the duration_units_default facet if not already present. Retrieves Stores the duration pattern from the duration_unit facet in let say str. Last as if
return put(s, ios, d, str.data(), str.data() + str.size());
An iterator pointing immediately after the last character produced.

References boost::chrono::duration_units< CharT >::get_pattern(), boost::chrono::duration_units_default< CharT >::get_pattern(), boost::chrono::duration_put< CharT, OutputIterator >::put(), and boost::str().

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put_unit ( iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d 
) const
inline
Parameters
san output stream iterator
iosa reference to a ios_base
fillthe character used as filler
dthe duration Let facet be the duration_units<CharT> facet associated to ios. If the associated unit is named, as if
string_type str = facet.get_unit(get_duration_style(ios), d);
s=std::copy(str.begin(), str.end(), s);
Otherwise, format the unit as "[Period::num/Period::den]" followed by the unit associated to [N/D] obtained using facet.get_n_d_unit(get_duration_style(ios), d) s, iterator pointing immediately after the last character produced.

Referenced by boost::chrono::duration_put< CharT, OutputIterator >::put().

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put_unit ( duration_units< CharT > const &  facet,
iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d 
) const
inline
template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put_unit ( duration_units< CharT > const &  facet,
iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< process_times< Rep >, Period > const &  d 
) const
inline
template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put_value ( iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< Rep, Period > const &  d 
) const
inline
Parameters
san output stream iterator
iosa reference to a ios_base
fillthe character used as filler
dthe duration As if s=std::use_facet<std::num_put<CharT, iter_type> >(ios.getloc()).put(s, ios, fill, static_cast<long int> (d.count())). s, iterator pointing immediately after the last character produced.

References boost::chrono::duration< Rep, Period >::count(), and boost::chrono::duration_put< CharT, OutputIterator >::put().

Referenced by boost::chrono::duration_put< CharT, OutputIterator >::put(), and boost::chrono::duration_put< CharT, OutputIterator >::put_value().

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
template<typename Rep , typename Period >
iter_type boost::chrono::duration_put< CharT, OutputIterator >::put_value ( iter_type  s,
std::ios_base &  ios,
char_type  fill,
duration< process_times< Rep >, Period > const &  d 
) const
inline

Member Data Documentation

template<class CharT, class OutputIterator = std::ostreambuf_iterator<CharT>>
std::locale::id boost::chrono::duration_put< CharT, OutputIterator >::id
static

Unique identifier for this type of facet.


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