11 #include <boost/foreach.hpp>
12 #include <boost/lexical_cast.hpp>
28 "missing parameter '" << name <<
"' ("
29 << scope->getPosition() <<
")");
31 if (x->getType() != Element::string) {
33 "invalid type specified for parameter '" << name
34 <<
"' (" << x->getPosition() <<
")");
37 return (x->stringValue());
45 "missing parameter '" << name <<
"' ("
46 << scope->getPosition() <<
")");
48 if (x->getType() != Element::integer) {
50 "invalid type specified for parameter '" << name
51 <<
"' (" << x->getPosition() <<
")");
54 return (x->intValue());
62 "missing parameter '" << name <<
"' ("
63 << scope->getPosition() <<
")");
65 if (x->getType() != Element::boolean) {
67 "invalid type specified for parameter '" << name
68 <<
"' (" << x->getPosition() <<
")");
71 return (x->boolValue());
76 const std::string& name) {
77 std::string str = getString(scope, name);
80 }
catch (
const std::exception& e) {
82 <<
"' to address: " << e.
what() <<
"("
83 << getPosition(name, scope) <<
")");
90 return (data::Element::ZERO_POSITION());
94 return (parent->getPosition());
96 return (elem->getPosition());
121 switch (def_value.
type_) {
122 case Element::string: {
126 case Element::integer: {
128 int int_value = boost::lexical_cast<int>(def_value.
value_);
131 catch (
const std::exception& ex) {
133 << def_value.
name_ <<
", value is: "
139 case Element::boolean: {
141 if (def_value.
value_ ==
string(
"true")) {
143 }
else if (def_value.
value_ ==
string(
"false")) {
147 "Internal error. Boolean value specified as "
148 << def_value.
value_ <<
", expected true or false");
153 case Element::real: {
154 double dbl_value = boost::lexical_cast<double>(def_value.
value_);
161 "Internal error. Incorrect default value type.");
165 scope->set(def_value.
name_, x);
176 BOOST_FOREACH(
ElementPtr entry, list->listValue()) {
177 cnt += setDefaults(entry, default_values);
186 if ( (parent->getType() != Element::map) ||
187 (child->getType() != Element::map)) {
192 BOOST_FOREACH(
string param, params) {
200 if (child->get(param)) {
207 child->set(param, x);