MCPcopy Create free account
hub / github.com/Soundux/Soundux / removeTabById

Method removeTabById

src/core/objects/data.cpp:23–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 return tabs.back();
22 }
23 void Data::removeTabById(const std::uint32_t &index)
24 {
25 if (tabs.size() > index)
26 {
27 auto &tab = tabs.at(index);
28 for (auto &sound : tab.sounds)
29 {
30 Globals::gSounds->erase(sound.id);
31 if (sound.isFavorite)
32 {
33 Globals::gFavorites->erase(sound.id);
34 }
35 }
36
37 tabs.erase(tabs.begin() + index);
38
39 for (std::size_t i = 0; tabs.size() > i; i++)
40 {
41 tabs.at(i).id = i;
42 }
43 }
44 else
45 {
46 Fancy::fancy.logTime().warning() << "Tried to remove non existent tab" << std::endl;
47 }
48 }
49 void Data::setTabs(const std::vector<Tab> &newTabs)
50 {
51 tabs = newTabs;

Callers 1

removeTabMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected