File indexing completed on 2025-01-30 09:33:00
0001 #ifndef BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP
0002 #define BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/config.hpp>
0020 #ifndef BOOST_NO_EXCEPTIONS
0021 #include <exception>
0022
0023 #include <boost/assert.hpp>
0024
0025 namespace boost {
0026 namespace archive {
0027 namespace iterators {
0028
0029
0030
0031
0032 class base64_exception : public std::exception
0033 {
0034 public:
0035 typedef enum {
0036 invalid_code,
0037 invalid_character,
0038 other_exception
0039 } exception_code;
0040 exception_code code;
0041
0042 base64_exception(exception_code c = other_exception) : code(c)
0043 {}
0044
0045 virtual const char *what( ) const BOOST_NOEXCEPT_OR_NOTHROW
0046 {
0047 const char *msg = "unknown exception code";
0048 switch(code){
0049 case invalid_code:
0050 msg = "attempt to encode a value > 6 bits";
0051 break;
0052 case invalid_character:
0053 msg = "attempt to decode a value not in base64 char set";
0054 break;
0055 default:
0056 BOOST_ASSERT(false);
0057 break;
0058 }
0059 return msg;
0060 }
0061 };
0062
0063 }
0064 }
0065 }
0066
0067 #endif
0068 #endif