🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
2 messages
2 total messages Started by Siddharth Mon, 18 Sep 2006 11:01
Copy TIdMessage Object
#1951
Author: Siddharth
Date: Mon, 18 Sep 2006 11:01
20 lines
1494 bytes
i am using Borland C++Builer 6 with Indy Components.

I want make a copy of TIdMessage and retain the copy even after the original 
obec t gets deleted. I couldn't find copy constructor which could do job for 
me.

Here is the sample code


       TIdMessage *original = new TIdMessage(Owner);
        TIdMessage *copy;
        original->From->Text  = "Nestle netuser <abc@gmail.com>";

        copy = new  TIdMessage(original);
        delete original;
        Sleep(100);

        //After Original Is deleted I want its copy to be present
        ShowMessage(copy->From->Text);
        delete copy;
Re: Copy TIdMessage Object
#1952
Author: Remy Lebeau (TeamB)
Date: Mon, 18 Sep 2006 16:08
21 lines
1754 bytes
"Siddharth" <sidharth@cosmos-call-center.com> wrote in message
news:450e7ed4$1@newsgroups.borland.com...

> I want make a copy of TIdMessage and retain the copy
> even after the original obec t gets deleted.

Like with any other VCL component, there is no direct way to make a copy of
an object from one instance to another.  If you only care about the
published properties, then you can use the Read/WriteComponent() method of
TStream to stream a DFM representation of an object from one instance to
another.  Otherwise, you will just have to copy the desired property values
one at a time in your own code.

> I couldn't find copy constructor which could do job for me.

There are no copy constructors in any VCL component.  The VCL is written in
Pascal, and Delphi does not use copy constructors.  That is a C++ idiom.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads