summaryrefslogtreecommitdiff
path: root/libcult/cult/os/exception.hxx
blob: 3c4164e8f3313b9c60d2031499c1f80cc3a26968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// file      : cult/os/exception.hxx
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2005-2010 Boris Kolpackov
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#ifndef CULT_OS_EXCEPTION_HXX
#define CULT_OS_EXCEPTION_HXX

#include <cult/types/fundamental.hxx>

#include <cult/eh/exception.hxx>

#include <errno.h>

namespace Cult
{
  namespace OS
  {
    class Exception : public virtual EH::Exception
    {
    public:
      Exception (Int code = error_code ()) throw ()
          : code_ (code)
      {
      }

      Int
      code () const throw ()
      {
        return code_;
      }

    private:
      static Int
      error_code () throw ()
      {
        return errno;
      }

    private:
      Int code_;
    };
  }
}

#endif  // CULT_OS_EXCEPTION_HXX