Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

systemerror.h

Go to the documentation of this file.
00001 #ifndef DV_UTIL_SYSTEMERROR_H 00002 #define DV_UTIL_SYSTEMERROR_H 00003 // $Id: systemerror.h,v 1.1 2003/03/12 12:56:19 dvermeir Exp $ 00004 00005 #include <string> 00006 #include <stdexcept> // runtime_error 00007 00008 namespace Dv { 00009 namespace Util { 00010 00011 /** 00012 * Exception class associated with a system error. 00013 * 00014 * Derived from runtime_error. 00015 */ 00016 class SystemError: public std::runtime_error { 00017 public: 00018 /** 00019 * Name of class, is prepended to each message argument of the 00020 * constructor. 00021 */ 00022 static const std::string NAME; 00023 /** 00024 * @param error_code system error code, should be valid 00025 * input for strerror. If 0, the global :errno will 00026 * be used instead. 00027 */ 00028 SystemError(int error_code = 0); 00029 /** @return error code of this SystemError 00030 * @warning This function is not called errno() because 00031 * <string.h> defines errno as a macro. 00032 */ 00033 int err_no() const { return errno_; } 00034 private: 00035 int errno_; 00036 }; 00037 00038 }} 00039 #endif

dvutil-0.13.15 [30 December, 2004]