MCPcopy Create free account
hub / github.com/RussellJerome/UnrealModLoader / BuildSortByKey

Method BuildSortByKey

UnrealEngineModLoader/ImGui/imgui.cpp:1931–1945  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected