Sha256: 8f1954061e69da664876eaa2c2766bc6f3f8d6bc3035d52f1a8c3efa5584e257
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
/* * wxError.cpp * * Created on: 21.02.2012 * Author: hanmac */ #include "wxError.hpp" VALUE rb_eWXError; void wxrubyAssert(const wxString& file, int line, const wxString& func, const wxString& cond, const wxString& msg) { rb_fatal("(%s) in %s \n %s", cond.GetData().AsChar(), func.GetData().AsChar(), msg.GetData().AsChar() ); } class RubyExceptionLog : public wxLogInterposer { public: RubyExceptionLog() : wxLogInterposer() {} protected: void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) { const char * c = msg.GetData().AsChar(); const char * f = info.func; switch(level) { case wxLOG_FatalError: rb_fatal("%s in %s", c, f); break; case wxLOG_Warning: rb_warn("%s in %s", c, f); break; case wxLOG_Error: rb_raise(rb_eWXError,"%s in %s", c, f); break; default: break; } wxLogInterposer::DoLogRecord(level, msg, info); } }; DLL_LOCAL void Init_WXError(VALUE rb_mWX) { rb_eWXError = rb_define_class_under(rb_mWX,"Error",rb_eException); wxLog::SetActiveTarget(new RubyExceptionLog()); wxSetAssertHandler(wxrubyAssert); }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rwx-0.0.1.1.dev | ext/wxError.cpp |
rwx-0.0.1.dev | ext/wxError.cpp |