]> git.tdb.fi Git - libs/core.git/blob - source/stringcodec/except.h
Add move semantics to Variant
[libs/core.git] / source / stringcodec / except.h
1 #ifndef MSP_STRINGCODEC_EXCEPT_H_
2 #define MSP_STRINGCODEC_EXCEPT_H_
3
4 #include <stdexcept>
5 #include <msp/core/mspcore_api.h>
6 #include "ustring.h"
7
8 namespace Msp {
9 namespace StringCodec {
10
11 /**
12 Base class for codec errors.
13 */
14 class MSPCORE_API codec_error: public std::runtime_error
15 {
16 public:
17         codec_error(const std::string &w): std::runtime_error(w) { }
18 };
19
20
21 /**
22 Thrown when a codec can't encode the requested character.
23 */
24 class MSPCORE_API invalid_character: public codec_error
25 {
26 public:
27         invalid_character(unichar, const std::string &);
28 };
29
30
31 /**
32 Thrown when a codec encounters a byte sequence it can't decode.
33 */
34 class MSPCORE_API invalid_sequence: public codec_error
35 {
36 public:
37         invalid_sequence(const std::string::const_iterator &, const std::string::const_iterator &, const std::string &);
38
39 private:
40         std::string format_sequence(const std::string::const_iterator &, const std::string::const_iterator &);
41 };
42
43 } // namespace StringCodec
44 } // namespace Msp
45
46 #endif