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

Method CreateBookmarkCategory

libs/map/bookmark_manager.cpp:2637–2653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2635}
2636
2637kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(kml::CategoryData && data, bool autoSave /* = true */)
2638{
2639 CHECK_THREAD_CHECKER(m_threadChecker, ());
2640
2641 // _group id_ is not persistant and assigned every time on loading from file.
2642 /// @todo Is there any reason to keep and update kLastBookmarkCategoryId in SecureStorage (settings).
2643 if (data.m_id == kml::kInvalidMarkGroupId)
2644 data.m_id = UserMarkIdStorage::Instance().GetNextCategoryId();
2645 auto groupId = data.m_id;
2646
2647 CHECK_EQUAL(m_categories.count(groupId), 0, ());
2648 CHECK_EQUAL(m_compilations.count(groupId), 0, ());
2649 m_categories.emplace(groupId, std::make_unique<BookmarkCategory>(std::move(data), autoSave));
2650 UpdateBmGroupIdList();
2651 m_changesTracker.OnAddGroup(groupId);
2652 return groupId;
2653}
2654
2655kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(std::string const & name, bool autoSave)
2656{

Calls 4

GetNextCategoryIdMethod · 0.80
OnAddGroupMethod · 0.80
countMethod · 0.45
emplaceMethod · 0.45

Tested by 2

UNIT_TESTFunction · 0.64
UNIT_CLASS_TESTFunction · 0.64