Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef DATE_TIME_TIME_ZONE_NAMES_HPP__
0002 #define DATE_TIME_TIME_ZONE_NAMES_HPP__
0003 
0004 /* Copyright (c) 2002-2003,2005 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
0009  * $Date$
0010  */
0011 
0012 #include <string>
0013 
0014 namespace boost {
0015 namespace date_time {
0016 
0017   template<class CharT>
0018   struct default_zone_names {
0019     public:
0020       typedef CharT char_type;
0021       static const char_type standard_name[9];
0022       static const char_type standard_abbrev[11];
0023       static const char_type non_dst_identifier[7];
0024   };
0025   template <class CharT>
0026   const typename default_zone_names<CharT>::char_type
0027   default_zone_names<CharT>::standard_name[9] = 
0028     {'s','t','d','_','n','a','m','e'};
0029 
0030   template <class CharT>
0031   const typename default_zone_names<CharT>::char_type
0032   default_zone_names<CharT>::standard_abbrev[11] = 
0033     {'s','t','d','_','a','b','b','r','e','v'};
0034 
0035   template <class CharT>
0036   const typename default_zone_names<CharT>::char_type
0037   default_zone_names<CharT>::non_dst_identifier[7] = 
0038     {'n','o','-','d','s','t'};
0039 
0040   //! Base type that holds various string names for timezone output.
0041   /*! Class that holds various types of strings used for timezones.
0042    *  For example, for the western United States there is the full 
0043    *  name: Pacific Standard Time and the abbreviated name: PST.
0044    *  During daylight savings there are additional names:
0045    *  Pacific Daylight Time and PDT. 
0046    *@tparam CharT Allows class to support different character types
0047    */
0048   template<class CharT>
0049   class time_zone_names_base
0050   {
0051   public:
0052     typedef std::basic_string<CharT> string_type;
0053     time_zone_names_base() :
0054       std_zone_name_(default_zone_names<CharT>::standard_name),
0055       std_zone_abbrev_(default_zone_names<CharT>::standard_abbrev),
0056       dst_zone_name_(default_zone_names<CharT>::non_dst_identifier),
0057       dst_zone_abbrev_(default_zone_names<CharT>::non_dst_identifier)
0058     {}
0059     time_zone_names_base(const string_type& std_zone_name_str,
0060                          const string_type& std_zone_abbrev_str,
0061                          const string_type& dst_zone_name_str,
0062                          const string_type& dst_zone_abbrev_str) :
0063       std_zone_name_(std_zone_name_str),
0064       std_zone_abbrev_(std_zone_abbrev_str),
0065       dst_zone_name_(dst_zone_name_str),
0066       dst_zone_abbrev_(dst_zone_abbrev_str)
0067     {}
0068     string_type dst_zone_abbrev() const
0069     {
0070       return dst_zone_abbrev_;
0071     }
0072     string_type std_zone_abbrev() const
0073     {
0074       return std_zone_abbrev_;
0075     }
0076     string_type dst_zone_name() const
0077     {
0078       return dst_zone_name_;
0079     }
0080     string_type std_zone_name() const
0081     {
0082       return std_zone_name_;
0083     }
0084   private:
0085     string_type std_zone_name_;
0086     string_type std_zone_abbrev_;
0087     string_type dst_zone_name_;
0088     string_type dst_zone_abbrev_;
0089     
0090   };
0091   
0092   //! Specialization of timezone names for standard char.
0093   //typedef time_zone_names_base<char> time_zone_names;
0094 
0095 } } //namespace
0096 
0097 
0098 #endif