X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flogic.cpp;h=e9542a6dfb26815f7d4e371911ae65775e991b8b;hb=c8291177b545ec81930603a5915234a60296db51;hp=40d06b218b1aa4b01f9de19ac6df9189bad0d1bb;hpb=c435423919a20a87d100e1ee4cd1fc6ce223040c;p=libs%2Fgltk.git diff --git a/source/logic.cpp b/source/logic.cpp index 40d06b2..e9542a6 100644 --- a/source/logic.cpp +++ b/source/logic.cpp @@ -1,10 +1,4 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include "logic.h" using namespace std; @@ -13,25 +7,22 @@ namespace Msp { namespace GLtk { Logic::Loader::Loader(Logic &l, const map &w): - logic(l), + DataFile::ObjectLoader(l), widgets(w) { - add("action", &Loader::action); + add("bind", &Loader::bind); } -void Logic::Loader::action(const string &wdg, const string &data) +void Logic::Loader::bind(const string &wdg, const string &data) { - map::const_iterator i=widgets.find(wdg); - if(i==widgets.end()) - throw KeyError("Unknown widget", wdg); + WidgetBinding act; + act.wdg = get_item(widgets, wdg); - unsigned colon=data.find(':'); - WidgetAction act; - act.wdg=i->second; - act.type=data.substr(0, colon); + string::size_type colon = data.find(':'); + act.type = data.substr(0, colon); if(colon!=string::npos) - act.data=data.substr(colon+1); - logic.actions.push_back(act); + act.data = data.substr(colon+1); + obj.bindings.push_back(act); } } // namespace GLtk