[kvp-frame.cpp] expose iterator, skip inexistent frame

This commit is contained in:
Christopher Lam 2022-04-06 07:15:09 +08:00
parent 6a668df168
commit 0c4d438a0e
2 changed files with 5 additions and 0 deletions

View File

@ -78,6 +78,8 @@ KvpFrame::get_child_frame_or_nullptr (Path const & path) noexcept
if (map_iter == m_valuemap.end ())
return nullptr;
auto child = map_iter->second->get <KvpFrame *> ();
if (!child)
return nullptr;
Path send;
std::copy (path.begin () + 1, path.end (), std::back_inserter (send));
return child->get_child_frame_or_nullptr (send);

View File

@ -226,6 +226,9 @@ struct KvpFrameImpl
bool empty() const noexcept { return m_valuemap.empty(); }
friend int compare(const KvpFrameImpl&, const KvpFrameImpl&) noexcept;
map_type::iterator begin() { return m_valuemap.begin(); }
map_type::iterator end() { return m_valuemap.end(); }
private:
map_type m_valuemap;