Re: Question on guidelines of integrating C++ calls inside an Obj C class
Re: Question on guidelines of integrating C++ calls inside an Obj C class
- Subject: Re: Question on guidelines of integrating C++ calls inside an Obj C class
- From: Justin Kolb <email@hidden>
- Date: Wed, 3 Aug 2005 08:06:49 -0500
Make sure you are looking at the type returned by the displayName()
call. You are trying to assign a (char *) to (SipMessage&) I believe
this will fail unless you can convert the string into a SipMessage
first before you assign it. So for example:
message.header(h_To).displayName() = SipMessage(cstr);
If that constructor doesn't exist you'll have to post more details of
the SipMessage so we can try to help.
On Aug 3, 2005, at 1:23 AM, John Draper wrote:
Hi,
Xcuse me got posting this twice, but last week I got no indication
this
message got posted - because I urgently need help, I'm posting this
again.
I'm making calls to a UNIX library written in C++. In specific, it
is the
'resipricate" library written in C++.
I want to use these libraries inside of an Objective C class, in
particular
a "Controller" class. The controller class is obviousy going to have
to
reference the C++ classes, and instances of the C++ classes need to
be defined as Objective C classes. Is this possible? Or do I always
have
to use pointers to the C++ classes when referencing them and use "new"
to Instantiate them?
Another thing I'm not sure of is doing this...
In C++
message.header(h_To).displayName() = "Speedy Shannon";
The "=" is overridden... so, is the string "Speedy Shannon" really a
string?
I want to basically convert an NSString which would come from a GUI,
and pass that into the C++ function you see above...
Would this work?
NSString *str = @"Speedy Shannon";
char *cstr = alloc([str length] + 1); // alloc space for C string
[str getCString:cstr]; // get it from the
NSString
message.header(h_To).displayName() = cstr; // <--- is this the
same as the one above?
The "operator overload" code '=' is defined as such
SipMessage&
SipMessage::operator=(const SipMessage& rhs)
{
// some code....
}
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden