aboutsummaryrefslogtreecommitdiff
path: root/cutl/fs/exception.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-09-19 08:41:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-09-19 08:41:33 +0200
commit5409489c632fcaa3868a0767cecef65f079e5a94 (patch)
tree829cdf6020eb848526778741afe995ee242e7a4d /cutl/fs/exception.hxx
parent6ca1c8ee64bf7268d194eb15e72d3024a335039d (diff)
Add RAII-based file auto-remover
Diffstat (limited to 'cutl/fs/exception.hxx')
-rw-r--r--cutl/fs/exception.hxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/cutl/fs/exception.hxx b/cutl/fs/exception.hxx
new file mode 100644
index 0000000..b412491
--- /dev/null
+++ b/cutl/fs/exception.hxx
@@ -0,0 +1,36 @@
+// file : cutl/fs/exception.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef CUTL_FS_EXCEPTION_HXX
+#define CUTL_FS_EXCEPTION_HXX
+
+#include <cutl/exception.hxx>
+
+namespace cutl
+{
+ namespace fs
+ {
+ struct error: exception
+ {
+ error (int code): code_ (code) {}
+
+ // Error code (errno).
+ //
+ int
+ code () const
+ {
+ return code_;
+ }
+
+ virtual char const*
+ what () const throw ();
+
+ private:
+ int code_;
+ };
+ }
+}
+
+#endif // CUTL_FS_EXCEPTION_HXX