Opened 6 years ago

Last modified 2 years ago

#9268 assigned enhancement

BStringList::Sort with own comparing method.

Reported by: dknoto Owned by: nobody
Priority: normal Milestone: Unscheduled
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)

StringList-Test-2.tar.xz (1.4 KB) - added by dknoto 6 years ago.
Testing program.
StringList-Sort-2.patch (1.0 KB) - added by dknoto 6 years ago.
0002-BStringList-implemented-Sort-with-custom-sort-functi.patch (1.3 KB) - added by dknoto 6 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 6 years ago by dknoto

Has a Patch: set

Changed 6 years ago by dknoto

Attachment: StringList-Test-2.tar.xz added

Testing program.

Changed 6 years ago by dknoto

Attachment: StringList-Sort-2.patch added

comment:2 Changed 6 years 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 years 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 years 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 ;-)

comment:5 Changed 6 years 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 years ago by dknoto

It seems to me that this approach is difficult. I'm going to develop better version ;-)

comment:7 Changed 4 years ago by pulkomandy

Milestone: R1Unscheduled

comment:8 Changed 2 years ago by axeld

Owner: changed from axeld to nobody
Status: newassigned
Note: See TracTickets for help on using tickets.