Re: Specifying primitive types in NSCoders
Re: Specifying primitive types in NSCoders
- Subject: Re: Specifying primitive types in NSCoders
- From: Greg Scown <email@hidden>
- Date: Sun, 30 Jun 2002 00:23:34 +0800
Here's one:
int version = 1;
[coder decodeValueOfObjCType:@encode(int) at:&version];
The @encode() allows you to specify primitive types by name rather than
memorizing constants. It works similarly to @selector() which you've
probably already encountered.
Greg Scown
--
Send anything you can print with Mac OS X as an E-mail or fax with Page
Sender!
http://www.smilesoftware.com/pagesender/
I'm sure this is a simple one, but I can't find any concrete examples of
how to specify primitive types in encoding and decoding methods.
For example:
- (void)decodeValueOfObjCType:(const char *)valueType at:(void *)data
What exactly do you pass into "valueType"?
Is Apple actually making us do something like this?
char floatConstant = 'f'
float floatValue;
[self decodeValueOfObjCType:&floatConstant at:&floatValue];
Don't they have constants defined for these?
I looked at NSCoder which tells you to look at chapter 4 in the Obj c
reference. Looking in Obj c reference it has a table of values, but no
examples of use and says look at NSCoder
Could someone provide a couple of quick examples for how to call encode
and decode for primitives
_______________________________________________
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.