Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template special_values_formatter

boost::date_time::special_values_formatter — Class that provides generic formmatting ostream formatting for special values.

Synopsis

// In header: <boost/date_time/special_values_formatter.hpp>

template<typename CharT, 
         typename OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > 
class special_values_formatter {
public:
  // types
  typedef std::basic_string< CharT > string_type;    
  typedef CharT                      char_type;      
  typedef std::vector< string_type > collection_type;

  // construct/copy/destruct
  special_values_formatter();
  special_values_formatter(const char_type *const *, const char_type *const *);
  special_values_formatter(typename collection_type::iterator, 
                           typename collection_type::iterator);

  // public member functions
  OutItrT put_special(OutItrT, const boost::date_time::special_values &) const;

  // public data members
  static const char_type default_special_value_names;  // Storage for the strings used to indicate special values. 
};

Description

This class provides for the formmating of special values to an output stream. In particular, it produces strings for the values of negative and positive infinity as well as not_a_date_time.

While not a facet, this class is used by the date and time facets for formatting special value types.

special_values_formatter public construct/copy/destruct

  1. special_values_formatter();
    Construct special values formatter using default strings.

    Default strings are not-a-date-time -infinity +infinity

  2. special_values_formatter(const char_type *const * begin, 
                             const char_type *const * end);
    Construct special values formatter from array of strings.

    This constructor will take pair of iterators from an array of strings that represent the special values and copy them for use in formatting special values.

      const char* const special_value_names[]={"nadt","-inf","+inf" };
    
      special_value_formatter svf(&special_value_names[0], &special_value_names[3]);
         *
    

  3. special_values_formatter(typename collection_type::iterator beg, 
                             typename collection_type::iterator end);

special_values_formatter public member functions

  1. OutItrT put_special(OutItrT next, 
                        const boost::date_time::special_values & value) const;

PrevUpHomeNext