Ticket #9586: greg_facet.hpp.patch

File greg_facet.hpp.patch, 2.7 KB (added by Zamfir Catalin Alexandru <catalinalexandru.zamfir@…>, 9 years ago)

Patch to use boost try/catch workaround

  • date_time/gregorian/greg_facet.hpp

     
    88 * Author: Jeff Garland, Bart Garst
    99 * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $
    1010 */
    11 
     11#define BOOST_NO_EXCEPTIONS
     12#include "boost/detail/no_exceptions_support.hpp"
    1213#include "boost/date_time/gregorian/gregorian_types.hpp"
    1314#include "boost/date_time/date_formatting_locales.hpp" // sets BOOST_DATE_TIME_NO_LOCALE
    1415#include "boost/date_time/gregorian/parsers.hpp"
     
    280281
    281282    short num = 0;
    282283
    283     try{
     284    BOOST_TRY {
    284285      const facet_def& f = std::use_facet<facet_def>(is.getloc());
    285286      num = date_time::find_match(f.get_short_month_names(),
    286287                                  f.get_long_month_names(),
     
    290291    /* bad_cast will be thrown if the desired facet is not accessible
    291292     * so we can generate the facet. This has the drawback of using english
    292293     * names as a default. */
    293     catch(std::bad_cast&){
     294    BOOST_CATCH (std::bad_cast&){
    294295      charT a = '\0';
    295296      std::auto_ptr< const facet_def > f(create_facet_def(a));
    296297      num = date_time::find_match(f->get_short_month_names(),
     
    298299                                  (greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size,
    299300                                                           // which is needed by find_match
    300301    }
     302      BOOST_CATCH_END
    301303   
    302304    ++num; // months numbered 1-12
    303305    m = greg_month(num);
     
    322324    }
    323325
    324326    short num = 0;
    325     try{
     327    BOOST_TRY{
    326328      const facet_def& f = std::use_facet<facet_def>(is.getloc());
    327329      num = date_time::find_match(f.get_short_weekday_names(),
    328330                                  f.get_long_weekday_names(),
     
    332334    /* bad_cast will be thrown if the desired facet is not accessible
    333335     * so we can generate the facet. This has the drawback of using english
    334336     * names as a default. */
    335     catch(std::bad_cast&){
     337    BOOST_CATCH (std::bad_cast&){
    336338      charT a = '\0';
    337339      std::auto_ptr< const facet_def > f(create_facet_def(a));
    338340      num = date_time::find_match(f->get_short_weekday_names(),
     
    340342                                  (greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed
    341343                                                                 // to form the array size which is needed by find_match
    342344    }
     345      BOOST_CATCH_END
    343346   
    344347    wd = greg_weekday(num); // weekdays numbered 0-6
    345348    return is;