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. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #ifndef BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED
9 #define BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED
10 
11 #include <boost/locale/definitions.hpp>
12 #ifdef BOOST_MSVC
13 # pragma warning(push)
14 # pragma warning(disable : 4275 4251 4231 4660)
15 #endif
16 #include <stdexcept>
17 
18 
19 
20 namespace boost {
21  namespace locale {
22  namespace conv {
27 
31  class BOOST_SYMBOL_VISIBLE conversion_error : public std::runtime_error {
32  public:
33  conversion_error() : std::runtime_error("Conversion failed") {}
34  };
35 
40  class BOOST_SYMBOL_VISIBLE invalid_charset_error : public std::runtime_error {
41  public:
42 
44  invalid_charset_error(std::string charset) :
45  std::runtime_error("Invalid or unsupported charset:" + charset)
46  {
47  }
48  };
49 
50 
54  typedef enum {
55  skip = 0,
56  stop = 1,
58  } method_type;
59 
60 
62 
63  } // conv
64 
65  } // locale
66 } // boost
67 
68 #ifdef BOOST_MSVC
69 #pragma warning(pop)
70 #endif
71 
72 #endif
73 
74 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
75 
The excepton that is thrown in case of conversion error.
Definition: encoding_errors.hpp:31
This exception is thrown in case of use of unsupported or invalid character set.
Definition: encoding_errors.hpp:40
Default method - skip.
Definition: encoding_errors.hpp:57
invalid_charset_error(std::string charset)
Create an error for charset charset.
Definition: encoding_errors.hpp:44
Stop conversion and throw conversion_error.
Definition: encoding_errors.hpp:56
Skip illegal/unconvertable characters.
Definition: encoding_errors.hpp:55
method_type
Definition: encoding_errors.hpp:54