1//
2// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3//
4// Distributed under the Boost Software License, Version 1.0.
5// https://www.boost.org/LICENSE_1_0.txt
6
7#ifndef BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED
8#define BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED
9
10#include <boost/locale/config.hpp>
11#include <stdexcept>
12#include <string>
13
14#ifdef BOOST_MSVC
15# pragma warning(push)
16# pragma warning(disable : 4275 4251 4231 4660)
17#endif
18
19namespace boost { namespace locale { namespace conv {
20 /// \addtogroup codepage
21 ///
22 /// @{
23
24 /// \brief The exception that is thrown in case of conversion error
25 class BOOST_SYMBOL_VISIBLE conversion_error : public std::runtime_error {
26 public:
27 conversion_error() : std::runtime_error("Conversion failed") {}
28 };
29
30 /// \brief This exception is thrown in case of use of unsupported
31 /// or invalid character set
32 class BOOST_SYMBOL_VISIBLE invalid_charset_error : public std::runtime_error {
33 public:
34 /// Create an error for charset \a charset
35 invalid_charset_error(const std::string& charset) :
36 std::runtime_error("Invalid or unsupported charset: " + charset)
37 {}
38 };
39
40 /// enum that defines conversion policy
41 enum method_type {
42 skip = 0, ///< Skip illegal/unconvertible characters
43 stop = 1, ///< Stop conversion and throw conversion_error
44 default_method = skip ///< Default method - skip
45 };
46
47 /// @}
48
49}}} // namespace boost::locale::conv
50
51#ifdef BOOST_MSVC
52# pragma warning(pop)
53#endif
54
55#endif
56

source code of boost/libs/locale/include/boost/locale/encoding_errors.hpp