[fpc-devel] Questions on TStringList.Find change (Mantis 28744)
Michael Van Canneyt
michael at freepascal.org
Sat Mar 26 10:19:17 CET 2016
On Tue, 22 Mar 2016, David Jenkins wrote:
>
>
> On 3/22/16 10:48 AM, Michael Van Canneyt wrote:
>>
>>
>> On Tue, 22 Mar 2016, David Jenkins wrote:
>>
>>> No one here holds Delphi up on a pedestal - least of all me. My viewpoint
>>> is completely practical/funcitonal - I have to make our code base work
>>> with FPC/LCL and VCL. Given the way we use find functionality (with a
>>> mixture of naturally sorted and automatically sorted lists) it has ceased
>>> to work with both (it did previously). I want to fix that as elegantly and
>>> as effectively as possible. Making suggestions for FPC improvement is a
>>> side effect - and as we both agree TStringList.Find can use some
>>> improvement.
>>
>
> I do not have a preference.
I have implemented a new property
TStringsSortStyle = (sslNone,sslUser,sslAuto);
Property SortStyle : TStringsSortStyle Read FSortStyle Write SetSortStyle;
I assume the meaning is clear.
- Sorted is true if SortStyle is in [sslUser,sslAuto], so it reflects actual state.
- Setting sorted to True is equivalent to setting SortStyle = sslAuto
- Setting sorted to false is equivalent to setting SortStyle = sslNone
- Find will work on one of those values, but it will raise an exception if sortstyle = sslnone
- Add will put a new string on the 'correct' place if SortStyle=sslAuto
- Insert will raise an error (as it was) if SortStyle=sslAuto.
Michael.
More information about the fpc-devel
mailing list