2001-02-07 16:44:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file Timeout.C
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-02-07 16:44:49 +00:00
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-02-07 16:44:49 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "Timeout.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
|
|
|
|
|
Timeout::~Timeout()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-02-18 19:13:48 +00:00
|
|
|
|
bool Timeout::running() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->running();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
void Timeout::start()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->start();
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
void Timeout::stop()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->stop();
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
void Timeout::restart()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->stop();
|
|
|
|
|
pimpl_->start();
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
void Timeout::emit()
|
|
|
|
|
{
|
|
|
|
|
pimpl_->reset();
|
2002-05-29 16:21:03 +00:00
|
|
|
|
timeout();
|
2001-02-07 16:44:49 +00:00
|
|
|
|
if (type == CONTINUOUS)
|
|
|
|
|
pimpl_->start();
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
Timeout & Timeout::setType(Type t)
|
|
|
|
|
{
|
|
|
|
|
type = t;
|
|
|
|
|
return * this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timeout & Timeout::setTimeout(unsigned int msec)
|
|
|
|
|
{
|
2003-02-22 18:01:16 +00:00
|
|
|
|
// Can't have a timeout of zero!
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(msec);
|
2003-02-22 18:01:16 +00:00
|
|
|
|
|
2001-02-07 16:44:49 +00:00
|
|
|
|
timeout_ms = msec;
|
|
|
|
|
return * this;
|
|
|
|
|
}
|