| 1 |
/* |
| 2 |
* attribute set management |
| 3 |
*/ |
| 4 |
|
| 5 |
#include "config.h" |
| 6 |
|
| 7 |
#include "lsys.h" |
| 8 |
#include "attr.h" |
| 9 |
|
| 10 |
vec attribute_set::operator ()(const string &attr, const vec &def) const t_err |
| 11 |
{ |
| 12 |
const_iterator i; |
| 13 |
if ((i = find (attr)) == end ()) |
| 14 |
return def; |
| 15 |
|
| 16 |
if (i->second.size () != 3) |
| 17 |
throw error("attribute '" + attr + "' must have three elements", i->second); |
| 18 |
|
| 19 |
return vec (eval_expr (i->second.first ()), |
| 20 |
eval_expr (i->second.second ()), |
| 21 |
eval_expr (i->second.third ())); |
| 22 |
} |
| 23 |
|