• 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
Accessor Madness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessor Madness


  • Subject: Accessor Madness
  • From: Kirk Kerekes <email@hidden>
  • Date: Fri, 24 May 2002 13:24:29 -0500

While waiting for the Perfect Accessor Generator (which ought to be integral to PB -- hint, hint, Apple), I am using the following:

A vanilla C macro:

#define SETIDACCESSOR(obj,iv) [self KKSetObject:(obj) inIV: &(iv)
]

Combined with a method:

- (void) KKSetObject:(id) object inIV:(id *) iv
{
id temp = *iv;
[object retain];
*iv = object;
[temp release];
}

-- so that my object-set-accessors are reduced to:

- (void) setModelData:(NSDictionary *) dict
{
SETIDACCESSOR(dict,modelData);
}

Someone with more desire to mess with #defines than I do could probably reduce this to:

SETIDACCESSOR(modelData);


-- although I'm not going to try unless someone can tell me how to see preprocessor output in PB.

Now if only I would declare KKSetObject:inIV: as a category on NSObject...
_______________________________________________
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.

  • Follow-Ups:
    • Re: Accessor Madness
      • From: Marcel Weiher <email@hidden>
  • Prev by Date: Constructive Ideas
  • Next by Date: Re: scannerWithString
  • Previous by thread: Re: HeaderDoc vs AutoDoc
  • Next by thread: Re: Accessor Madness
  • Index(es):
    • Date
    • Thread