LiteSQL
0.3.10
include
litesql
except.hpp
Go to the documentation of this file.
1
/* LiteSQL
2
*
3
* The list of contributors at http://litesql.sf.net/
4
*
5
* See LICENSE for copyright information. */
6
7
#ifndef _litesql_except_hpp
8
#define _litesql_except_hpp
9
#include <iostream>
10
#include <string>
11
#include <exception>
12
#include "
litesql/utils.hpp
"
15
namespace
litesql {
17
class
Except :
public
std::exception {
18
private
:
19
std::string msg;
20
public
:
21
Except(std::string m)
throw
() : msg(m) {}
22
virtual
~Except(
void
)
throw
() {}
23
virtual
const
char
* what()
const
throw
() {
24
return
msg.c_str();
25
}
26
friend
std::ostream &operator<<(std::ostream &os,
const
Except &e) {
27
os << e.msg;
28
return
os;
29
}
30
};
31
32
class
NotFound :
public
Except {
33
public
:
34
NotFound(std::string s=
""
) : Except(
"NotFound: "
+s) {}
35
};
36
37
class
DatabaseError :
public
Except {
38
public
:
39
DatabaseError(std::string m) : Except(
"DatabaseError: "
+m) {}
40
};
41
42
class
SQLError :
public
Except {
43
public
:
44
SQLError(std::string m) : Except(
"SQLError: "
+m) {}
45
};
46
47
class
InternalError :
public
Except {
48
public
:
49
InternalError(std::string m) : Except(
"InternalError: "
+m) {}
50
};
51
52
class
MemoryError :
public
Except {
53
public
:
54
MemoryError(std::string m) : Except(
"Allocation failed: "
+m){}
55
};
56
57
class
InsertionError :
public
Except {
58
public
:
59
InsertionError(std::string m) : Except(
"Database full: "
+m){}
60
};
61
62
class
UnknownError :
public
Except {
63
// handles the rest
64
public
:
65
UnknownError(std::string m) : Except(
"UnknownError: "
+m){}
66
};
67
68
69
}
70
#endif
utils.hpp
includes string.hpp and split.hpp