how to check if a property is empty?
how to check if a property is empty?
- Subject: how to check if a property is empty?
- From: Davide Benini <email@hidden>
- Date: Sat, 29 Mar 2008 16:32:54 +0100
Hello folks.
I have a class with a number of properties. Some of them are used only
in specific instances. I need to check whether these properties have
been assigned a value; I am thinking about a method similar to isset
in php.
I alloc and init properties in the genral init methid; I release them
in the dealloc method.
- (void) dealloc
{
[repetitions release];
[variantEnding release];
[body release];
[super dealloc];
}
- (id) init
{
self = [super init];
if (self != nil) {
repetitions = [[NSNumber alloc] init];
variantEnding = [[NSNumber alloc] init];
body = [[NSMutableArray alloc] init];
}
return self;
}
I assign their value when it is needed.
Let's say I have an instance of this class, called *thisObject. How do
I check whether I have assigned a value to thisObject.variantEnding or
if the property is inialized but empty?
This is probably a noob question, but I couldn't find an answer in the
docs.
Thanks in advance.
Davide
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden