Re: Question on guidelines of integrating C++ calls
Re: Question on guidelines of integrating C++ calls
- Subject: Re: Question on guidelines of integrating C++ calls
- From: "Theodore H. Smith" <email@hidden>
- Date: Wed, 3 Aug 2005 15:20:18 +0100
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?
Use .mm files instead of .m files. This is ObjC++. Your code will now
be not using standard GCC, but using Apple's standard extensions.
This isn't a problem for over 99% of Mac developers, though.
I want to basically convert an NSString which would come from a GUI,
and pass that into the C++ function you see above...
I've done a lot of that. I suggest using the UTF8 NSstring methods,
otherwise you'll be in for a real pain when it comes to Unicode.
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
No! Use the UTF8 methods instead. Unless you are sure your app only
ever uses ASCII.
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....
}
I did something like that. How to use operators in C++, though, is
often a tricky problem, for which only you'll be able to decide how
best to use them. Operators can often introduce bugs that have no
visible cause, or cause compilation ambiguities, which is why I say
they are tricky.
--
http://elfdata.com/plugin/ Industrial strength string processing,
made easy.
"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."
_______________________________________________
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