| 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
19 namespace 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
41 enum method_type {
42 skip = 0,
43 stop = 1,
44 default_method = skip
45 };
46
48
49}}} // namespace boost::locale::conv
50
51#ifdef BOOST_MSVC
52# pragma warning(pop)
53#endif
54
55#endif
boost::locale::conv::conversion_error
The exception that is thrown in case of conversion error.
Definition: encoding_errors.hpp:25
boost::locale::conv::invalid_charset_error
This exception is thrown in case of use of unsupported or invalid character set.
Definition: encoding_errors.hpp:32
boost::locale::conv::invalid_charset_error::invalid_charset_error
invalid_charset_error(const std::string &charset)
Create an error for charset charset.
Definition: encoding_errors.hpp:35
boost::locale::conv::method_type
method_type
enum that defines conversion policy
Definition: encoding_errors.hpp:41
boost::locale::conv::stop
@ stop
Stop conversion and throw conversion_error.
Definition: encoding_errors.hpp:43
boost::locale::conv::default_method
@ default_method
Default method - skip.
Definition: encoding_errors.hpp:44
boost::locale::conv::skip
@ skip
Skip illegal/unconvertible characters.
Definition: encoding_errors.hpp:42
- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.