mirror of https://github.com/SeanOMik/libki.git
dml: Add method for getting FieldBase * from Record
Needed for niceties in the Python binding
This commit is contained in:
parent
c08eb617bf
commit
e2f6bd1655
|
@ -34,6 +34,8 @@ namespace dml
|
|||
return m_field_map.at(name)->is_type<ValueT>();
|
||||
}
|
||||
|
||||
FieldBase *get_field(std::string name) const;
|
||||
|
||||
/**
|
||||
* Returns a previously added field with the specified name
|
||||
* and type.
|
||||
|
|
|
@ -30,6 +30,13 @@ namespace dml
|
|||
return m_field_map.count(name);
|
||||
}
|
||||
|
||||
FieldBase *Record::get_field(std::string name) const
|
||||
{
|
||||
if (has_field(name))
|
||||
return m_field_map.at(name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t Record::get_field_count() const
|
||||
{
|
||||
return m_fields.size();
|
||||
|
|
Loading…
Reference in New Issue