expectation() : BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_EXPECTATION_INITIALIZE, _) BOOST_PP_COMMA_IF(MOCK_NUM_ARGS) i_( boost::make_shared< unlimited >() ) , file_( "unknown location" ) , line_( 0 ) {} expectation( const char* file, int line ) : BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_EXPECTATION_INITIALIZE, _) BOOST_PP_COMMA_IF(MOCK_NUM_ARGS) i_( boost::make_shared< unlimited >() ) , file_( file ) , line_( line ) {} ~expectation() { for( sequences_cit it = sequences_.begin(); it != sequences_.end(); ++it ) (*it)->remove( this ); } expectation& once() { i_ = boost::make_shared< detail::once >(); return *this; } expectation& never() { i_ = boost::make_shared< detail::never >(); return *this; } expectation& exactly( std::size_t count ) { i_ = boost::make_shared< detail::exactly >( count ); return *this; }
void GlobalExceptionHandler::terminate() throw() { // add cerr to the log stream // and write all available information on // the exception to the log stream (potentially with an assigned file!) // and cerr std::cout << std::endl; std::cout << "---------------------------------------------------" << std::endl; std::cout << "FATAL: uncaught exception!" << std::endl; std::cout << "---------------------------------------------------" << std::endl; if ((line_() != -1) && (name_() != "unknown")) { std::cout << "last entry in the exception handler: " << std::endl; std::cout << "exception of type " << name_().c_str() << " occured in line " << line_() << ", function " << function_() << " of " << file_().c_str() << std::endl; std::cout << "error message: " << what_().c_str() << std::endl; } std::cout << "---------------------------------------------------" << std::endl; #ifndef OPENMS_WINDOWSPLATFORM // if the environment variable declared in OPENMS_CORE_DUMP_ENVNAME // is set, provoke a core dump (this is helpful to get a stack traceback) if (getenv(OPENMS_CORE_DUMP_ENVNAME) != 0) { #ifdef OPENMS_HAS_KILL std::cout << "dumping core file.... (to avoid this, unset " << OPENMS_CORE_DUMP_ENVNAME << " in your environment)" << std::endl; // provoke a core dump kill(getpid(), SIGSEGV); #endif } #endif // otherwise exit as default terminate() would: abort(); }
void slider(int &val, int vmin, int vmax, int color, char *label) { autotab(); int x = curx; int y = cury; line_(10); if(visible()) { if(!label) { static string s; formatstring(s)("%d", val); label = s; } int w = text_width(label); bool hit; int px, py; if(ishorizontal()) { hit = ishit(FONTH, ysize, x, y); px = x + (FONTH-w)/2; py = y + (ysize-FONTH) - ((ysize-FONTH)*(val-vmin))/((vmax==vmin) ? 1 : (vmax-vmin)); //vmin at bottom } else { hit = ishit(xsize, FONTH, x, y); px = x + FONTH/2 - w/2 + ((xsize-w)*(val-vmin))/((vmax==vmin) ? 1 : (vmax-vmin)); //vmin at left py = y; } if(hit) color = 0xFF0000; text_(label, px, py, color, hit && actionon); if(hit && actionon) { int vnew = (vmin < vmax ? 1 : -1)+vmax-vmin; if(ishorizontal()) vnew = int(vnew*(y+ysize-FONTH/2-hity)/(ysize-FONTH)); else vnew = int(vnew*(hitx-x-FONTH/2)/(xsize-w)); vnew += vmin; vnew = vmin < vmax ? clamp(vnew, vmin, vmax) : clamp(vnew, vmax, vmin); if(vnew != val) val = vnew; } } }
void progress(float percent) { autotab(); line_((FONTH*4)/5, percent); }
void separator() { autotab(); line_(FONTH/3); }
void separator() { autotab(); line_(5); }