• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
how to check if a property is empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: how to check if a property is empty?
      • From: Jens Alfke <email@hidden>
    • Re: how to check if a property is empty?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Communications between multiple NIB's
  • Next by Date: Re: NSScroller question
  • Previous by thread: Re: Thread safe?
  • Next by thread: Re: how to check if a property is empty?
  • Index(es):
    • Date
    • Thread