prologic at daisy.ods.org
Sun Jul 6 17:20:09 CEST 2003
On Sun, Jul 06, 2003 at 05:11:17PM +0200, Marco van de Voort wrote:
> > > IIRC, TCollection only stores TCollectionItem derived classes.
> > >
> > > TList is closer to what you want probably.
> > Is there an example other than list.pp in the fcl source ?
> > Also just for the record of knowing... I have attached datanicks.pas
> > which hold a dynamic array of TNick ... Is this what TList already does
> > (if so I'm wasting my time writing my own code...) ?
> Pretty much yes, but in a class wrapper. You can add and remove items,
> iterate through them etc. Maybe you can derive a class from TList to
> customize it a bit.
However TList by itself would work though ?
> There are two things to think of:
> - you yourself have to make sure that elements are properly freed, so
> when deleting object A, get a reference to it, delete it from the list,
> and then free the object. (however that can be automized in the class
Is this all done and automated in TList ?
> - The internal list has two counters, instead of just "nNicks". One
> (capacity) is the reserved space, the other (count) is the amount of
> elements filled. This avoids too many memory fragmenting reallocs.
> (but that's better, not worse)
> I learned to use the classes from code snippets written for Delphi.
> There is FCL documentation somewhere (and it will be in the next full
> release), but I couldn't find a recent version so fast.
> So I put down a very old version (April 2002) on the web here:
I think it's here also in html format:
> it at least describes the tlist methods.
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
- James Mills
Zero Defect Software Engineers Group - ZDSEG
More information about the fpc-pascal