From 5409489c632fcaa3868a0767cecef65f079e5a94 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 19 Sep 2009 08:41:33 +0200 Subject: Add RAII-based file auto-remover --- cutl/fs/exception.hxx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cutl/fs/exception.hxx (limited to 'cutl/fs/exception.hxx') 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 +// 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 + +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 -- cgit v1.1