1 // 2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See 5 // accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 // 8 #ifndef BOOST_SRC_ICU_UTIL_HPP 9 #define BOOST_SRC_ICU_UTIL_HPP 10 #include <unicode/utypes.h> 11 #include <stdexcept> 12 13 namespace boost { 14 namespace locale { 15 namespace impl_icu { 16 throw_icu_error(UErrorCode err)17 inline void throw_icu_error(UErrorCode err) 18 { 19 throw std::runtime_error(u_errorName(err)); 20 } 21 check_and_throw_icu_error(UErrorCode err)22 inline void check_and_throw_icu_error(UErrorCode err) 23 { 24 if(U_FAILURE(err)) 25 throw_icu_error(err); 26 } 27 } // impl 28 } // locale 29 } // boost 30 31 #endif 32 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 33