diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-02-02 17:31:11 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:21:32 +0300 |
commit | dbe555605f496e65df0e762bec3dc3da75e009d5 (patch) | |
tree | 2f5902d58d8411a421ba73e216ec93b59522be1a /platform/country_file.cpp | |
parent | de3a5b9df15bfc5b3c957197921cc369753d0998 (diff) |
[new downloader] Moving new developed map downloader functionality to new map downloader branch.
Diffstat (limited to 'platform/country_file.cpp')
-rw-r--r-- | platform/country_file.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/platform/country_file.cpp b/platform/country_file.cpp index 41ace2a248..f2de49ba75 100644 --- a/platform/country_file.cpp +++ b/platform/country_file.cpp @@ -1,30 +1,39 @@ #include "platform/country_file.hpp" +#include "platform/mwm_version.hpp" #include "defines.hpp" + #include "base/assert.hpp" + #include "std/sstream.hpp" -namespace platform +namespace { -CountryFile::CountryFile() : m_mapSize(0), m_routingSize(0) {} - -CountryFile::CountryFile(string const & name) : m_name(name), m_mapSize(0), m_routingSize(0) {} - -string const & CountryFile::GetNameWithoutExt() const { return m_name; } - -string CountryFile::GetNameWithExt(MapOptions file) const +/// \returns file name (m_name) with extension dependent on the file param. +/// The extension could be .mwm.routing or just .mwm. +/// The method is used for old (two components) mwm support. +string GetNameWithExt(string const & countryFile, MapOptions file) { switch (file) { case MapOptions::Map: - return m_name + DATA_FILE_EXTENSION; + return countryFile + DATA_FILE_EXTENSION; case MapOptions::CarRouting: - return m_name + DATA_FILE_EXTENSION + ROUTING_FILE_EXTENSION; + return countryFile + DATA_FILE_EXTENSION + ROUTING_FILE_EXTENSION; default: ASSERT(false, ("Can't get name for:", file)); return string(); } } +} // namespace + +namespace platform +{ +CountryFile::CountryFile() : m_mapSize(0), m_routingSize(0) {} + +CountryFile::CountryFile(string const & name) : m_name(name), m_mapSize(0), m_routingSize(0) {} + +string const & CountryFile::GetName() const { return m_name; } void CountryFile::SetRemoteSizes(uint32_t mapSize, uint32_t routingSize) { @@ -42,6 +51,13 @@ uint32_t CountryFile::GetRemoteSize(MapOptions filesMask) const return size; } + +string GetFileName(string const & countryFile, MapOptions opt, int64_t version) +{ + return version::IsSingleMwm(version) ? GetNameWithExt(countryFile, MapOptions::Map) + : GetNameWithExt(countryFile, opt); +} + string DebugPrint(CountryFile const & file) { ostringstream os; |