]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/logic.cpp
Rework exceptions and use maputils
[libs/gltk.git] / source / logic.cpp
index 3ed745c09c9e083233efada18fb76d6d94c707e3..db382fe6074f14aebea7293d61808f1ff0e5c100 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/core/maputils.h>
 #include "logic.h"
 
 using namespace std;
@@ -14,13 +15,10 @@ Logic::Loader::Loader(Logic &l, const map<string, Widget *> &w):
 
 void Logic::Loader::bind(const string &wdg, const string &data)
 {
-       map<string, Widget *>::const_iterator i = widgets.find(wdg);
-       if(i==widgets.end())
-               throw KeyError("Unknown widget", wdg);
+       WidgetBinding act;
+       act.wdg = get_item(widgets, wdg);
 
        string::size_type colon = data.find(':');
-       WidgetBinding act;
-       act.wdg = i->second;
        act.type = data.substr(0, colon);
        if(colon!=string::npos)
                act.data = data.substr(colon+1);