blob: 84adee5a725e9e8b936dd679eb9c9467ed81f8f7 (
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) {
ParameterPtr 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, "value")
{
}
VariableType
IHaveParameters::getParameter(const Glib::ustring & name) const
{
Parameters::const_iterator i = parameters.find(name);
if (i != parameters.end()) {
return i->second->value;
}
throw ParamNotFound();
}
|