Warning, file /include/boost/date_time/special_values_formatter.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 
0002 #ifndef DATETIME_SPECIAL_VALUE_FORMATTER_HPP___
0003 #define DATETIME_SPECIAL_VALUE_FORMATTER_HPP___
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 #include <vector>
0014 #include <string>
0015 #include <iterator>
0016 #include "boost/date_time/special_defs.hpp"
0017 
0018 namespace boost { namespace date_time {
0019 
0020 
0021   
0022   
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030   template <class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
0031   class special_values_formatter  
0032   {
0033   public:
0034     typedef std::basic_string<CharT> string_type;
0035     typedef CharT                    char_type;
0036     typedef std::vector<string_type> collection_type;
0037     static const char_type default_special_value_names[3][17];
0038 
0039     
0040     
0041 
0042     special_values_formatter() 
0043     {
0044       std::copy(&default_special_value_names[0], 
0045                 &default_special_value_names[3], 
0046                 std::back_inserter(m_special_value_names));      
0047     }
0048 
0049     
0050     
0051 
0052 
0053 
0054 
0055 
0056 
0057 
0058 
0059     special_values_formatter(const char_type* const* begin, const char_type* const* end) 
0060     {
0061       std::copy(begin, end, std::back_inserter(m_special_value_names));
0062     }
0063     special_values_formatter(typename collection_type::iterator beg, typename collection_type::iterator end)
0064     {
0065       std::copy(beg, end, std::back_inserter(m_special_value_names));
0066     }
0067 
0068     OutItrT put_special(OutItrT next, 
0069                         const boost::date_time::special_values& value) const 
0070     {
0071       
0072       unsigned int index = value;
0073       if (index < m_special_value_names.size()) {
0074         std::copy(m_special_value_names[index].begin(), 
0075                   m_special_value_names[index].end(),
0076                   next);
0077       }
0078       return next;
0079     }
0080   protected:
0081     collection_type m_special_value_names;
0082   };
0083 
0084   
0085   
0086 
0087 
0088 
0089   template <class CharT, class OutItrT>  
0090   const typename special_values_formatter<CharT, OutItrT>::char_type special_values_formatter<CharT, OutItrT>::default_special_value_names[3][17] = { 
0091     {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
0092     {'-','i','n','f','i','n','i','t','y'},
0093     {'+','i','n','f','i','n','i','t','y'} };
0094 
0095  } } 
0096 
0097 #endif