]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/archive/iterators/base64_exception.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / archive / iterators / base64_exception.hpp
1 #ifndef BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP
2 #define BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP
3
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER)
6 # pragma once
7 #endif
8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // base64_exception.hpp:
11
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 // See http://www.boost.org for updates, documentation, and revision history.
18
19 #include <boost/config.hpp>
20 #ifndef BOOST_NO_EXCEPTIONS
21 #include <exception>
22
23 #include <boost/assert.hpp>
24
25 namespace boost {
26 namespace archive {
27 namespace iterators {
28
29 //////////////////////////////////////////////////////////////////////
30 // exceptions thrown by base64s
31 //
32 class base64_exception : public std::exception
33 {
34 public:
35 typedef enum {
36 invalid_code, // attempt to encode a value > 6 bits
37 invalid_character, // decode a value not in base64 char set
38 other_exception
39 } exception_code;
40 exception_code code;
41
42 base64_exception(exception_code c = other_exception) : code(c)
43 {}
44
45 virtual const char *what( ) const throw( )
46 {
47 const char *msg = "unknown exception code";
48 switch(code){
49 case invalid_code:
50 msg = "attempt to encode a value > 6 bits";
51 break;
52 case invalid_character:
53 msg = "attempt to decode a value not in base64 char set";
54 break;
55 default:
56 BOOST_ASSERT(false);
57 break;
58 }
59 return msg;
60 }
61 };
62
63 } // namespace iterators
64 } // namespace archive
65 } // namespace boost
66
67 #endif //BOOST_NO_EXCEPTIONS
68 #endif //BOOST_ARCHIVE_ITERATORS_ARCHIVE_EXCEPTION_HPP