Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSValue data size programmatically?

NSValue data size programmatically?
Thread Tools
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Monopoli, Bary, ITALY
Status: Offline
Reply With Quote
Nov 13, 2002, 02:31 AM
 
This is an example:

NSValue* value;
unsigned size;
void* buffer;

// ...
value = [anObject aValue];
// ...

// I don't know the type and the size
// of the data that
// NSValue store at this time

// the next method getValueSize
// don't exist
// ??? size = [value getValueSize]; ???
buffer = malloc( size );
[value getValue:buffer];

// I don't want to pass NSValue directly
// here ...
doSomeThingsWithThisPointer( buffer );

free( buffer );

// ...

How I can obtain programmatically the size of the data stored in a NSValue object?

Sorry for my buggy english
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Nov 13, 2002, 11:31 AM
 
Off the top of my head:
Code:
unsigned size; char *type = [value objCType]; NSGetSizeAndAlignment(type, &size, NULL);
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
antofic  (op)
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Monopoli, Bary, ITALY
Status: Offline
Reply With Quote
Nov 14, 2002, 01:54 AM
 
Thanks
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2