BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

One more for delphi to bcb

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Greg Stantin
Guest





PostPosted: Thu Apr 29, 2004 8:52 pm    Post subject: One more for delphi to bcb Reply with quote



I am stuck on this one.
Data := THttpDirEntry(FileList.Objects[I]);

Data = THttpDirEntry(DirList->Objects[I]);

But i get
[C++ Error] WebServ1.cpp(500): E2285 Could
not find a match for 'THttpDirEntry::THttpDirEntry(TObject *)'

I am assuming my translation is incorrect.


Is this line correct.

FileList.Objects[I].Free;

delete(FileList->Objects[I]);


Thanks


Back to top
Hans Galema
Guest





PostPosted: Thu Apr 29, 2004 9:15 pm    Post subject: Re: One more for delphi to bcb Reply with quote



Greg Stantin wrote:

Quote:
Data := THttpDirEntry(FileList.Objects[I]);

Data = THttpDirEntry(DirList->Objects[I]);

But i get
[C++ Error] WebServ1.cpp(500): E2285 Could
not find a match for 'THttpDirEntry::THttpDirEntry(TObject *)'

Please provide the type of the used 'DirList' too.

Why not keep with a 'FileList' ? What would be that type ?

Hans.

Back to top
Greg Stantin
Guest





PostPosted: Thu Apr 29, 2004 9:31 pm    Post subject: Re: One more for delphi to bcb Reply with quote



I pasted the wrong code, there are actually two TStringList
that does the stuff. Tell me if this helps.

Data : THttpDirEntry;
DirList := TStringList.Create;

// file name
DirList.AddObject(Data.Name, Data)

----snip--------

if Total <= 0 then
//Result := Result +' Result := Result
else begin
for I := 0 to DirList.Count - 1 do begin
Data := THttpDirEntry(DirList.Objects[I]);
Result := Result + '<tr>' + FormatDirEntry(Data) + '</tr>' +
#13#10;
DirList.Objects[I].Free;
end;
DirList.Free;

// I just need this line
Data = THttpDirEntry(DirList->Objects[I]);


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Apr 29, 2004 9:57 pm    Post subject: Re: One more for delphi to bcb Reply with quote


"Greg Stantin" <gstantin (AT) stantonassoc (DOT) com> wrote

Quote:
I am stuck on this one.
Data := THttpDirEntry(FileList.Objects[I]);

Data = (THttpDirEntry*)(FileList->Objects[I]);
Or:
Data = static_cast<THttpDirEntry*>(FileList->Objects[I]);

Quote:
Is this line correct.

FileList.Objects[I].Free;

delete(FileList->Objects[I]);

You don't need the paranthesis:

delete FileList->Objects[I];

Also, assuming THttpDirEntry derives from TObject, then yes, it will work.
Otherwise, you will have to cast:

delete (THttpDirEntry*)(FileList->Objects[I]);
Or:
delete static_cast<THttpDirEntry*>(FileList->Objects[I]);


Gambit



Back to top
Greg Stantin
Guest





PostPosted: Thu Apr 29, 2004 10:43 pm    Post subject: Re: One more for delphi to bcb Reply with quote

Quote:
Data = (THttpDirEntry*)(FileList->Objects[I]);

That was it. I am still looking for a reference list that shows some
of the delphi to bcb syntax. I saw a list somewhere before, but
i could never remember where.


Appreciate the help Gambit.


Greg



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.