Chris@16
|
1 #ifndef DATE_TIME_TIME_ZONE_NAMES_HPP__
|
Chris@16
|
2 #define DATE_TIME_TIME_ZONE_NAMES_HPP__
|
Chris@16
|
3
|
Chris@16
|
4 /* Copyright (c) 2002-2003,2005 CrystalClear Software, Inc.
|
Chris@16
|
5 * Use, modification and distribution is subject to the
|
Chris@16
|
6 * Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
7 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 * Author: Jeff Garland
|
Chris@101
|
9 * $Date$
|
Chris@16
|
10 */
|
Chris@16
|
11
|
Chris@16
|
12 #include <string>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost {
|
Chris@16
|
15 namespace date_time {
|
Chris@16
|
16
|
Chris@16
|
17 template<class CharT>
|
Chris@16
|
18 struct default_zone_names {
|
Chris@16
|
19 public:
|
Chris@16
|
20 typedef CharT char_type;
|
Chris@16
|
21 static const char_type standard_name[9];
|
Chris@16
|
22 static const char_type standard_abbrev[11];
|
Chris@16
|
23 static const char_type non_dst_identifier[7];
|
Chris@16
|
24 };
|
Chris@16
|
25 template <class CharT>
|
Chris@16
|
26 const typename default_zone_names<CharT>::char_type
|
Chris@16
|
27 default_zone_names<CharT>::standard_name[9] =
|
Chris@16
|
28 {'s','t','d','_','n','a','m','e'};
|
Chris@16
|
29
|
Chris@16
|
30 template <class CharT>
|
Chris@16
|
31 const typename default_zone_names<CharT>::char_type
|
Chris@16
|
32 default_zone_names<CharT>::standard_abbrev[11] =
|
Chris@16
|
33 {'s','t','d','_','a','b','b','r','e','v'};
|
Chris@16
|
34
|
Chris@16
|
35 template <class CharT>
|
Chris@16
|
36 const typename default_zone_names<CharT>::char_type
|
Chris@16
|
37 default_zone_names<CharT>::non_dst_identifier[7] =
|
Chris@16
|
38 {'n','o','-','d','s','t'};
|
Chris@16
|
39
|
Chris@16
|
40 //! Base type that holds various string names for timezone output.
|
Chris@16
|
41 /*! Class that holds various types of strings used for timezones.
|
Chris@16
|
42 * For example, for the western United States there is the full
|
Chris@16
|
43 * name: Pacific Standard Time and the abbreviated name: PST.
|
Chris@16
|
44 * During daylight savings there are additional names:
|
Chris@16
|
45 * Pacific Daylight Time and PDT.
|
Chris@16
|
46 *@parm CharT Allows class to support different character types
|
Chris@16
|
47 */
|
Chris@16
|
48 template<class CharT>
|
Chris@16
|
49 class time_zone_names_base
|
Chris@16
|
50 {
|
Chris@16
|
51 public:
|
Chris@16
|
52 typedef std::basic_string<CharT> string_type;
|
Chris@16
|
53 time_zone_names_base() :
|
Chris@16
|
54 std_zone_name_(default_zone_names<CharT>::standard_name),
|
Chris@16
|
55 std_zone_abbrev_(default_zone_names<CharT>::standard_abbrev),
|
Chris@16
|
56 dst_zone_name_(default_zone_names<CharT>::non_dst_identifier),
|
Chris@16
|
57 dst_zone_abbrev_(default_zone_names<CharT>::non_dst_identifier)
|
Chris@16
|
58 {}
|
Chris@16
|
59 time_zone_names_base(const string_type& std_zone_name_str,
|
Chris@16
|
60 const string_type& std_zone_abbrev_str,
|
Chris@16
|
61 const string_type& dst_zone_name_str,
|
Chris@16
|
62 const string_type& dst_zone_abbrev_str) :
|
Chris@16
|
63 std_zone_name_(std_zone_name_str),
|
Chris@16
|
64 std_zone_abbrev_(std_zone_abbrev_str),
|
Chris@16
|
65 dst_zone_name_(dst_zone_name_str),
|
Chris@16
|
66 dst_zone_abbrev_(dst_zone_abbrev_str)
|
Chris@16
|
67 {}
|
Chris@16
|
68 string_type dst_zone_abbrev() const
|
Chris@16
|
69 {
|
Chris@16
|
70 return dst_zone_abbrev_;
|
Chris@16
|
71 }
|
Chris@16
|
72 string_type std_zone_abbrev() const
|
Chris@16
|
73 {
|
Chris@16
|
74 return std_zone_abbrev_;
|
Chris@16
|
75 }
|
Chris@16
|
76 string_type dst_zone_name() const
|
Chris@16
|
77 {
|
Chris@16
|
78 return dst_zone_name_;
|
Chris@16
|
79 }
|
Chris@16
|
80 string_type std_zone_name() const
|
Chris@16
|
81 {
|
Chris@16
|
82 return std_zone_name_;
|
Chris@16
|
83 }
|
Chris@16
|
84 private:
|
Chris@16
|
85 string_type std_zone_name_;
|
Chris@16
|
86 string_type std_zone_abbrev_;
|
Chris@16
|
87 string_type dst_zone_name_;
|
Chris@16
|
88 string_type dst_zone_abbrev_;
|
Chris@16
|
89
|
Chris@16
|
90 };
|
Chris@16
|
91
|
Chris@16
|
92 //! Specialization of timezone names for standard char.
|
Chris@16
|
93 //typedef time_zone_names_base<char> time_zone_names;
|
Chris@16
|
94
|
Chris@16
|
95 } } //namespace
|
Chris@16
|
96
|
Chris@16
|
97
|
Chris@16
|
98 #endif
|