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-06-13 12:10:06 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:39:45 +0300
commit6db85bfa17869e85d34553e59f1ccedb0bc4b5e6 (patch)
tree57a5d999d0d57db7d50f4035e423b2c8463ef220 /storage
parentc5d7af70297051b4c57a2c5f00d0f3b5188fdfe3 (diff)
Fix bug with downloaded country name in startup view.
Diffstat (limited to 'storage')
-rw-r--r--storage/country_decl.cpp28
-rw-r--r--storage/country_decl.hpp3
-rw-r--r--storage/country_info.cpp10
-rw-r--r--storage/storage.pro1
4 files changed, 33 insertions, 9 deletions
diff --git a/storage/country_decl.cpp b/storage/country_decl.cpp
new file mode 100644
index 0000000000..857d6db17c
--- /dev/null
+++ b/storage/country_decl.cpp
@@ -0,0 +1,28 @@
+#include "country_decl.hpp"
+
+
+string storage::CountryInfo::FileName2FullName(string fName)
+{
+ size_t const i = fName.find('_');
+ if (i != string::npos)
+ {
+ // replace '_' with ", "
+ fName[i] = ',';
+ fName.insert(i+1, " ");
+ }
+ return fName;
+}
+
+void storage::CountryInfo::FullName2GroupAndMap(string const & fName, string & group, string & map)
+{
+ size_t pos = fName.find(",");
+ if (pos == string::npos)
+ {
+ map = fName;
+ }
+ else
+ {
+ map = fName.substr(pos + 2);
+ group = fName.substr(0, pos);
+ }
+}
diff --git a/storage/country_decl.hpp b/storage/country_decl.hpp
index 1ddb4b6a64..e0d154bb87 100644
--- a/storage/country_decl.hpp
+++ b/storage/country_decl.hpp
@@ -29,5 +29,8 @@ namespace storage
string m_flag;
bool IsNotEmpty() const { return !m_flag.empty(); }
+
+ static string FileName2FullName(string fName);
+ static void FullName2GroupAndMap(string const & fName, string & group, string & map);
};
}
diff --git a/storage/country_info.cpp b/storage/country_info.cpp
index 74074f6b37..a9e59c2fb1 100644
--- a/storage/country_info.cpp
+++ b/storage/country_info.cpp
@@ -108,15 +108,7 @@ namespace storage
if (info.m_name.empty())
info.m_name = id;
- if (id.find('_') != string::npos)
- {
- size_t const i = info.m_name.find('_');
- ASSERT ( i != string::npos, () );
-
- // replace '_' with ", "
- info.m_name[i] = ',';
- info.m_name.insert(i+1, " ");
- }
+ info.m_name = CountryInfo::FileName2FullName(info.m_name);
}
void CountryInfoGetter::CalcUSALimitRect(m2::RectD rects[3]) const
diff --git a/storage/storage.pro b/storage/storage.pro
index 33faa0509c..86f141289b 100644
--- a/storage/storage.pro
+++ b/storage/storage.pro
@@ -24,3 +24,4 @@ SOURCES += \
country.cpp \
storage.cpp \
country_info.cpp \
+ country_decl.cpp \