MCPcopy Create free account
hub / github.com/Lovrom8/RSMods / BuildSortByKey

Method BuildSortByKey

DLL/Lib/ImGUI/imgui.cpp:1939–1953  ·  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

1937
1938// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
1939void ImGuiStorage::BuildSortByKey()
1940{
1941 struct StaticFunc
1942 {
1943 static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs)
1944 {
1945 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
1946 if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;
1947 if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;
1948 return 0;
1949 }
1950 };
1951 if (Data.Size > 1)
1952 ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairCompareByID);
1953}
1954
1955int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
1956{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected