exceptiontest.cpp
来自「GPSTK:做gpS的人都应当知道这个东西」· C++ 代码 · 共 53 行
CPP
53 行
#pragma ident "$Id$"#include <iostream>#include <string>#include "Exception.hpp"/** * @file exceptiontest.cpp * tests gpslib::Exception */using namespace std;class TestException{public: NEW_EXCEPTION_CLASS(TE, gpstk::Exception); int foo; void funcie() throw(TE) { try { foo=1; if (foo-1==0) { TE e("Blarfo"); e.addLocation(FILE_LOCATION); throw e; } foo=4; } catch (TE& e) { e.addText("Ja mon"); e.addLocation(FILE_LOCATION); throw; } }};// returns 0 if all tests passint main(){ TestException a; try { a.funcie(); } catch (gpstk::Exception& e) { cout << "main " << e; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?