[Boost-bugs] [Boost C++ Libraries] #2475: Boost.Date_Time Enhancement - Load of Time Zone Database via istream

Subject: [Boost-bugs] [Boost C++ Libraries] #2475: Boost.Date_Time Enhancement - Load of Time Zone Database via istream
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-05 08:08:01


#2475: Boost.Date_Time Enhancement - Load of Time Zone Database via istream
------------------------------+---------------------------------------------
 Reporter: soenke_at_[hidden] | Owner: az_sw_dude
     Type: Feature Requests | Status: new
Milestone: Boost 1.38.0 | Component: date_time
  Version: Boost 1.36.0 | Severity: Optimization
 Keywords: |
------------------------------+---------------------------------------------
 Hello,
 in Boost.Date_Time there is a function to load the Time Zone Database from
 a file.
 The function 'load_from_file' takes a string as parameter which contains a
 local filename to load the database from.

 It is sometimes desirable to load the database from another source than a
 local file.

 To support this i suppose to add a function 'load' and alter the existing
 'load_from_file' in the following sense

 {{{
       void load( std::istream& ifs )
       {
         string_type in_str;
         std::string buff;

         if(!ifs){
           throw data_not_accessible();
         }
         std::getline(ifs, buff); // first line is column headings

         while( std::getline(ifs, buff)) {
           parse_string(buff);
         }
       }

       void load_from_file(const std::string& pathspec)
       {
         std::ifstream ifs(pathspec.c_str());
         if(!ifs){
           throw data_not_accessible(pathspec);
         }
         load( ifs );
       }

 }}}

 Best regards
 Sönke Schau

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2475>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC