I’m building an Objective-C wrapper for a nasty legacy C-library. Assume I have two Objective-C classes A and B wrapping some related legacy structures. Now I would like to provide a function that converts a given object of class A into an object of class B. The problem is, that the conversion process destroys the internal state of the source object.
What is the best solution for implementing this conversion function regarding the standard Objective-C naming convention. I.e. it should be clear that the conversion function will do a release on the given source object.
Instead of asking about a name, perhaps you should ask for strategies on how to do the conversion process without destroying the state of the source object. I can’t imagine any sort of C data that can’t just by
memcpy‘d to a new location. I’d fiddle around with doing that and seeing if duplicating the data before conversion will fix this issue for you.