]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/persistence/persistent_exceptions.cpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / persistence / persistent_exceptions.cpp
diff --git a/src/stlplus/persistence/persistent_exceptions.cpp b/src/stlplus/persistence/persistent_exceptions.cpp
new file mode 100644 (file)
index 0000000..d233826
--- /dev/null
@@ -0,0 +1,64 @@
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+#include "persistent_exceptions.hpp"\r
+#include <stdio.h>\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+static std::string to_string(int number)\r
+{\r
+  // use sprintf in a very controlled way that cannot overrun\r
+  char* buffer = new char[50];\r
+  sprintf(buffer, "%i", number);\r
+  std::string result = buffer;\r
+  delete buffer;\r
+  return result;\r
+}\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+// exceptions\r
+\r
+stlplus::persistent_illegal_type::persistent_illegal_type(const std::string& type) throw() : \r
+  std::logic_error(std::string("illegal type: ") + type)\r
+{\r
+}\r
+\r
+stlplus::persistent_illegal_type::persistent_illegal_type(unsigned key) throw() : \r
+  std::logic_error(std::string("illegal key: ") + to_string((int)key))\r
+{\r
+}\r
+\r
+stlplus::persistent_illegal_type::~persistent_illegal_type(void) throw()\r
+{\r
+}\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+stlplus::persistent_dump_failed::persistent_dump_failed(const std::string& message) throw() :\r
+  std::runtime_error(std::string("dump failed: ") + message)\r
+{\r
+}\r
+\r
+stlplus::persistent_dump_failed::~persistent_dump_failed(void) throw()\r
+{\r
+}\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+stlplus::persistent_restore_failed::persistent_restore_failed(const std::string& message) throw() :\r
+  std::runtime_error(std::string("restore failed: ") + message)\r
+{\r
+}\r
+\r
+stlplus::persistent_restore_failed::~persistent_restore_failed(void) throw()\r
+{\r
+}\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
This page took 0.024921 seconds and 4 git commands to generate.