]> Dogcows Code - chaz/yoink/blob - src/stlplus/persistence/persistent_exceptions.cpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_exceptions.cpp
1 ////////////////////////////////////////////////////////////////////////////////
2
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004-2009
6 // License: BSD License, see ../docs/license.html
7
8 ////////////////////////////////////////////////////////////////////////////////
9
10 #include "persistent_exceptions.hpp"
11 #include <stdio.h>
12
13 ////////////////////////////////////////////////////////////////////////////////
14
15 static std::string to_string(int number)
16 {
17 // use sprintf in a very controlled way that cannot overrun
18 char* buffer = new char[50];
19 sprintf(buffer, "%i", number);
20 std::string result = buffer;
21 delete buffer;
22 return result;
23 }
24
25 ////////////////////////////////////////////////////////////////////////////////
26 // exceptions
27
28 stlplus::persistent_illegal_type::persistent_illegal_type(const std::string& type) throw() :
29 std::logic_error(std::string("illegal type: ") + type)
30 {
31 }
32
33 stlplus::persistent_illegal_type::persistent_illegal_type(unsigned key) throw() :
34 std::logic_error(std::string("illegal key: ") + to_string((int)key))
35 {
36 }
37
38 stlplus::persistent_illegal_type::~persistent_illegal_type(void) throw()
39 {
40 }
41
42 ////////////////////////////////////////////////////////////////////////////////
43
44 stlplus::persistent_dump_failed::persistent_dump_failed(const std::string& message) throw() :
45 std::runtime_error(std::string("dump failed: ") + message)
46 {
47 }
48
49 stlplus::persistent_dump_failed::~persistent_dump_failed(void) throw()
50 {
51 }
52
53 ////////////////////////////////////////////////////////////////////////////////
54
55 stlplus::persistent_restore_failed::persistent_restore_failed(const std::string& message) throw() :
56 std::runtime_error(std::string("restore failed: ") + message)
57 {
58 }
59
60 stlplus::persistent_restore_failed::~persistent_restore_failed(void) throw()
61 {
62 }
63
64 ////////////////////////////////////////////////////////////////////////////////
This page took 0.03187 seconds and 4 git commands to generate.