Home
last modified time | relevance | path

Searched hist:a8544a5bb3406e7f36e850a500f2dd5f5b4285c3 (Results 1 – 2 of 2) sorted by relevance

/openbmc/bmcweb/include/
H A Dhuman_sort.hppa8544a5bb3406e7f36e850a500f2dd5f5b4285c3 Wed Sep 29 16:31:13 CDT 2021 Ed Tanous <edtanous@google.com> Implement human sort utility function

This commit implements the ability to sort lists of strings that might
include numbers into "human" ordered lists. As an example of a problem
this solves, imagine a system with 12 dimms, today std::sort would net
you:

Dimm1
Dimm11
Dimm12
Dimm2
Dimm3
.....

This method breaks apart that string and sorts them in a way humans
would expect.

This code is originally inspired by the algorithm defined here:
http://www.davekoelle.com/alphanum.html. The site does include c++ code
that is MIT licensed, but is significantly more complex than what is
present in this commit. This commit also takes advantages in the form
of std::string_view to deduplicate overloads, as well as other c++17
features.

Tested:
Unit tests pass

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iac54c2e0d9998d4d622d74049b1dd957e4b3ca75
/openbmc/bmcweb/
H A Dmeson.builddiff a8544a5bb3406e7f36e850a500f2dd5f5b4285c3 Wed Sep 29 16:31:13 CDT 2021 Ed Tanous <edtanous@google.com> Implement human sort utility function

This commit implements the ability to sort lists of strings that might
include numbers into "human" ordered lists. As an example of a problem
this solves, imagine a system with 12 dimms, today std::sort would net
you:

Dimm1
Dimm11
Dimm12
Dimm2
Dimm3
.....

This method breaks apart that string and sorts them in a way humans
would expect.

This code is originally inspired by the algorithm defined here:
http://www.davekoelle.com/alphanum.html. The site does include c++ code
that is MIT licensed, but is significantly more complex than what is
present in this commit. This commit also takes advantages in the form
of std::string_view to deduplicate overloads, as well as other c++17
features.

Tested:
Unit tests pass

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iac54c2e0d9998d4d622d74049b1dd957e4b3ca75