Boost.Locale
encoding_errors.hpp
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 
13 #ifdef BOOST_MSVC
14 # pragma warning(push)
15 # pragma warning(disable : 4275 4251 4231 4660)
16 #endif
17 
18 namespace boost {
19  namespace locale {
20  namespace conv {
25 
29  class BOOST_SYMBOL_VISIBLE conversion_error : public std::runtime_error {
30  public:
31  conversion_error() : std::runtime_error("Conversion failed") {}
32  };
33 
38  class BOOST_SYMBOL_VISIBLE invalid_charset_error : public std::runtime_error {
39  public:
40 
42  invalid_charset_error(std::string charset) :
43  std::runtime_error("Invalid or unsupported charset:" + charset)
44  {
45  }
46  };
47 
48 
52  typedef enum {
53  skip = 0,
54  stop = 1,
56  } method_type;
57 
58 
60 
61  } // conv
62 
63  } // locale
64 } // boost
65 
66 #ifdef BOOST_MSVC
67 #pragma warning(pop)
68 #endif
69 
70 #endif
71 
72 
The excepton that is thrown in case of conversion error.
Definition: encoding_errors.hpp:29
This exception is thrown in case of use of unsupported or invalid character set.
Definition: encoding_errors.hpp:38
Default method - skip.
Definition: encoding_errors.hpp:55
invalid_charset_error(std::string charset)
Create an error for charset charset.
Definition: encoding_errors.hpp:42
Stop conversion and throw conversion_error.
Definition: encoding_errors.hpp:54
Skip illegal/unconvertable characters.
Definition: encoding_errors.hpp:53
method_type
Definition: encoding_errors.hpp:52