RE: Returning nil from -init
RE: Returning nil from -init
- Subject: RE: Returning nil from -init
- From: "Mondragon, Ian" <email@hidden>
- Date: Wed, 12 Mar 2003 10:42:24 -0600
yeah...just sent out the correction when i noticed it...:-)
>
-----Original Message-----
>
From: j o a r [SMTP:email@hidden]
>
Sent: Wednesday, March 12, 2003 10:40 AM
>
To: Mondragon, Ian
>
Cc: email@hidden; email@hidden
>
Subject: Re: Returning nil from -init
>
>
..or alternatively something that might actually work:
>
>
- (id) initWithData:(NSData *) data
>
{
>
self = [super init];
>
>
if (self != nil)
>
{
>
if ([self _parseData: data])
>
{
>
[self setData: data];
>
}
>
else
>
{
>
[self release];
>
self = nil;
>
}
>
}
>
>
return self;
>
}
>
>
j o a r
>
>
On Wednesday, Mar 12, 2003, at 17:04 Europe/Stockholm, Mondragon, Ian
>
wrote:
>
>
> // then you can verify the pdb argument before
>
> // setting it as an ivar & not have to deal with it
>
> - initWithData:(NSData *)pdb
>
> {
>
> if ((self = [super init]))
>
> {
>
> if ([self _parseData:pdb])
>
> {
>
> [self setData:pdb];
>
>
>
> return YES;
>
> }
>
> }
>
>
>
> return NO;
>
> }
_______________________________________________
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.