diff options
author | vng <viktor.govako@gmail.com> | 2015-07-16 14:31:31 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:57:12 +0300 |
commit | 8fdd97d52366659ec16cf4d4edf3ab98f96b0874 (patch) | |
tree | 1381c0061d93b5ee60b658df1659f3fa265312d0 /indexer/mwm_set.cpp | |
parent | 0dc6675aa5d9cc8e19f1ec02a927eae826d97944 (diff) |
Minor refactoring to store feature’s offsets table once for every cache value in mwm set.
Diffstat (limited to 'indexer/mwm_set.cpp')
-rw-r--r-- | indexer/mwm_set.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/indexer/mwm_set.cpp b/indexer/mwm_set.cpp index 292f7b64b4..389354f314 100644 --- a/indexer/mwm_set.cpp +++ b/indexer/mwm_set.cpp @@ -75,16 +75,6 @@ MwmSet::MwmHandle & MwmSet::MwmHandle::operator=(MwmHandle && handle) return *this; } -MwmSet::MwmSet(size_t cacheSize) - : m_cacheSize(cacheSize) -{ -} - -MwmSet::~MwmSet() -{ - Clear(); - ASSERT(m_cache.empty(), ()); -} MwmSet::MwmId MwmSet::GetMwmIdByCountryFileImpl(CountryFile const & countryFile) const { @@ -131,10 +121,9 @@ pair<MwmSet::MwmHandle, MwmSet::RegResult> MwmSet::Register(LocalCountryFile con pair<MwmSet::MwmHandle, MwmSet::RegResult> MwmSet::RegisterImpl(LocalCountryFile const & localFile) { - shared_ptr<MwmInfo> info(new MwmInfo()); - // This function can throw an exception for a bad mwm file. - if (!GetVersion(localFile, *info)) + shared_ptr<MwmInfo> info(CreateInfo(localFile)); + if (!info) return make_pair(MwmHandle(), RegResult::UnsupportedFileFormat); info->m_file = localFile; @@ -227,7 +216,8 @@ MwmSet::TMwmValueBasePtr MwmSet::LockValueImpl(MwmId const & id) return result; } } - return CreateValue(info->GetLocalFile()); + + return TMwmValueBasePtr(CreateValue(*info)); } void MwmSet::UnlockValue(MwmId const & id, TMwmValueBasePtr p) |