00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _SK_UTIL_SYSTEMEXCEPTION_
00009 #define _SK_UTIL_SYSTEMEXCEPTION_
00010
00011 #include <sk/util/Exception.h>
00012 #include <errno.h>
00013
00014 namespace sk {
00015 namespace util {
00016 class SystemException
00017 : public sk::util::Exception
00018 {
00019 public:
00020 SystemException(const sk::util::String& message);
00021 SystemException(const sk::util::String& message, int code);
00022
00023 static bool raiseUnlessSuccess(const sk::util::String& statement, int status, int other = 0);
00024 int getCode() const;
00025
00026
00027 const sk::util::Class getClass() const;
00028
00029 private:
00030 int _code;
00031 };
00032 }
00033 }
00034
00035 #define SK_SYSTEM_RAISE_UNLESS_SUCCESS(statement) sk::util::SystemException::raiseUnlessSuccess(#statement, statement)
00036 #define SK_SYSTEM_RAISE_UNLESS_SUCCESS_OR(other, statement) sk::util::SystemException::raiseUnlessSuccess(#statement, statement, other)
00037
00038 #endif