From d38ed958ee39924eab20ec47fa6e101146d62920 Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 25 Aug 2011 16:54:27 +0300 Subject: [PATCH] Add function to check reader's existing in FilesContainerR. --- coding/file_container.cpp | 8 ++++++++ coding/file_container.hpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/coding/file_container.cpp b/coding/file_container.cpp index d66d63bdba..cfe3d957fb 100644 --- a/coding/file_container.cpp +++ b/coding/file_container.cpp @@ -60,6 +60,14 @@ FilesContainerR::ReaderT FilesContainerR::GetReader(Tag const & tag) const MYTHROW(Reader::OpenException, (tag)); } +bool FilesContainerR::IsReaderExist(Tag const & tag) const +{ + InfoContainer::const_iterator i = + lower_bound(m_info.begin(), m_info.end(), tag, LessInfo()); + + return (i != m_info.end() && i->m_tag == tag); +} + ///////////////////////////////////////////////////////////////////////////// // FilesContainerW ///////////////////////////////////////////////////////////////////////////// diff --git a/coding/file_container.hpp b/coding/file_container.hpp index 30d231bc76..3b877608bf 100644 --- a/coding/file_container.hpp +++ b/coding/file_container.hpp @@ -90,6 +90,8 @@ public: ReaderT GetReader(Tag const & tag) const; + bool IsReaderExist(Tag const & tag) const; + template void ForEachTag(F f) const { for (size_t i = 0; i < m_info.size(); ++i)