comm_exception.cpp

来自「一个串口类」· C++ 代码 · 共 33 行

CPP
33
字号
#include "stdafx.h"
#include "comm_exception.h"
#include <sstream>
using namespace std;

namespace C2217
{
namespace StdLib
{
	ostream & operator << (ostream &out, const comm_exception & e)
	{
		out<< "what:    " <<e.what()<<endl
			<< "code:	 " <<e.get_error_code() <<endl
			<< "throw exception at:-----------------" << endl
			<< "file:    " << e.get_throw_file() <<endl
			<< "function:" << e.get_throw_function() <<endl
			<< "line:    " <<e.get_throw_line()<<endl
			<< "catch excetion at:------------------" << endl
			<< "file:    " << e.get_catch_file()<<endl
			<< "function:" << e.get_catch_function()<<endl
			<< "line:    " <<e.get_catch_line()<<endl;
		return out;
	}

	string comm_exception::str() const 
	{
		stringstream ss;
		ss << *this;
		return ss.str();
	}
}
}

⌨️ 快捷键说明

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