Article View: borland.public.cppbuilder.internet.socket
Article #3869Re: IDURI??
From: Remy Lebeau (TeamB)
Date: Fri, 10 Jun 2005 19:30
Date: Fri, 10 Jun 2005 19:30
49 lines
2680 bytes
2680 bytes
"federico" <federico@sandiasazules.com> wrote in message
news:42a9b5da@newsgroups.borland.com...
> -first I'm not exactly sure how to declare an object of this class
TIdURI *uri = new TIdURI("URIToParse");
//...
delete uri;
> It wasnt on the pallet
TIdURI is not a component to begin with, thus it does not appear on the
Component Palette.
> [C++ Error] mess.cpp(62): E2034 Cannot convert 'AnsiString'
> to 'TMetaClass *'
URLEncode() is declared as a 'class' method in Indy's Delphi source code.
The closest C++ equivilent (but not exactly the same) is a 'static' method.
Like a 'static' method, a 'class' method does not need an object instance in
order to be called. The difference between a Delphi 'class' method and a
C++ 'static' method, however, is that the class type information is passed
to a 'class' method, whereas it is not in a 'static' method. That is where
the extra TMetaClass parameter comes into play in C++ (it is implicitally
passed in Delphi, much like the 'this' pointer is for non-static methods).
In C++, you have to pass in the class type manually, via the __classid()
keyword, ie:
... = something->URLEncode(__classid(TIdURI), Edit->Text);
Or alternatively, without an object instance:
... = TIdURI::URLEncode(__classid(TIdURI), Edit->Text);
> And well on the documentation it says that the function headers
> are like this:
>
> function URLDecode(psSrc: string)
That is a Delphi declaration, not a C++ declaration. Indy is written in
Delphi, and the documentation shows Delphi examples, not C++ ones. If you
look in IdURI.hpp, you will see this instead:
/* class method */ static AnsiString __fastcall URLEncode(TMetaClass*
vmt, const AnsiString ASrc);
Gambit
Technical Details
Message-ID:
<42a9eacc$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42a9b5da@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8b3996f72d0ad02d X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <42a9b5da@newsgroups.borland.com> Subject: Re: IDURI?? Date: Fri, 10 Jun 2005 12:30:43 -0700 Lines: 51 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <42a9eacc$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118431948 68.69.17.41 (10 Jun 2005 12:32:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail