]> Dogcows Code - chaz/openbox/blobdiff - otk/timer.cc
set the ustring's utf type so that it matches what it appended to it
[chaz/openbox] / otk / timer.cc
index bde95f89593821f1b79b3a88bbf967f2f017e8ef..3fe8c7035196229ef77a12a4a6bf67565c84cb2a 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
 #ifdef    HAVE_CONFIG_H
 #  include "../config.h"
@@ -33,23 +33,23 @@ static timeval normalizeTimeval(const timeval &tm)
 }
 
 
-OBTimer::OBTimer(OBTimerQueueManager *m, OBTimeoutHandler h, OBTimeoutData d)
+Timer::Timer(TimerQueueManager *m, TimeoutHandler h, TimeoutData d)
 {
-  manager = m;
-  handler = h;
-  data = d;
+  _manager = m;
+  _handler = h;
+  _data = d;
 
-  recur = timing = false;
+  _recur = _timing = false;
 }
 
 
-OBTimer::~OBTimer(void)
+Timer::~Timer(void)
 {
-  if (timing) stop();
+  if (_timing) stop();
 }
 
 
-void OBTimer::setTimeout(long t)
+void Timer::setTimeout(long t)
 {
   _timeout.tv_sec = t / 1000;
   _timeout.tv_usec = t % 1000;
@@ -57,48 +57,44 @@ void OBTimer::setTimeout(long t)
 }
 
 
-void OBTimer::setTimeout(const timeval &t)
+void Timer::setTimeout(const timeval &t)
 {
   _timeout.tv_sec = t.tv_sec;
   _timeout.tv_usec = t.tv_usec;
 }
 
 
-void OBTimer::start(void)
+void Timer::start(void)
 {
   gettimeofday(&_start, 0);
 
-  if (! timing) {
-    timing = true;
-    manager->addTimer(this);
+  if (! _timing) {
+    _timing = true;
+    _manager->addTimer(this);
   }
 }
 
 
-void OBTimer::stop(void)
+void Timer::stop(void)
 {
-  timing = false;
+  if (_timing) {
+    _timing = false;
 
-  manager->removeTimer(this);
-}
-
-
-void OBTimer::halt(void)
-{
-  timing = false;
+    _manager->removeTimer(this);
+  }
 }
 
 
-void OBTimer::fireTimeout(void)
+void Timer::fire(void)
 {
-  if (handler)
-    handler(data);
+  if (_handler)
+    _handler(_data);
 }
 
 
-timeval OBTimer::timeRemaining(const timeval &tm) const
+timeval Timer::remainingTime(const timeval &tm) const
 {
-  timeval ret = endpoint();
+  timeval ret = endTime();
 
   ret.tv_sec  -= tm.tv_sec;
   ret.tv_usec -= tm.tv_usec;
@@ -107,7 +103,7 @@ timeval OBTimer::timeRemaining(const timeval &tm) const
 }
 
 
-timeval OBTimer::endpoint(void) const
+timeval Timer::endTime(void) const
 {
   timeval ret;
 
@@ -118,9 +114,9 @@ timeval OBTimer::endpoint(void) const
 }
 
 
-bool OBTimer::shouldFire(const timeval &tm) const
+bool Timer::shouldFire(const timeval &tm) const
 {
-  timeval end = endpoint();
+  timeval end = endTime();
 
   return ! ((tm.tv_sec < end.tv_sec) ||
             (tm.tv_sec == end.tv_sec && tm.tv_usec < end.tv_usec));
This page took 0.02692 seconds and 4 git commands to generate.