Thread View: borland.public.cppbuilder.internet.socket
2 messages
2 total messages
Started by federico
Fri, 10 Jun 2005 15:46
IDURI??
Author: federico
Date: Fri, 10 Jun 2005 15:46
Date: Fri, 10 Jun 2005 15:46
24 lines
2020 bytes
2020 bytes
Hi, I'm trying to use the IdURI of Indy, but I have some troblues. -first I'm not exactly sure how to declare an object of this class, It wasnt on the pallet, but thats ok, I declared an object like this : TIdURI *something ; (if I did TIdURI something it will tell me a bad declaration err so I did it that way), then when I try to do something->URLEncode(Edit->Text) I got the following errors: [C++ Error] mess.cpp(62): E2034 Cannot convert 'AnsiString' to 'TMetaClass *' [C++ Error] mess.cpp(62): E2342 Type mismatch in parameter 'vmt' (wanted 'TMetaClass *', got 'AnsiString') [C++ Error] mess.cpp(62): E2192 Too few parameters in call And well on the documentation it says that the function headers are like this: function URLDecode(psSrc: string) so I'm not pretty sur ewhat did I missdid or what I did wrong, I'll apriciate any help, I have been looking for doc on this but couldnt find any beside the indy doc. Thanx for any help!
Re: IDURI??
Author: 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
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