MCPcopy Create free account
hub / github.com/comaps/comaps / ReloadBookmarkRoutine

Method ReloadBookmarkRoutine

libs/map/bookmark_manager.cpp:2129–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2127}
2128
2129void BookmarkManager::ReloadBookmarkRoutine(std::string const & filePath)
2130{
2131 GetPlatform().RunTask(Platform::Thread::File, [this, filePath]()
2132 {
2133 if (m_needTeardown)
2134 return;
2135
2136 auto const ext = GetLowercaseFileExt(filePath);
2137 std::unique_ptr<kml::FileData> kmlData;
2138 if (ext == kKmlExtension)
2139 kmlData = LoadKmlFile(filePath, KmlFileType::Text);
2140 else if (ext == kGpxExtension)
2141 kmlData = LoadKmlFile(filePath, KmlFileType::Gpx);
2142 else
2143 ASSERT(false, ("Unsupported bookmarks extension", ext));
2144
2145 if (m_needTeardown)
2146 return;
2147
2148 auto collection = std::make_shared<KMLDataCollection>();
2149 if (kmlData)
2150 collection->emplace_back(std::move(filePath), std::move(kmlData));
2151
2152 if (m_needTeardown)
2153 return;
2154
2155 NotifyAboutFinishAsyncLoading(std::move(collection));
2156 });
2157}
2158
2159void BookmarkManager::NotifyAboutStartAsyncLoading()
2160{

Callers

nothing calls this directly

Calls 5

GetLowercaseFileExtFunction · 0.85
LoadKmlFileFunction · 0.85
ASSERTFunction · 0.85
RunTaskMethod · 0.80
emplace_backMethod · 0.45

Tested by

no test coverage detected