warexception.cpp

来自「ftpserver very good sample」· C++ 代码 · 共 80 行

CPP
80
字号
#include "StdAfx.h"#include "WarException.h"   // class implemented#ifndef WAR_ITOA_H#   include "WarItoa.h"#endifusing namespace std;/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================WarException::WarException(const war_error_definitions local_error,                           const int system_error,                           war_ccstr_t message,                           war_ccstr_t source_file,                           const int source_line)                           : WarError(local_error, system_error,                                 source_file, source_line),                                mMessage(message ? message : ""){}// WarExceptionWarException::WarException(const WarException& from): WarError(from),mMessage(from.mMessage){}// WarExceptionWarException::WarException(const WarError& err,                           war_ccstr_t message)                           : WarError(err),                           mMessage(message ? message : ""){}WarException::~WarException() throw(){}// ~WarException//============================= OPERATORS ====================================//============================= OPERATIONS ===================================const std::string& WarException::Explain() const{    if (mMessageBuf.empty())    {        std::string msg, tmp_str;        msg = "Exception from ";        msg += GetFile();        msg += " line ";        msg += WarItoa(tmp_str, GetLine());        msg += " caused by ";        msg += WarError::Explain();        if (!msg.empty())        {            msg += " [";            msg += mMessage;            msg += ']';        }        (std::string &)mMessageBuf = msg;    }    return mMessageBuf;}const char *WarException::what() const throw(){    return Explain().c_str();}//============================= ACESS      ===================================//============================= INQUIRY    ===================================/////////////////////////////// PROTECTED  ////////////////////////////////////////////////////////////////// PRIVATE    ///////////////////////////////////

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?