|
| 1 | +// |
| 2 | +// MessagePack for C++ deserializing routine |
| 3 | +// |
| 4 | +// Copyright (C) 2008-2016 FURUHASHI Sadayuki and KONDO Takatoshi |
| 5 | +// |
| 6 | +// Distributed under the Boost Software License, Version 1.0. |
| 7 | +// (See accompanying file LICENSE_1_0.txt or copy at |
| 8 | +// http://www.boost.org/LICENSE_1_0.txt) |
| 9 | +// |
| 10 | +#ifndef MSGPACK_V1_UNPACK_EXCEPTION_HPP |
| 11 | +#define MSGPACK_V1_UNPACK_EXCEPTION_HPP |
| 12 | + |
| 13 | +#include "msgpack/versioning.hpp" |
| 14 | + |
| 15 | +#include <string> |
| 16 | +#include <stdexcept> |
| 17 | + |
| 18 | + |
| 19 | +namespace msgpack { |
| 20 | + |
| 21 | +/// @cond |
| 22 | +MSGPACK_API_VERSION_NAMESPACE(v1) { |
| 23 | +/// @endcond |
| 24 | + |
| 25 | +struct unpack_error : public std::runtime_error { |
| 26 | + explicit unpack_error(const std::string& msg) |
| 27 | + :std::runtime_error(msg) {} |
| 28 | +#if !defined(MSGPACK_USE_CPP03) |
| 29 | + explicit unpack_error(const char* msg): |
| 30 | + std::runtime_error(msg) {} |
| 31 | +#endif // !defined(MSGPACK_USE_CPP03) |
| 32 | +}; |
| 33 | + |
| 34 | +struct parse_error : public unpack_error { |
| 35 | + explicit parse_error(const std::string& msg) |
| 36 | + :unpack_error(msg) {} |
| 37 | +#if !defined(MSGPACK_USE_CPP03) |
| 38 | + explicit parse_error(const char* msg) |
| 39 | + :unpack_error(msg) {} |
| 40 | +#endif // !defined(MSGPACK_USE_CPP03) |
| 41 | +}; |
| 42 | + |
| 43 | +struct insufficient_bytes : public unpack_error { |
| 44 | + explicit insufficient_bytes(const std::string& msg) |
| 45 | + :unpack_error(msg) {} |
| 46 | +#if !defined(MSGPACK_USE_CPP03) |
| 47 | + explicit insufficient_bytes(const char* msg) |
| 48 | + :unpack_error(msg) {} |
| 49 | +#endif // !defined(MSGPACK_USE_CPP03) |
| 50 | +}; |
| 51 | + |
| 52 | +struct size_overflow : public unpack_error { |
| 53 | + explicit size_overflow(const std::string& msg) |
| 54 | + :unpack_error(msg) {} |
| 55 | +#if !defined(MSGPACK_USE_CPP03) |
| 56 | + explicit size_overflow(const char* msg) |
| 57 | + :unpack_error(msg) {} |
| 58 | +#endif |
| 59 | +}; |
| 60 | + |
| 61 | +struct array_size_overflow : public size_overflow { |
| 62 | + array_size_overflow(const std::string& msg) |
| 63 | + :size_overflow(msg) {} |
| 64 | +#if !defined(MSGPACK_USE_CPP03) |
| 65 | + array_size_overflow(const char* msg) |
| 66 | + :size_overflow(msg) {} |
| 67 | +#endif |
| 68 | +}; |
| 69 | + |
| 70 | +struct map_size_overflow : public size_overflow { |
| 71 | + map_size_overflow(const std::string& msg) |
| 72 | + :size_overflow(msg) {} |
| 73 | +#if !defined(MSGPACK_USE_CPP03) |
| 74 | + map_size_overflow(const char* msg) |
| 75 | + :size_overflow(msg) {} |
| 76 | +#endif |
| 77 | +}; |
| 78 | + |
| 79 | +struct str_size_overflow : public size_overflow { |
| 80 | + str_size_overflow(const std::string& msg) |
| 81 | + :size_overflow(msg) {} |
| 82 | +#if !defined(MSGPACK_USE_CPP03) |
| 83 | + str_size_overflow(const char* msg) |
| 84 | + :size_overflow(msg) {} |
| 85 | +#endif |
| 86 | +}; |
| 87 | + |
| 88 | +struct bin_size_overflow : public size_overflow { |
| 89 | + bin_size_overflow(const std::string& msg) |
| 90 | + :size_overflow(msg) {} |
| 91 | +#if !defined(MSGPACK_USE_CPP03) |
| 92 | + bin_size_overflow(const char* msg) |
| 93 | + :size_overflow(msg) {} |
| 94 | +#endif |
| 95 | +}; |
| 96 | + |
| 97 | +struct ext_size_overflow : public size_overflow { |
| 98 | + ext_size_overflow(const std::string& msg) |
| 99 | + :size_overflow(msg) {} |
| 100 | +#if !defined(MSGPACK_USE_CPP03) |
| 101 | + ext_size_overflow(const char* msg) |
| 102 | + :size_overflow(msg) {} |
| 103 | +#endif |
| 104 | +}; |
| 105 | + |
| 106 | +struct depth_size_overflow : public size_overflow { |
| 107 | + depth_size_overflow(const std::string& msg) |
| 108 | + :size_overflow(msg) {} |
| 109 | +#if !defined(MSGPACK_USE_CPP03) |
| 110 | + depth_size_overflow(const char* msg) |
| 111 | + :size_overflow(msg) {} |
| 112 | +#endif |
| 113 | +}; |
| 114 | + |
| 115 | +/// @cond |
| 116 | +} // MSGPACK_API_VERSION_NAMESPACE(v1) |
| 117 | +/// @endcond |
| 118 | + |
| 119 | +} // namespace msgpack |
| 120 | + |
| 121 | + |
| 122 | +#endif // MSGPACK_V1_UNPACK_EXCEPTION_HPP |
0 commit comments