diff options
author | vng <viktor.govako@gmail.com> | 2012-10-18 03:18:23 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:45:45 +0300 |
commit | b02b5b055f96843579fd054e4eafe36607058a50 (patch) | |
tree | 145dbe8bb03739c27d8db3515c1b7968a566b17f /storage | |
parent | 76486746263c6ab749042cd29011594673548286 (diff) |
Add storage::CountryInfoGetter::ClearCaches.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/country_info.cpp | 19 | ||||
-rw-r--r-- | storage/country_info.hpp | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/storage/country_info.cpp b/storage/country_info.cpp index 2ca2f6eae2..219c7517f3 100644 --- a/storage/country_info.cpp +++ b/storage/country_info.cpp @@ -227,4 +227,23 @@ namespace storage return false; } + +namespace +{ + class DoFreeCacheMemory + { + public: + void operator() (vector<m2::RegionD> & v) const + { + vector<m2::RegionD> emptyV; + emptyV.swap(v); + } + }; +} + + void CountryInfoGetter::ClearCaches() const + { + m_cache.ForEachValue(DoFreeCacheMemory()); + m_cache.Reset(); + } } diff --git a/storage/country_info.hpp b/storage/country_info.hpp index 3cbedcabb0..0297fcfc1b 100644 --- a/storage/country_info.hpp +++ b/storage/country_info.hpp @@ -76,5 +76,8 @@ namespace storage void GetMatchedRegions(string const & enName, IDSet & regions) const; bool IsBelongToRegion(m2::PointD const & pt, IDSet const & regions) const; //@} + + /// m_cache is mutable. + void ClearCaches() const; }; } |