Boost logo

Boost :

Subject: [boost] Proposed date-time patch [ Refs #2475 ]
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-05-02 18:31:54


Here's a proposed patch for ticket #2475.
https://svn.boost.org/trac/boost/ticket/2475
Anyone love it? Hate it?

Index: ../../../boost/date_time/tz_db_base.hpp
===================================================================
--- ../../../boost/date_time/tz_db_base.hpp (revision 71667)
+++ ../../../boost/date_time/tz_db_base.hpp (working copy)
@@ -166,22 +166,26 @@
       //! Constructs an empty database
       tz_db_base() {}
 
+ //! Process csv data stream, may throw exceptions
+ /*! May throw bad_field_count exceptions */
+ void load_from_stream(std::ifstream &ifs)
+ {
+ std::string buff;
+ while( std::getline(ifs, buff))
+ parse_string(buff);
+ }
+
       //! Process csv data file, may throw exceptions
       /*! May throw data_not_accessible, or bad_field_count exceptions */
       void load_from_file(const std::string& pathspec)
       {
- string_type in_str;
- std::string buff;
-
         std::ifstream ifs(pathspec.c_str());
- if(!ifs){
+ if(!ifs)
           boost::throw_exception(data_not_accessible(pathspec));
- }
+
+ std::string buff;
         std::getline(ifs, buff); // first line is column headings
-
- while( std::getline(ifs, buff)) {
- parse_string(buff);
- }
+ load_from_stream(ifs);
       }
 
       //! returns true if record successfully added to map

-- Marshall


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk