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