00001 // NotAllowedOperationException.cpp: implementation of the NotAllowedOperationException class. 00002 // 00004 #ifdef WIN32 00005 #pragma warning(disable:4786) 00006 #endif 00007 00008 #include "NotAllowedOperationException.h" 00009 00011 // Construction/Destruction 00013 00015 NotAllowedOperationException::NotAllowedOperationException() throw() 00016 { 00017 00018 } 00020 NotAllowedOperationException::~NotAllowedOperationException() throw() 00021 { 00022 00023 } 00024 00031 NotAllowedOperationException::NotAllowedOperationException(std::string sOperationNotAllowed,std::string sReason,std::string sOrigin,std::string sFileName,unsigned int iLineNumber) : _sOperationNotAllowed(sOperationNotAllowed),_sReason(sReason) 00032 { 00033 setLineNumber(iLineNumber); 00034 setFileName(sFileName); 00035 setType("NotAllowedOperationException"); 00036 00037 setDescription(makeDescription()); 00038 setReason(makeReason()); 00039 setOrigin(makeOrigin(sOrigin)); 00040 } 00041 00043 std::string NotAllowedOperationException::makeDescription() 00044 { 00045 std::string sExceptionMessage = "The operation "; 00046 sExceptionMessage+= _sOperationNotAllowed; 00047 sExceptionMessage+= " is not allowed and the reason is "; 00048 sExceptionMessage+= _sReason; 00049 00050 return sExceptionMessage; 00051 } 00052 00054 std::string NotAllowedOperationException::makeReason() 00055 { 00056 std::string sReasonMessage = "OPERATION_NOT_ALLOWED --> "; 00057 sReasonMessage+= getType(); 00058 00059 return sReasonMessage; 00060 } 00061 00062 00064 std::string NotAllowedOperationException::makeOrigin(std::string sOrigin) 00065 { 00066 std::string sOriginMessage = getFileName(); 00067 sOriginMessage+= " (l:"; 00068 sOriginMessage+= ltos(getLineNumber()); 00069 sOriginMessage+= ") "; 00070 sOriginMessage+= sOrigin; 00071 00072 return sOriginMessage; 00073 } 00074
1.4.5