-/* $Id$
-
-This file is part of libmspgltk
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <msp/core/maputils.h>
#include "connector.h"
#include "logic.h"
void Connector::connect(const Logic &logic)
{
- const list<Logic::WidgetBinding> &logic_binds=logic.get_bindings();
+ const list<Logic::WidgetBinding> &logic_binds = logic.get_bindings();
for(list<Logic::WidgetBinding>::const_iterator i=logic_binds.begin(); i!=logic_binds.end(); ++i)
{
- map<string, ConnAction *>::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<string, ConnAction *>::iterator i=actions.find(type);
+ map<string, ConnAction *>::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