]> git.tdb.fi Git - libs/gltk.git/blob - source/logic.cpp
Strip copyright messages and id tags from individual files
[libs/gltk.git] / source / logic.cpp
1 #include "logic.h"
2
3 using namespace std;
4
5 namespace Msp {
6 namespace GLtk {
7
8 Logic::Loader::Loader(Logic &l, const map<string, Widget *> &w):
9         logic(l),
10         widgets(w)
11 {
12         add("bind", &Loader::bind);
13 }
14
15 void Logic::Loader::bind(const string &wdg, const string &data)
16 {
17         map<string, Widget *>::const_iterator i = widgets.find(wdg);
18         if(i==widgets.end())
19                 throw KeyError("Unknown widget", wdg);
20
21         string::size_type colon = data.find(':');
22         WidgetBinding act;
23         act.wdg = i->second;
24         act.type = data.substr(0, colon);
25         if(colon!=string::npos)
26                 act.data = data.substr(colon+1);
27         logic.bindings.push_back(act);
28 }
29
30 } // namespace GLtk
31 } // namespace Msp