1 | #ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP |
---|
2 | #define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP |
---|
3 | |
---|
4 | // MS compatible compilers support #pragma once |
---|
5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
6 | # pragma once |
---|
7 | #endif |
---|
8 | |
---|
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
10 | // dataflow_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 <cassert> |
---|
24 | |
---|
25 | namespace boost { |
---|
26 | namespace archive { |
---|
27 | namespace iterators { |
---|
28 | |
---|
29 | ////////////////////////////////////////////////////////////////////// |
---|
30 | // exceptions thrown by dataflows |
---|
31 | // |
---|
32 | class dataflow_exception : public std::exception |
---|
33 | { |
---|
34 | public: |
---|
35 | typedef enum { |
---|
36 | invalid_6_bitcode, |
---|
37 | invalid_base64_character, |
---|
38 | invalid_xml_escape_sequence, |
---|
39 | comparison_not_permitted, |
---|
40 | invalid_conversion, |
---|
41 | other_exception |
---|
42 | } exception_code; |
---|
43 | exception_code code; |
---|
44 | |
---|
45 | dataflow_exception(exception_code c = other_exception) : code(c) |
---|
46 | {} |
---|
47 | |
---|
48 | virtual const char *what( ) const throw( ) |
---|
49 | { |
---|
50 | const char *msg = "unknown exception code"; |
---|
51 | switch(code){ |
---|
52 | case invalid_6_bitcode: |
---|
53 | msg = "attempt to encode a value > 6 bits"; |
---|
54 | break; |
---|
55 | case invalid_base64_character: |
---|
56 | msg = "attempt to decode a value not in base64 char set"; |
---|
57 | break; |
---|
58 | case invalid_xml_escape_sequence: |
---|
59 | msg = "invalid xml escape_sequence"; |
---|
60 | break; |
---|
61 | case comparison_not_permitted: |
---|
62 | msg = "cannot invoke iterator comparison now"; |
---|
63 | break; |
---|
64 | case invalid_conversion: |
---|
65 | msg = "invalid multbyte/wide char conversion"; |
---|
66 | break; |
---|
67 | default: |
---|
68 | assert(false); |
---|
69 | break; |
---|
70 | } |
---|
71 | return msg; |
---|
72 | } |
---|
73 | }; |
---|
74 | |
---|
75 | } // namespace iterators |
---|
76 | } // namespace archive |
---|
77 | } // namespace boost |
---|
78 | |
---|
79 | #endif //BOOST_NO_EXCEPTIONS |
---|
80 | #endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP |
---|