blob: abab80cf6bbaf3169f3f44228e777c5231444c93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "iHaveParameters.h"
#include "exceptions.h"
#include "appEngine.h"
#include "xmlObjectLoader.h"
#include <boost/foreach.hpp>
IHaveParameters::IHaveParameters(const xmlpp::Element * p)
{
BOOST_FOREACH(xmlpp::Node * node, p->find("parameters/param")) {
const xmlpp::Element * elem = dynamic_cast<const xmlpp::Element *>(node);
if (elem) {
Parameter p = new _Parameter(elem);
parameters[p->name] = p;
}
}
}
IHaveParameters::~IHaveParameters()
{
}
IHaveParameters::_Parameter::_Parameter(const xmlpp::Element * p) :
name(p->get_attribute_value("name")),
value(p->get_attribute("value"))
{
}
const Glib::ustring &
IHaveParameters::getParameter(const Glib::ustring & name) const
{
Parameters::const_iterator i = parameters.find(name);
if (i != parameters.end()) {
return i->second->value;
}
throw ParamNotFound();
}
|