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#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 {
23
25 class BOOST_SYMBOL_VISIBLE conversion_error : public std::runtime_error {
26 public:
27 conversion_error() : std::runtime_error("Conversion failed") {}
28 };
29
32 class BOOST_SYMBOL_VISIBLE invalid_charset_error : public std::runtime_error {
33 public:
35 invalid_charset_error(const std::string& charset) :
36 std::runtime_error("Invalid or unsupported charset: " + charset)
37 {}
38 };
39
42 skip = 0,
43 stop = 1,
45 };
46
48
49}}} // namespace boost::locale::conv
50
51#ifdef BOOST_MSVC
52# pragma warning(pop)
53#endif
54
55#endif
The exception that is thrown in case of conversion error.
Definition: encoding_errors.hpp:25
This exception is thrown in case of use of unsupported or invalid character set.
Definition: encoding_errors.hpp:32
invalid_charset_error(const std::string &charset)
Create an error for charset charset.
Definition: encoding_errors.hpp:35
method_type
enum that defines conversion policy
Definition: encoding_errors.hpp:41
@ stop
Stop conversion and throw conversion_error.
Definition: encoding_errors.hpp:43
@ default_method
Default method - skip.
Definition: encoding_errors.hpp:44
@ skip
Skip illegal/unconvertible characters.
Definition: encoding_errors.hpp:42