aboutsummaryrefslogtreecommitdiffstats
path: root/examples/example6_timeoutHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example6_timeoutHandler.hpp')
-rw-r--r--examples/example6_timeoutHandler.hpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/examples/example6_timeoutHandler.hpp b/examples/example6_timeoutHandler.hpp
index 3e188baf..7999084d 100644
--- a/examples/example6_timeoutHandler.hpp
+++ b/examples/example6_timeoutHandler.hpp
@@ -5,17 +5,17 @@
* Used to stop the current operation after too much time, or if the user
* requested cancellation.
*/
-class timeoutHandler : public vmime::net::timeoutHandler
-{
+class timeoutHandler : public vmime::net::timeoutHandler {
+
public:
timeoutHandler()
- : m_start(time(NULL))
- {
+ : m_start(time(NULL)) {
+
}
- bool isTimeOut()
- {
+ bool isTimeOut() {
+
// This is a cancellation point: return true if you want to cancel
// the current operation. If you return true, handleTimeOut() will
// be called just after this, and before actually cancelling the
@@ -25,15 +25,15 @@ public:
return (time(NULL) - m_start) >= 10; // seconds
}
- void resetTimeOut()
- {
+ void resetTimeOut() {
+
// Called at the beginning of an operation (eg. connecting,
// a read() or a write() on a socket...)
m_start = time(NULL);
}
- bool handleTimeOut()
- {
+ bool handleTimeOut() {
+
// If isTimeOut() returned true, this function will be called. This
// allows you to interact with the user, ie. display a prompt to
// know whether he wants to cancel the operation.
@@ -49,13 +49,12 @@ private:
};
-class timeoutHandlerFactory : public vmime::net::timeoutHandlerFactory
-{
+class timeoutHandlerFactory : public vmime::net::timeoutHandlerFactory {
+
public:
- vmime::shared_ptr <vmime::net::timeoutHandler> create()
- {
+ vmime::shared_ptr <vmime::net::timeoutHandler> create() {
+
return vmime::make_shared <timeoutHandler>();
}
};
-