#include #include #include #include #include #include //! erzeugt einen std::runtime_error mit text und optionalem parameter BCException::BCException(const QString& what, const QString& param ) : std::runtime_error( param.isEmpty() ? what.toStdString() : QString( "%1: %2" ).arg(what,param).toStdString( ) ) { } BCException::BCException( const QString& what, int errCode ) : std::runtime_error( QString( "%1: %2" ).arg(what,errCode).toStdString( ) ) { } namespace bc { void delay_seconds( uint32_t tval ) { std::this_thread::sleep_for(std::chrono::seconds( tval ) ); } void delay_millis( uint32_t tval ) { std::this_thread::sleep_for(std::chrono::milliseconds( tval ) ); } void delay_micros( uint32_t tval ) { std::this_thread::sleep_for(std::chrono::microseconds( tval ) ); } /** * @brief Macht aus int x den String 000x zum schönaussehen. * @param count der Wert * @param len die voranzustellenden Nullen * * Macht aus int x den String 000x zum schönaussehen. * */ QString formatInt( int count, int len ) { QString result( "%0" ); result = result.arg( count, len, 10, QChar( '0' ) ); return result; } void processEventsFor(int milliseconds) { QElapsedTimer timer; timer.start(); while (timer.elapsed() < milliseconds) { QApplication::processEvents(QEventLoop::AllEvents, 50); } } } // namespace cbc