Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-01

TReader Fixups

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

I need to stream references in DefineProperties.

For those not familar with the streaming of TReader/TWriter:

For example TForm.ActiveControl is a class property and is a reference to TControl. TWriter simply writes the name of the control. TReader reads the identifier, but during streaming not all controls are created, so TReader saves this as ToDo in a FFixUps list and sets all references after loading.
That's a great feature, but it is private. You can not use it in your DefineProperties. It seems Delphi has the same problem. Either I'm blind and TReader has already a solution or we need a public method. For example

procedure TReader.AddFixUp(Instance: TPersistent; PropInfo: Pointer;
  const Ident: string);
begin
  FFixups.Add(TPropFixup.Create(Instance, Root, PropInfo, '', Ident));
end;

I can write a patch and test it.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 22 lines
I need to stream references in DefineProperties. For those not familar with the streaming of TReader/TWriter: For example TForm.ActiveControl is a class property and is a reference to TControl. TWriter simply writes the name of the control. TReader reads the identifier, but during streaming not all controls are created, so TReader saves this as ToDo in a FFixUps list and sets all references after loading. That's a great feature, but it is private. You can not use it in your DefineProperties. It seems Delphi has the same problem. Either I'm blind and TReader has already a solution or we need a public method. For example procedure TReader.AddFixUp(Instance: TPersistent; PropInfo: Pointer; const Ident: string); begin FFixups.Add(TPropFixup.Create(Instance, Root, PropInfo, '', Ident)); end; I can write a patch and test it.

That would be best.

Michael.

Reply by email

Peter H.M. Brooks
to Mattias Gaertner: I need to stream references in DefineProperties. For those not familar with the streaming…

This is probably a simple question and I ought to know the answer - but I don't!

Is there an object in Pascal (fpc, of course) that I can use like this:

1. Push things (bytes, asciistrings, integers ..) onto like a stack
2. Find the length of in bytes
3. Write out, or use generally, as an array?

I can write one as an object, but, if there already is such a thing then
I'd rather use it than re-invent the wheel!

Reply by email