diff options
author | vng <viktor.govako@gmail.com> | 2012-12-19 01:04:48 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:48:06 +0300 |
commit | 836d3f86cf8e7a682e7215d4a509b8152a3cb740 (patch) | |
tree | 1c3bacb695370635cb9469e46848ebfde06991a5 /indexer/index.cpp | |
parent | 3841eefecc8f83d47c9a654678b5d8ece6a80ba5 (diff) |
[search] Get english country name from mwm file name.
Diffstat (limited to 'indexer/index.cpp')
-rw-r--r-- | indexer/index.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/indexer/index.cpp b/indexer/index.cpp index cd6989798d..ec00db4d9d 100644 --- a/indexer/index.cpp +++ b/indexer/index.cpp @@ -2,16 +2,43 @@ #include "data_header.hpp" #include "../platform/platform.hpp" +#include "../platform/file_name_utils.hpp" #include "../coding/internal/file_data.hpp" +////////////////////////////////////////////////////////////////////////////////// +// MwmValue implementation +////////////////////////////////////////////////////////////////////////////////// + MwmValue::MwmValue(string const & name) - : m_cont(GetPlatform().GetReader(name)), m_name(name) + : m_cont(GetPlatform().GetReader(name)) { m_factory.Load(m_cont); } +string MwmValue::GetFileName() const +{ + string s = m_cont.GetFileName(); + pl::GetNameFromURLRequest(s); + pl::GetNameWithoutExt(s); + return s; +} + +////////////////////////////////////////////////////////////////////////////////// +// Index::MwmLock implementation +////////////////////////////////////////////////////////////////////////////////// + +string Index::MwmLock::GetFileName() const +{ + MwmValue * p = GetValue(); + return (p ? p->GetFileName() : string()); +} + +////////////////////////////////////////////////////////////////////////////////// +// Index implementation +////////////////////////////////////////////////////////////////////////////////// + int Index::GetInfo(string const & name, MwmInfo & info) const { MwmValue value(name); @@ -121,6 +148,10 @@ void Index::UpdateMwmInfo(MwmId id) } } +////////////////////////////////////////////////////////////////////////////////// +// Index::FeaturesLoaderGuard implementation +////////////////////////////////////////////////////////////////////////////////// + Index::FeaturesLoaderGuard::FeaturesLoaderGuard(Index const & parent, MwmId id) : m_lock(parent, id), /// @note This guard is suitable when mwm is loaded @@ -128,6 +159,11 @@ Index::FeaturesLoaderGuard::FeaturesLoaderGuard(Index const & parent, MwmId id) { } +bool Index::FeaturesLoaderGuard::IsWorld() const +{ + return (m_lock.GetValue()->GetHeader().GetType() == feature::DataHeader::world); +} + void Index::FeaturesLoaderGuard::GetFeature(uint32_t offset, FeatureType & ft) { m_vector.Get(offset, ft); |