[fpc-devel] Questions on TStringList.Find change (Mantis 28744)

Michael Van Canneyt michael at freepascal.org
Wed Mar 23 08:42:24 CET 2016



On Tue, 22 Mar 2016, Denis Kozlov wrote:

> On 22/03/2016 17:56, Michael Van Canneyt wrote:
>> or better something concise like ltAuto,ltUser,ltNone.
>
> It may make more sense to call it ListSortType (as opposed to ListType):
>  TListSortType = (lstNone, lstAuto, lstManual);

I went for TStringsSortStyle

>
> Something like this could work (prototype code):

>
> =======================================================
> function TStringList.GetSorted: Boolean;
> begin
>  Result := (FSortType = lstAuto);
> end;

This should be
   Result in [lstAuto, lstManual];
I am in agreement with David Jenkins that Sorted should reflect the actual state; 
no matter how this state was reached.

> begin
>  if FSortType <> lstNonethen
>    Result := FindSorted(S, Index);
>  else
>  begin
>    Index := IndexOf(S);

I raise an exception here. Find is for sorted lists.

I have an implementation ready, as soon as all tests are done I will commit it.

Michael.



More information about the fpc-devel mailing list