Board index » delphi » What are TCollection's accessor methods?

What are TCollection's accessor methods?

I want to change the way a TCollection stores its data. What are the
accessor methods use by TCollections? Will overloading At, AtInsert,
AtDelete, and FreeItem be enough?
 

Re:What are TCollection's accessor methods?


zho...@hotmail.com schrieb:

Quote

> I want to change the way a TCollection stores its data. What are the
> accessor methods use by TCollections? Will overloading At, AtInsert,
> AtDelete, and FreeItem be enough?

The source is in Objects.PAS, here you see all you need.

I used TCollection and TSortedcollection without modification
of the original to store longints instead of pointers, which
were simple record numbers in a file. It worked smoothly.
The main limitation is the 64k boundary, so you can have a
maximum Count of 163xx.

Franz Glaser

Re:What are TCollection's accessor methods?


In article: <35CE513C.497DF...@hotmail.com>  zho...@hotmail.com writes:

Quote

>I want to change the way a TCollection stores its data. What are the
>accessor methods use by TCollections? Will overloading At, AtInsert,
>AtDelete, and FreeItem be enough?

Not sure how much I can help you because you don't say how or why you want to
change it, however TCollections assume they hold a collection TObject
decendants, so the collection itself (TCollection.List) is an array of pointers
to TObject's. If you want to store non-TObjects, or non-dynamically allocated
TObject descendants in the collection you must override FreeItem, GetItem and
PutItem.

BTW, in direct answer to your subject line, the only ancestor methods of
TCollection are those inherited from TObject - Init, Done and Free, all of
which are overridden by TCollection.

-- Jay

 -----------------------------------------
| Jason Burgon - author of Graphic Vision |
| g...@jayman.demon.co.uk                   |
| http://www.jayman.demon.co.uk           |
 -----------------------------------------

Re:What are TCollection's accessor methods?


In article <35CE513C.497DF...@hotmail.com>,

Quote
  zho...@hotmail.com wrote:
> I want to change the way a TCollection stores its data. What are the
> accessor methods use by TCollections? Will overloading At, AtInsert,
> AtDelete, and FreeItem be enough?

When having a look on the source of TCollection in OBJECTS.PAS you will see
that there are a number of methodes written in assembly language, like
FirstThat, ForEach, etc. . You'll have to rewrite them as well.

Tom.
--
Tom Wellige
HP48: http://hpshell.home.ml.org
Private: http://wellige.home.ml.org

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Other Threads