Ticket #9586: greg_facet.hpp.patch
File greg_facet.hpp.patch, 2.7 KB (added by , 9 years ago) |
---|
-
date_time/gregorian/greg_facet.hpp
8 8 * Author: Jeff Garland, Bart Garst 9 9 * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $ 10 10 */ 11 11 #define BOOST_NO_EXCEPTIONS 12 #include "boost/detail/no_exceptions_support.hpp" 12 13 #include "boost/date_time/gregorian/gregorian_types.hpp" 13 14 #include "boost/date_time/date_formatting_locales.hpp" // sets BOOST_DATE_TIME_NO_LOCALE 14 15 #include "boost/date_time/gregorian/parsers.hpp" … … 280 281 281 282 short num = 0; 282 283 283 try{284 BOOST_TRY { 284 285 const facet_def& f = std::use_facet<facet_def>(is.getloc()); 285 286 num = date_time::find_match(f.get_short_month_names(), 286 287 f.get_long_month_names(), … … 290 291 /* bad_cast will be thrown if the desired facet is not accessible 291 292 * so we can generate the facet. This has the drawback of using english 292 293 * names as a default. */ 293 catch(std::bad_cast&){294 BOOST_CATCH (std::bad_cast&){ 294 295 charT a = '\0'; 295 296 std::auto_ptr< const facet_def > f(create_facet_def(a)); 296 297 num = date_time::find_match(f->get_short_month_names(), … … 298 299 (greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size, 299 300 // which is needed by find_match 300 301 } 302 BOOST_CATCH_END 301 303 302 304 ++num; // months numbered 1-12 303 305 m = greg_month(num); … … 322 324 } 323 325 324 326 short num = 0; 325 try{327 BOOST_TRY{ 326 328 const facet_def& f = std::use_facet<facet_def>(is.getloc()); 327 329 num = date_time::find_match(f.get_short_weekday_names(), 328 330 f.get_long_weekday_names(), … … 332 334 /* bad_cast will be thrown if the desired facet is not accessible 333 335 * so we can generate the facet. This has the drawback of using english 334 336 * names as a default. */ 335 catch(std::bad_cast&){337 BOOST_CATCH (std::bad_cast&){ 336 338 charT a = '\0'; 337 339 std::auto_ptr< const facet_def > f(create_facet_def(a)); 338 340 num = date_time::find_match(f->get_short_weekday_names(), … … 340 342 (greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed 341 343 // to form the array size which is needed by find_match 342 344 } 345 BOOST_CATCH_END 343 346 344 347 wd = greg_weekday(num); // weekdays numbered 0-6 345 348 return is;