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

Method PrepareFileForSharing

libs/map/bookmark_manager.cpp:3175–3203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3173}
3174
3175void BookmarkManager::PrepareFileForSharing(kml::GroupIdCollection && categoriesIds, SharingHandler && handler,
3176 KmlFileType kmlFileType)
3177{
3178 CHECK_THREAD_CHECKER(m_threadChecker, ());
3179 ASSERT(handler, ());
3180 if (categoriesIds.size() == 1 && IsCategoryEmpty(categoriesIds.front()))
3181 {
3182 handler(SharingResult(std::move(categoriesIds), SharingResult::Code::EmptyCategory));
3183 return;
3184 }
3185
3186 auto collection = PrepareToSaveBookmarks(categoriesIds);
3187 if (!collection || collection->empty())
3188 {
3189 handler(SharingResult(std::move(categoriesIds), SharingResult::Code::FileError));
3190 return;
3191 }
3192
3193 if (m_testModeEnabled)
3194 {
3195 handler(GetFileForSharing(std::move(collection), kmlFileType));
3196 }
3197 else
3198 {
3199 GetPlatform().RunTask(Platform::Thread::File, [collection = std::move(collection), handler = std::move(handler),
3200 kmlFileType = kmlFileType]() mutable
3201 { handler(GetFileForSharing(std::move(collection), kmlFileType)); });
3202 }
3203}
3204
3205void BookmarkManager::PrepareAllFilesForSharing(SharingHandler && handler)
3206{

Calls 7

ASSERTFunction · 0.85
SharingResultClass · 0.85
GetFileForSharingFunction · 0.85
frontMethod · 0.80
RunTaskMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64