MCPcopy Create free account
hub / github.com/degeneratehyperbola/NEPS / BuildSortByKey

Method BuildSortByKey

shared_lib/imgui/imgui.cpp:1893–1907  ·  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

1891
1892// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
1893void ImGuiStorage::BuildSortByKey()
1894{
1895 struct StaticFunc
1896 {
1897 static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs)
1898 {
1899 // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.
1900 if (((const ImGuiStoragePair*)lhs)->key > ((const ImGuiStoragePair*)rhs)->key) return +1;
1901 if (((const ImGuiStoragePair*)lhs)->key < ((const ImGuiStoragePair*)rhs)->key) return -1;
1902 return 0;
1903 }
1904 };
1905 if (Data.Size > 1)
1906 ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairCompareByID);
1907}
1908
1909int ImGuiStorage::GetInt(ImGuiID key, int default_val) const
1910{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected