Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:37

0001 #ifndef DATE_TIME_SIMPLE_FORMAT_HPP___
0002 #define DATE_TIME_SIMPLE_FORMAT_HPP___
0003 
0004 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
0005  * Use, modification and distribution is subject to the 
0006  * Boost Software License, Version 1.0. (See accompanying
0007  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
0008  * Author: Jeff Garland, Bart Garst
0009  * $Date$
0010  */
0011 
0012 #include "boost/date_time/parse_format_base.hpp"
0013 
0014 namespace boost {
0015 namespace date_time {
0016 
0017 //! Class to provide simple basic formatting rules
0018 template<class charT>
0019 class simple_format {
0020 public:
0021 
0022   //! String used printed is date is invalid
0023   static const charT* not_a_date()
0024   {
0025     return "not-a-date-time";
0026   }
0027   //! String used to for positive infinity value
0028   static const charT* pos_infinity()
0029   {  
0030     return "+infinity";
0031   }
0032   //! String used to for positive infinity value
0033   static const charT* neg_infinity()
0034   {
0035     return "-infinity";
0036   }
0037   //! Describe month format
0038   static month_format_spec month_format()
0039   {
0040     return month_as_short_string;
0041   }
0042   static ymd_order_spec date_order()
0043   {
0044     return ymd_order_iso; //YYYY-MM-DD
0045   }
0046   //! This format uses '-' to separate date elements
0047   static bool has_date_sep_chars()
0048   {
0049     return true;
0050   }
0051   //! Char to sep?
0052   static charT year_sep_char()
0053   {
0054     return '-';
0055   }
0056   //! char between year-month
0057   static charT month_sep_char()
0058   {
0059     return '-';
0060   }
0061   //! Char to separate month-day
0062   static charT day_sep_char()
0063   {
0064     return '-';
0065   }
0066   //! char between date-hours
0067   static charT hour_sep_char()
0068   {
0069     return ' ';
0070   }
0071   //! char between hour and minute
0072   static charT minute_sep_char()
0073   {
0074     return ':';
0075   }
0076   //! char for second
0077   static charT second_sep_char()
0078   {
0079     return ':';
0080   }
0081 
0082 };
0083 
0084 #ifndef BOOST_NO_STD_WSTRING
0085 
0086 //! Specialization of formmating rules for wchar_t
0087 template<>
0088 class simple_format<wchar_t> {
0089 public:
0090 
0091   //! String used printed is date is invalid
0092   static const wchar_t* not_a_date()
0093   {
0094     return L"not-a-date-time";
0095   }
0096   //! String used to for positive infinity value
0097   static const wchar_t* pos_infinity()
0098   {   
0099     return L"+infinity";
0100   }
0101   //! String used to for positive infinity value
0102   static const wchar_t* neg_infinity()
0103   {
0104     return L"-infinity";
0105   }
0106   //! Describe month format
0107   static month_format_spec month_format()
0108   {
0109     return month_as_short_string;
0110   }
0111   static ymd_order_spec date_order()
0112   {
0113     return ymd_order_iso; //YYYY-MM-DD
0114   }
0115   //! This format uses '-' to separate date elements
0116   static bool has_date_sep_chars()
0117   {
0118     return true;
0119   }
0120   //! Char to sep?
0121   static wchar_t year_sep_char()
0122   {
0123     return '-';
0124   }
0125   //! char between year-month
0126   static wchar_t month_sep_char()
0127   {
0128     return '-';
0129   }
0130   //! Char to separate month-day
0131   static wchar_t day_sep_char()
0132   {
0133     return '-';
0134   }
0135   //! char between date-hours
0136   static wchar_t hour_sep_char()
0137   {
0138     return ' ';
0139   }
0140   //! char between hour and minute
0141   static wchar_t minute_sep_char()
0142   {
0143     return ':';
0144   }
0145   //! char for second
0146   static wchar_t second_sep_char()
0147   {
0148     return ':';
0149   }
0150 
0151 };
0152 
0153 #endif // BOOST_NO_STD_WSTRING
0154 } } //namespace date_time
0155 
0156 
0157 
0158 
0159 #endif