Opened 6 months ago
Last modified 6 months ago
#9268 new enhancement
BStringList::Sort with own comparing method.
| Reported by: | dknoto | Owned by: | axeld |
|---|---|---|---|
| Priority: | normal | Milestone: | R1 |
| Component: | Kits/Support Kit | Version: | R1/Development |
| Keywords: | BString, Sort, compare | Cc: | |
| Blocked By: | Blocking: | ||
| Has a Patch: | yes | Platform: | All |
Description
I added sorting through his own method of comparing the string.
Attachments (3)
Change History (9)
comment:1 Changed 6 months ago by dknoto
- Has a Patch set
Changed 6 months ago by dknoto
Changed 6 months ago by dknoto
comment:2 Changed 6 months ago by dknoto
Please remove files StringList-Test-2.tar.2.xz and StringList-Test-2.tar.3.xz. Web+ has some bug.
comment:3 Changed 6 months ago by bonefish
As commented in #9267 please use git format-patch to create your patches.
Regarding this patch, intended is a Sort() method with a compare function that operates on const BString& and maybe a second one with const char* parameters. That essentially means avoiding BList::SortItems() and rather using std::sort() directly on BList::Items() with a respective comparison class. That would also be a preferable alternative for the existing Sort() method.
Please mind our coding style guidelines. There should be two blank lines between function definitions.
comment:4 Changed 6 months ago by dknoto
Okay, these are my first programing steps in this system. I will try to learn the local customs as soon as possible ;-)
Changed 6 months ago by dknoto
comment:5 Changed 6 months ago by bonefish
Just to avoid a misunderstanding: The patch (though properly formatted now :-)) doesn't address what the TODO intended. The new Sort() method(s) should have a function argument that compares strings. The Sort() method your patch adds works, of course, but it isn't convenient to use.
comment:6 Changed 6 months ago by dknoto
It seems to me that this approach is difficult. I'm going to develop better version ;-)

Testing program.