forked from lix-project/lix
Bindings: Add convenience method for requiring an attribute
(cherry picked from commit fb692e5f7b
)
This commit is contained in:
parent
0d118ef0c9
commit
79142cbbe1
|
@ -72,6 +72,14 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
Attr & need(const Symbol & name, const Pos & pos = noPos)
|
||||
{
|
||||
auto a = get(name);
|
||||
if (!a)
|
||||
throw Error("attribute '%s' missing, at %s", name, pos);
|
||||
return **a;
|
||||
}
|
||||
|
||||
iterator begin() { return &attrs[0]; }
|
||||
iterator end() { return &attrs[size_]; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue