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

loader.cpp « ugc - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b28d9e34617d14c89e945c4e52e77f69bd0668a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "ugc/loader.hpp"

#include "ugc/types.hpp"

#include "indexer/feature.hpp"
#include "indexer/index.hpp"

#include "defines.hpp"

namespace ugc
{
Loader::Loader(Index const & index) : m_index(index) {}

void Loader::GetUGC(FeatureID const & featureId, UGC & result)
{
  UGC ugc;
  auto const & handle = m_index.GetMwmHandleById(featureId.m_mwmId);

  if (!handle.IsAlive())
    return;

  auto const & value = *handle.GetValue<MwmValue>();

  if (!value.m_cont.IsExist(UGC_FILE_TAG))
    return;

  auto readerPtr = value.m_cont.GetReader(UGC_FILE_TAG);

  if (!m_d.Deserialize(*readerPtr.GetPtr(), featureId.m_index, ugc))
    return;

  result = std::move(ugc);
}
}  // namespace ugc