libs-base/Source/NSNumberMethods.h
David Chisnall ec239ebfaf Simplify the KVC getter code and make it return structs boxed in NSValues
(Apple-compatible).  This is currently slow, because we go via NSInvocation.
We could probably make it faster, but I am not inclined to optimise for
something that I sincerely hope is a very unusual use case.

Richard: Please check I haven't done something silly here...



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31411 72102866-910b-0410-8b05-ffd578937521
2010-09-24 19:20:16 +00:00

25 lines
502 B
C

#define INTEGER_MACRO(encoding, type, name, ignored) \
- (type) name ## Value\
{\
return (type)VALUE;\
}
#include "GSNumberTypes.h"
- (BOOL) boolValue
{
return (VALUE == 0) ? NO : YES;
}
- (const char *) objCType
{
return @encode(typeof(VALUE));
}
- (NSString*) descriptionWithLocale: (id)aLocale
{
return [[[NSString alloc] initWithFormat: FORMAT
locale: aLocale, VALUE] autorelease];
}
- (void) getValue: (void*)buffer
{
typeof(VALUE) *ptr = buffer;
*ptr = VALUE;
}
#undef FORMAT