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

Method SetUniqueName

libs/map/bookmark_manager.cpp:3004–3026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3002
3003template <typename UniquityChecker>
3004void BookmarkManager::SetUniqueName(kml::CategoryData & data, UniquityChecker checker)
3005{
3006 auto originalName = kml::GetDefaultStr(data.m_name);
3007 if (originalName.empty())
3008 {
3009 originalName = kDefaultBookmarksFileName;
3010 kml::SetDefaultStr(data.m_name, originalName);
3011 }
3012
3013 auto uniqueName = originalName;
3014 int counter = 0;
3015 while (!checker(uniqueName))
3016 uniqueName = originalName + strings::to_string(++counter);
3017
3018 if (counter > 0)
3019 {
3020 auto const sameCategoryId = GetCategoryId(originalName);
3021 if (data.m_id != kml::kInvalidMarkGroupId && data.m_id < sameCategoryId)
3022 SetCategoryName(sameCategoryId, uniqueName);
3023 else
3024 kml::SetDefaultStr(data.m_name, uniqueName);
3025 }
3026}
3027
3028std::unique_ptr<kml::FileData> BookmarkManager::CollectBmGroupKMLData(BookmarkCategory const * group) const
3029{

Callers

nothing calls this directly

Calls 4

GetDefaultStrFunction · 0.85
SetDefaultStrFunction · 0.85
to_stringFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected