mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Add description methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2408 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
df050acf75
commit
0bcb15c30f
4 changed files with 39 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
Tue Aug 26 15:47:54 1997 Adam Fedor <fedor@doc.com>
|
||||
|
||||
* src/NSCTemplateValue.m ([NSCTemplateValue -description]): New
|
||||
method.
|
||||
* src/NSConcreteValue.m ([NSConcreteValue -description]):
|
||||
Likewise.
|
||||
* src/NSNumber.m ([NSNumber -description]): use -stringValue.
|
||||
|
||||
Fri Aug 29 13:25:51 1997 Adam Fedor <fedor@doc.com>
|
||||
|
||||
* src/Makefile.in: Add LIBS macro.
|
||||
|
|
|
@ -86,7 +86,25 @@
|
|||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
#if TYPE_ORDER == 0
|
||||
return [NSString stringWithFormat: @"{object = %@}", [data description]];
|
||||
#elif TYPE_ORDER == 1
|
||||
return [NSString stringWithFormat: @"{x = %g; y = %g}", data.x, data.y];
|
||||
#elif TYPE_ORDER == 2
|
||||
return [NSString stringWithFormat: @"{pointer = %p}", data];
|
||||
#elif TYPE_ORDER == 3
|
||||
return [NSString stringWithFormat:
|
||||
@"{x = %g; y = %g; width = %g; height = %g}", NSMinX(data), NSMinY(data),
|
||||
NSWidth(data), NSHeight(data)];
|
||||
#elif TYPE_ORDER == 4
|
||||
return [NSString stringWithFormat: @"{width = %g; height = %g}",
|
||||
data.width, data.height];
|
||||
#endif
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <Foundation/NSConcreteValue.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSZone.h>
|
||||
|
@ -138,6 +139,16 @@
|
|||
return *((NSPoint *)data);
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
int size;
|
||||
NSData *rep;
|
||||
|
||||
size = objc_sizeof_type([objctype cString]);
|
||||
rep = [NSData dataWithBytes: data length: size];
|
||||
return [NSString stringWithFormat: @"(%@) %@", objctype, [rep description]];
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
|
|
|
@ -271,8 +271,7 @@
|
|||
|
||||
- description
|
||||
{
|
||||
/* xxx This could be better integrated into concrete subclasses. */
|
||||
return [NSString stringWithFormat: @"%d", [self intValue]];
|
||||
return [self stringValue];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue