Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question on guidelines of integrating C++ calls inside an Obj C class



Hi,

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.