|
Boost : |
Subject: Re: [boost] Proposed date-time patch [ Refs #2475 ]
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-05-02 20:10:59
AMDG
On 05/02/2011 03:31 PM, Marshall Clow wrote:
> 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)
Should't this be std::istream?
> + {
> + 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
>
Any particular reason you changed the brace style?
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk