• 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
Re: Casting from NSArray to a custom class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Casting from NSArray to a custom class


  • Subject: Re: Casting from NSArray to a custom class
  • From: "newdev@yahoo" <email@hidden>
  • Date: Wed, 16 Feb 2005 06:44:27 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

Hi,
         The structure that I have written in the code is the C equivalent of the data structure I am expecting to get from the function call in Objective C.
         I understand that NSArray will contain an array of certain 'Objects'. I expect those objects to contain data similar to the C structure I mentioned in my code. But I the data seems to be offsetted. Now I have to access these objects from NSArray, and extract 2 'unsigned long' values per Object. I do *not* want to convert the objects into a 'struct'. 
 
         As was mentioned in the previous post, there exists an offset that I will have to adjust. I am not able to figure out the offset, otherwise I could have converted the Objects into an interface containing the 2 'unsigned long' variables.
 
         The reason of the problem is that the NSArray is being returned through an interface that is opaque to me, and I don't know how to convert the NSArray elements back into some legible form.
 
Kindly look into the matter.
Thanks and Regards,
Rohit   

Justin Spahr-Summers <email@hidden> wrote:
On Wed, 16 Feb 2005 01:37:06 -0800 (PST), newdev@yahoo
wrote:
> Hi all,
>
>
> As for details of what I want to do -
> I have got an NSArray* that should contain some data; a list(array) of
> struct mystruct
> {
> unsigned long varA;
> unsigned long varB;
> }
> objects.

Well first of all, NSArrays cannot contain standard types, they can
only contain Objective-C objects, so assuming your NSArray holds
NSNumbers, you would have to access each NSArray object in a loop and
get that NSNumber, and then your unsigned long from that.

>
> I apologize for miscommunication if any, but I thought that it was imminent
> that I was talking about 'reference' to an object. I think my reference to
> 'reinterpret_cast' should have made the things clear.
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Casting from NSArray to a custom class
      • From: Guy English <email@hidden>
References: 
 >Re: Casting from NSArray to a custom class (From: Justin Spahr-Summers <email@hidden>)

  • Prev by Date: RE: Re: Sorting
  • Next by Date: Modal for document?
  • Previous by thread: Re: Casting from NSArray to a custom class
  • Next by thread: Re: Casting from NSArray to a custom class
  • Index(es):
    • Date
    • Thread