fix doc example typo
[boost.git] / boost / date_time / date_format_simple.hpp
blob452990379b20e0fb3ddfc250c83d3fd31453e985
1 #ifndef DATE_TIME_SIMPLE_FORMAT_HPP___
2 #define DATE_TIME_SIMPLE_FORMAT_HPP___
4 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
5 * Use, modification and distribution is subject to the
6 * Boost Software License, Version 1.0. (See accompanying
7 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
8 * Author: Jeff Garland, Bart Garst
9 * $Date$
12 #include "boost/date_time/parse_format_base.hpp"
14 namespace boost {
15 namespace date_time {
17 //! Class to provide simple basic formatting rules
18 template<class charT>
19 class simple_format {
20 public:
22 //! String used printed is date is invalid
23 static const charT* not_a_date()
25 return "not-a-date-time";
27 //! String used to for positive infinity value
28 static const charT* pos_infinity()
30 return "+infinity";
32 //! String used to for positive infinity value
33 static const charT* neg_infinity()
35 return "-infinity";
37 //! Describe month format
38 static month_format_spec month_format()
40 return month_as_short_string;
42 static ymd_order_spec date_order()
44 return ymd_order_iso; //YYYY-MM-DD
46 //! This format uses '-' to separate date elements
47 static bool has_date_sep_chars()
49 return true;
51 //! Char to sep?
52 static charT year_sep_char()
54 return '-';
56 //! char between year-month
57 static charT month_sep_char()
59 return '-';
61 //! Char to separate month-day
62 static charT day_sep_char()
64 return '-';
66 //! char between date-hours
67 static charT hour_sep_char()
69 return ' ';
71 //! char between hour and minute
72 static charT minute_sep_char()
74 return ':';
76 //! char for second
77 static charT second_sep_char()
79 return ':';
84 #ifndef BOOST_NO_STD_WSTRING
86 //! Specialization of formmating rules for wchar_t
87 template<>
88 class simple_format<wchar_t> {
89 public:
91 //! String used printed is date is invalid
92 static const wchar_t* not_a_date()
94 return L"not-a-date-time";
96 //! String used to for positive infinity value
97 static const wchar_t* pos_infinity()
99 return L"+infinity";
101 //! String used to for positive infinity value
102 static const wchar_t* neg_infinity()
104 return L"-infinity";
106 //! Describe month format
107 static month_format_spec month_format()
109 return month_as_short_string;
111 static ymd_order_spec date_order()
113 return ymd_order_iso; //YYYY-MM-DD
115 //! This format uses '-' to separate date elements
116 static bool has_date_sep_chars()
118 return true;
120 //! Char to sep?
121 static wchar_t year_sep_char()
123 return '-';
125 //! char between year-month
126 static wchar_t month_sep_char()
128 return '-';
130 //! Char to separate month-day
131 static wchar_t day_sep_char()
133 return '-';
135 //! char between date-hours
136 static wchar_t hour_sep_char()
138 return ' ';
140 //! char between hour and minute
141 static wchar_t minute_sep_char()
143 return ':';
145 //! char for second
146 static wchar_t second_sep_char()
148 return ':';
153 #endif // BOOST_NO_STD_WSTRING
154 } } //namespace date_time
159 #endif