Returning structs of NSStrings
Returning structs of NSStrings
- Subject: Returning structs of NSStrings
- From: Michael Becker <email@hidden>
- Date: Thu, 25 Mar 2004 10:22:19 +0100
Hi!
In my application I have several structs which containt mostly
NSStrings (I have not made these into a class since I was too lazy to
write 2 accessor methods [setXXX and getXXX] for each string,
especially since these "string-composits" don't have to do anything on
their own, their really just good old structs :-) ).
Now when I have a function that is supposed to return such a struct, do
all of these NSStrings have to be autoreleased? Here's an example:
- (MyUser)returnUser {
NSDatat *xmlData = [ network getUserXMLData]:
[ . . . ]
MyUser user;
user.name = [[ xmlContainer descriptionAtIndex:0] autorelease];
user.phone = [[ xmlContainer desciprtionAtIndex:0] autorelease];
user.street = [[ xmlContainer descriptionAtIndex:0] autorelease];
return user;
}
Is that the way to go? Or should I bother and make "MyUser" into a real
class?
Bye,
Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.