Time to get rid of the horrible coding style

This commit is contained in:
pd 2008-08-01 18:31:43 +02:00
parent 534ee610d8
commit efc594f888
53 changed files with 1137 additions and 1136 deletions

View file

@ -31,7 +31,7 @@
using namespace DBus;
BusTimeout::BusTimeout( Timeout::Internal* ti, BusDispatcher* bd )
BusTimeout::BusTimeout(Timeout::Internal *ti, BusDispatcher *bd)
: Timeout(ti), DefaultTimeout(Timeout::interval(), true, bd)
{
DefaultTimeout::enabled(Timeout::enabled());
@ -44,14 +44,14 @@ void BusTimeout::toggle()
DefaultTimeout::enabled(Timeout::enabled());
}
BusWatch::BusWatch( Watch::Internal* wi, BusDispatcher* bd )
BusWatch::BusWatch(Watch::Internal *wi, BusDispatcher *bd)
: Watch(wi), DefaultWatch(Watch::descriptor(), 0, bd)
{
int flags = POLLHUP | POLLERR;
if(Watch::flags() & DBUS_WATCH_READABLE)
if (Watch::flags() & DBUS_WATCH_READABLE)
flags |= POLLIN;
if(Watch::flags() & DBUS_WATCH_WRITABLE)
if (Watch::flags() & DBUS_WATCH_WRITABLE)
flags |= POLLOUT;
DefaultWatch::flags(flags);
@ -71,7 +71,7 @@ void BusDispatcher::enter()
_running = true;
while(_running)
while (_running)
{
do_iteration();
}
@ -90,72 +90,72 @@ void BusDispatcher::do_iteration()
dispatch();
}
Timeout* BusDispatcher::add_timeout( Timeout::Internal* ti )
Timeout *BusDispatcher::add_timeout(Timeout::Internal *ti)
{
BusTimeout* bt = new BusTimeout(ti, this);
BusTimeout *bt = new BusTimeout(ti, this);
bt->expired = new Callback<BusDispatcher, void, DefaultTimeout&>(this, &BusDispatcher::timeout_expired);
bt->expired = new Callback<BusDispatcher, void, DefaultTimeout &>(this, &BusDispatcher::timeout_expired);
bt->data(bt);
debug_log("added timeout %p (%s)", bt, ((Timeout*)bt)->enabled() ? "on":"off");
debug_log("added timeout %p (%s)", bt, ((Timeout *)bt)->enabled() ? "on":"off");
return bt;
}
void BusDispatcher::rem_timeout( Timeout* t )
void BusDispatcher::rem_timeout(Timeout *t)
{
debug_log("removed timeout %p", t);
delete t;
}
Watch* BusDispatcher::add_watch( Watch::Internal* wi )
Watch *BusDispatcher::add_watch(Watch::Internal *wi)
{
BusWatch* bw = new BusWatch(wi, this);
BusWatch *bw = new BusWatch(wi, this);
bw->ready = new Callback<BusDispatcher, void, DefaultWatch&>(this, &BusDispatcher::watch_ready);
bw->ready = new Callback<BusDispatcher, void, DefaultWatch &>(this, &BusDispatcher::watch_ready);
bw->data(bw);
debug_log("added watch %p (%s) fd=%d flags=%d",
bw, ((Watch*)bw)->enabled() ? "on":"off", ((Watch*)bw)->descriptor(), ((Watch*)bw)->flags()
bw, ((Watch *)bw)->enabled() ? "on":"off", ((Watch *)bw)->descriptor(), ((Watch *)bw)->flags()
);
return bw;
}
void BusDispatcher::rem_watch( Watch* w )
void BusDispatcher::rem_watch(Watch *w)
{
debug_log("removed watch %p", w);
delete w;
}
void BusDispatcher::timeout_expired( DefaultTimeout& et )
void BusDispatcher::timeout_expired(DefaultTimeout &et)
{
debug_log("timeout %p expired", &et);
BusTimeout* timeout = reinterpret_cast<BusTimeout*>(et.data());
BusTimeout *timeout = reinterpret_cast<BusTimeout *>(et.data());
timeout->handle();
}
void BusDispatcher::watch_ready( DefaultWatch& ew )
void BusDispatcher::watch_ready(DefaultWatch &ew)
{
BusWatch* watch = reinterpret_cast<BusWatch*>(ew.data());
BusWatch *watch = reinterpret_cast<BusWatch *>(ew.data());
debug_log("watch %p ready, flags=%d state=%d",
watch, ((Watch*)watch)->flags(), watch->state()
watch, ((Watch *)watch)->flags(), watch->state()
);
int flags = 0;
if(watch->state() & POLLIN)
if (watch->state() & POLLIN)
flags |= DBUS_WATCH_READABLE;
if(watch->state() & POLLOUT)
if (watch->state() & POLLOUT)
flags |= DBUS_WATCH_WRITABLE;
if(watch->state() & POLLHUP)
if (watch->state() & POLLHUP)
flags |= DBUS_WATCH_HANGUP;
if(watch->state() & POLLERR)
if (watch->state() & POLLERR)
flags |= DBUS_WATCH_ERROR;
watch->handle(flags);