CdcException is the base class for the exceptions class. More...
#include <DcException.h>
Public Member Functions | |
CdcException (t_exception_num code=DC_GENERAL_EXP) | |
Constructor with error code, or default constructor. | |
CdcException (const CdcString &msg, t_exception_num code=DC_GENERAL_EXP) | |
Constructor with code and message, or just message. | |
virtual | ~CdcException () |
Destructor - Does nothing. | |
virtual CdcString | ToStr () const |
This function is virtual function to get the exception message as a string. | |
virtual void | Act () |
This function can do some relevant action on this exception. | |
virtual int | GetExpCode () const |
Return error code number. | |
virtual CdcString | GetExpMessage () const |
Return a reference to the error message. | |
Protected Attributes | |
int | nCode |
The code of this exception. | |
CdcString | sMessage |
The message of this exception. |
CdcException is the base class for the exceptions class.
The only virtual functions is Print and Act. The default implementation of Print prints a relevant message to stderr. The implementation of Act is empty in this base class. Derived classes can preform some relevant action for the kind of exception. It make sense to over write the constructors though.
Definition at line 71 of file DcException.h.
CdcException::CdcException | ( | t_exception_num | code = DC_GENERAL_EXP ) |
Constructor with error code, or default constructor.
DcException.cpp: Implementation of CdcException class.
code | The error code for this exception (DC_GENERAL_EXP is the default). |
for documentation see the header file.
Definition at line 28 of file DcException.cpp.
CdcException::CdcException | ( | const CdcString & | msg, |
t_exception_num | code = DC_GENERAL_EXP |
||
) |
Constructor with code and message, or just message.
msg | The error message for this exception. |
code | The error code for this exception (DC_GENERAL_EXP is the default). |
Definition at line 38 of file DcException.cpp.
CdcException::~CdcException | ( | ) | [virtual] |
Destructor - Does nothing.
Definition at line 45 of file DcException.cpp.
void CdcException::Act | ( | ) | [virtual] |
This function can do some relevant action on this exception.
The implementation in this base class is empty.
Definition at line 59 of file DcException.cpp.
int CdcException::GetExpCode | ( | ) | const [virtual] |
CdcString CdcException::GetExpMessage | ( | ) | const [virtual] |
Return a reference to the error message.
Definition at line 69 of file DcException.cpp.
CdcString CdcException::ToStr | ( | ) | const [virtual] |
This function is virtual function to get the exception message as a string.
The user does not has to over write this function, the base behavior is good in most cases.
Reimplemented in CdcExceptionSocket.
Definition at line 49 of file DcException.cpp.
int CdcException::nCode [protected] |
The code of this exception.
Definition at line 75 of file DcException.h.
CdcString CdcException::sMessage [protected] |
The message of this exception.
Definition at line 77 of file DcException.h.