Encoding NSUInteger

  • Making the transition to code that will be prepared for 64 bit may the
    need arise, I changed (with the tops script) the integers to the
    recommended NSInteger's and NSUInteger's.

    Now in NSCoder I do find an encodeInteger:forKey: and
    decodeInteger:forKey: for NSInteger, but the corresponding methods for
    NSUInteger are absent.
    In my code I have NSUInteger's to encode/decode and I would like to do
    this in the correct manner.

    Can I use the NSInteger coding methods directly with the NSUInteger's?
    Or do I need some casting or other magic to get all the bits straight?

    Hans van der Meer
  • On 1/6/08 9:34 PM, Hans van der Meer said:

    > Making the transition to code that will be prepared for 64 bit may the
    > need arise, I changed (with the tops script) the integers to the
    > recommended NSInteger's and NSUInteger's.
    >
    > Now in NSCoder I do find an encodeInteger:forKey: and
    > decodeInteger:forKey: for NSInteger, but the corresponding methods for
    > NSUInteger are absent.
    > In my code I have NSUInteger's to encode/decode and I would like to do
    > this in the correct manner.
    >
    > Can I use the NSInteger coding methods directly with the NSUInteger's?
    > Or do I need some casting or other magic to get all the bits straight?

    NSCoder also has an:

    - (void)encodeInt:(int)intv forKey:(NSString *)key;

    but no 'unsigned int' version.  I guess you'll just have to cast.  Or
    create an NSNumber and use that.

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today