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

source code of boost/boost/date_time/time_zone_names.hpp