MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/Cauldron / BuildSortByKey

Method BuildSortByKey

libs/imgui/imgui.cpp:1431–1445  ·  view source on GitHub ↗

For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.

Source from the content-addressed store, hash-verified

1429
1430// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
1431void ImGuiStorage::BuildSortByKey()
1432{
1433 struct StaticFunc
1434 {
1435 static int PairCompareByID(const void* lhs, const void* rhs)
1436 {
1437 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
1438 if (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1;
1439 if (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1;
1440 return 0;
1441 }
1442 };
1443 if (Data.Size > 1)
1444 qsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID);
1445}
1446
1447int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
1448{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected