|
Boost Users : |
Subject: Re: [Boost-users] [Chrono] IO formatting doc minimal/ missing/ appears not to match the actual code base
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-09-03 18:09:51
Le 03/09/15 23:55, Vicente J. Botet Escriba a écrit :
> Le 03/09/15 17:03, Hickman, Steve (AdvTech) a écrit :
>
> Hi and thanks for catching all these issues.
>> As of at least Boost 1.58 / 1.59 (possibly earlier), the
>> documentation for Boost.Chrono V2 IO appears to be out of synch with
>> the actual libraries in the following ways:
>>
>> 1) Header file names to include as described in the doc don't
>> match the file names actually available to include. I was unable to
>> find <boost/chrono/io/ios_state.hpp>. I did find
>> <boost/chrono/io/ios_base_state.hpp> but it appears to include things
>> not described in the doc for <boost/chrono/io/ios_state.hpp>.
> I will change the filename. Does the file includes everything included
> in the doc? If not, what is missing?
> Is there something in the file that you want to be documented as public?
>>
>> 2) Some format tags are listed as 'unsupported', but there is no
>> description of what that means. Does it mean they are ignored? Does
>> a string still match (which means the input reader will move past
>> those bytes)?
> I don't reach to locate "unsupported". Please could you be more precise?
>> 3) I was able to find some examples in chrono\test\io . It would
>> be nice if the tutorial made reference to these as a source of
>> additional info.
> I will try it.
What is on the test/io directory is already on the tutorial. I recognize
that not all the interface is in the tutorial, but writing tutorials is
not my best card.
>>
>> 4) There appear to be a number of interfaces whose doc appears
>> to consist only of what is embedded in the header files (or I just
>> didn't find the doc for them): time_point_get, etc. Not being
>> familiar with how facets work, I'm not certain if I should be using
>> these directly or not.
> a facet that can be used the same way as std::num_get. I will add
> some examples on how to use it.
Next follows an example of how I use it from the implementation of the
extraction operator<<. I'm not sure this is the best way to implement
it but anyway this will give you an idea.
template <class CharT, class Traits, class Clock, class Duration>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, time_point<Clock,
Duration>& tp)
{
std::ios_base::iostate err = std::ios_base::goodbit;
BOOST_TRY
{
typename std::basic_istream<CharT, Traits>::sentry ipfx(is);
if (bool(ipfx))
{
if (!std::has_facet<time_point_get<CharT> >(is.getloc()))
{
time_point_get<CharT> ().get(is,
std::istreambuf_iterator<CharT, Traits>(), is, err, tp);
}
else
{
std::use_facet<time_point_get<CharT> >(is.getloc()).get(is,
std::istreambuf_iterator<CharT, Traits>(), is,
err, tp);
}
}
}
BOOST_CATCH (...)
{
bool flag = false;
BOOST_TRY
{
is.setstate(std::ios_base::failbit);
}
BOOST_CATCH (std::ios_base::failure )
{
flag = true;
}
BOOST_CATCH_END
if (flag) throw;
}
BOOST_CATCH_END
if (err) is.setstate(err);
return is;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net