forked from lix-project/lix
Bindings: Add convenience method for requiring an attribute
This commit is contained in:
parent
a2f86ac647
commit
fb692e5f7b
|
@ -72,6 +72,14 @@ public:
|
||||||
return {};
|
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 begin() { return &attrs[0]; }
|
||||||
iterator end() { return &attrs[size_]; }
|
iterator end() { return &attrs[size_]; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue