X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fconnector.cpp;h=9915ecc19d8df6291f87c0d84350990d8a2847e8;hb=6d73e04329fc3752552773e4d11d7374caf779f6;hp=2ee35c8ec8720decce212f6aef0c694f58e3fdc7;hpb=8ffcd589660022f05d8b3b1dbb36c0c0aa91954a;p=libs%2Fgltk.git diff --git a/source/connector.cpp b/source/connector.cpp index 2ee35c8..9915ecc 100644 --- a/source/connector.cpp +++ b/source/connector.cpp @@ -1,10 +1,4 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include "connector.h" #include "logic.h" @@ -21,28 +15,25 @@ Connector::~Connector() void Connector::connect(const Logic &logic) { - const list &logic_binds=logic.get_bindings(); + const list &logic_binds = logic.get_bindings(); for(list::const_iterator i=logic_binds.begin(); i!=logic_binds.end(); ++i) { - map::const_iterator j=actions.find(i->type); - if(j!=actions.end()) - j->second->connect(*this, *i->wdg, i->data); - else - throw KeyError("Unknown binding type", i->type); + ConnAction *action = get_item(actions, i->type); + action->connect(*this, *i->wdg, i->data); } } void Connector::add(const string &type, ConnAction *act) { - map::iterator i=actions.find(type); + map::iterator i = actions.find(type); if(i!=actions.end()) { delete i->second; - i->second=act; + i->second = act; } else - actions[type]=act; + actions[type] = act; } } // namespace GLtk