Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-10-18 03:18:23 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:45:45 +0300
commitb02b5b055f96843579fd054e4eafe36607058a50 (patch)
tree145dbe8bb03739c27d8db3515c1b7968a566b17f /storage
parent76486746263c6ab749042cd29011594673548286 (diff)
Add storage::CountryInfoGetter::ClearCaches.
Diffstat (limited to 'storage')
-rw-r--r--storage/country_info.cpp19
-rw-r--r--storage/country_info.hpp3
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;
};
}