00001
00002
00004
00005 #ifdef WIN32
00006 #pragma warning(disable:4786)
00007 #endif
00008 #include "DivideByZeroException.h"
00009
00011
00013
00015
00016 DivideByZeroException::DivideByZeroException() throw()
00017 {
00018
00019 }
00020
00022
00023 DivideByZeroException::~DivideByZeroException() throw()
00024 {
00025
00026 }
00027
00031
00032 DivideByZeroException::DivideByZeroException(std::string sExpressionToCompute,std::string sZeroValue) throw() : _sExpressionToCompute(sExpressionToCompute),_sZeroValue(sZeroValue)
00033 {
00034 setLineNumber(0);
00035 setFileName("");
00036 setType("DivideByZeroException");
00037
00038 setDescription(makeDescription());
00039 setReason(makeReason());
00040 setOrigin("");
00041
00042 }
00043
00050
00051 DivideByZeroException::DivideByZeroException(std::string sExpressionToCompute,std::string sZeroValue,std::string sOrigin,std::string sFileName,unsigned int iLineNumber) throw() : _sExpressionToCompute(sExpressionToCompute),_sZeroValue(sZeroValue)
00052 {
00053 setLineNumber(iLineNumber);
00054 setFileName(sFileName);
00055 setType("DivideByZeroException");
00056
00057 setDescription(makeDescription());
00058 setReason(makeReason());
00059 setOrigin(makeOrigin(sOrigin));
00060 }
00061
00063
00064 std::string DivideByZeroException::makeDescription()
00065 {
00066 std::string sExceptionMessage = "Computing of the ";
00067 sExceptionMessage+= _sExpressionToCompute;
00068 sExceptionMessage+= " not possible due to ";
00069 sExceptionMessage+= _sZeroValue;
00070 sExceptionMessage+= " equal to zero";
00071
00072 return sExceptionMessage;
00073 }
00074
00076
00077 std::string DivideByZeroException::makeReason()
00078 {
00079 std::string sReasonMessage = "OPERATION_NOT_ALLOWED --> ";
00080 sReasonMessage+= getType();
00081
00082 return sReasonMessage;
00083 }
00084
00085
00087
00088 std::string DivideByZeroException::makeOrigin(std::string sOrigin)
00089 {
00090 std::string sOriginMessage = getFileName();
00091 sOriginMessage+= " (l:";
00092 sOriginMessage+= ltos(getLineNumber());
00093 sOriginMessage+= ") ";
00094 sOriginMessage+= sOrigin;
00095
00096 return sOriginMessage;
00097 }