📄 demo_reply.cpp
字号:
/* Copyright is licensed under GNU LGPL. by I.J.Wang 2003 Build: make demo_reply*/#include "../src/wystr.h"#include "../src/wybyteflow.h"#include "../src/wy_uty.h"// Class T_RepInfo inherits Wy_RepInfo, for application specific reply//class T_RepInfo : public Wy_RepInfo { public: T_RepInfo(const char* cstr) : Wy_RepInfo(cstr) WY__NOTHROW__ {}; T_RepInfo(int ec, const char* cstr) : Wy_RepInfo(ec,cstr) WY__NOTHROW__ {}; size_t get_reply(char* buf, size_t blen) const WY__NOTHROW__ { return Wy_RepInfo::get_reply(buf,blen); }; void set_reply(const char* str, size_t slen) WY__NOTHROW__ {}; // no effect};static T_RepInfo ei("User defined reply E001");const static WyReply E001(ei);int main(void)try { // Print errno 0-127 associated WyReply'es // for(int i=0; i<=Wy::_max_errno; ++i) { const WyReply ei(i); Wy::cerr << i << " " << Wy::wrd(ei) << '\n'; } // Print the libwy added reply's // Wy::cout << "\nWym_ETHRDCAN " << Wy::wrd(Wym_ETHRDCAN); Wy::cout << "\nWym_EDIVZERO " << Wy::wrd(Wym_EDIVZERO); Wy::cout << "\nWym_EMATHNEG " << Wy::wrd(Wym_EMATHNEG); Wy::cout << "\nWym_EBADTYPE " << Wy::wrd(Wym_EBADTYPE); Wy::cout << "\n"; // Print the note // Wy::cerr << "\n -- Note --\n"; Wy::cerr << "E001=" << Wy::wrd(E001) << '\n'; Wy::cerr << "WyReply()=" << Wy::wrd(WyReply()) << '\n'; Wy::cerr << "WyReply(0)=Ok=" << Wy::wrd(Ok) << '\n'; Wy::cerr << "Ok=" << Wy::wrd(Ok) << '\n'; return(0);}catch(const WyRet& e) { Wy::cerr << Wy::wrd(e) << '\n'; return(-1);}catch(...) { Wy::cerr << "main() caught(...)\n"; return(-1);};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -