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:
authorAlex Zolotarev <alex@maps.me>2016-02-16 20:30:13 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:21:21 +0300
commit7fe0b337465a4f8ea02a72f9e6ba204121d74b2f (patch)
treed1f3073b83b1fd26fc51715d5c596e4511c45fbf /indexer/categories_holder.cpp
parentef52d80f847be0e9c6996905bd7d82c0cbe980a2 (diff)
CategoriesHolder::GetReadableFeatureType().
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r--indexer/categories_holder.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp
index 4c222c9931..7c84017b3d 100644
--- a/indexer/categories_holder.cpp
+++ b/indexer/categories_holder.cpp
@@ -199,6 +199,27 @@ bool CategoriesHolder::GetNameByType(uint32_t type, int8_t locale, string & name
return false;
}
+string CategoriesHolder::GetReadableFeatureType(uint32_t type, int8_t locale) const
+{
+ ASSERT_NOT_EQUAL(type, 0, ());
+ uint8_t level = ftype::GetLevel(type);
+ ASSERT_GREATER(level, 0, ());
+
+ string name;
+ while (true)
+ {
+ if (GetNameByType(type, locale, name))
+ return name;
+
+ if (--level == 0)
+ break;
+
+ ftype::TruncValue(type, level);
+ }
+
+ return classif().GetReadableObjectName(type);
+}
+
bool CategoriesHolder::IsTypeExist(uint32_t type) const
{
pair<IteratorT, IteratorT> const range = m_type2cat.equal_range(type);