Opened 12 years ago

Last modified 8 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:
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 12 years ago.
Testing program.
StringList-Sort-2.patch (1.0 KB ) - added by dknoto 12 years ago.
0002-BStringList-implemented-Sort-with-custom-sort-functi.patch (1.3 KB ) - added by dknoto 12 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by dknoto, 12 years ago

patch: 01

by dknoto, 12 years ago

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

Testing program.

by dknoto, 12 years ago

Attachment: StringList-Sort-2.patch added

comment:2 by dknoto, 12 years ago

Please remove files StringList-Test-2.tar.2.xz​ and StringList-Test-2.tar.3.xz. Web+ has some bug.​

comment:3 by bonefish, 12 years ago

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 by dknoto, 12 years ago

Okay, these are my first programing steps in this system. I will try to learn the local customs as soon as possible ;-)

comment:5 by bonefish, 12 years ago

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 by dknoto, 12 years ago

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

comment:7 by pulkomandy, 10 years ago

Milestone: R1Unscheduled

comment:8 by axeld, 8 years ago

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