Added a few specialised coding methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18465 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-01-24 06:39:21 +00:00
parent 62324f232d
commit 7afadeeebb
3 changed files with 55 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2004-01-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyedArchiver.m:
* Source/NSKeyedUnarchiver.m:
Added NSPoint, NSRect, and NSSize coding methods.
2004-01-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSocketPort.m:

View file

@ -523,6 +523,26 @@ static NSMapTable *globalClassMap = 0;
[self _encodeObject: anObject forKey: aKey conditional: NO];
}
- (void) encodePoint: (NSPoint)p
{
[self encodeValueOfObjCType: @encode(float) at: &p.x];
[self encodeValueOfObjCType: @encode(float) at: &p.y];
}
- (void) encodeRect: (NSRect)r
{
[self encodeValueOfObjCType: @encode(float) at: &r.origin.x];
[self encodeValueOfObjCType: @encode(float) at: &r.origin.y];
[self encodeValueOfObjCType: @encode(float) at: &r.size.width];
[self encodeValueOfObjCType: @encode(float) at: &r.size.height];
}
- (void) encodeSize: (NSSize)s
{
[self encodeValueOfObjCType: @encode(float) at: &s.width];
[self encodeValueOfObjCType: @encode(float) at: &s.height];
}
- (void) encodeValueOfObjCType: (const char*)type
at: (const void*)address
{

View file

@ -508,6 +508,35 @@ static NSMapTable globalClassMap = 0;
return nil;
}
- (NSPoint) decodePoint
{
NSPoint p;
[self decodeValueOfObjCType: @encode(float) at: &p.x];
[self decodeValueOfObjCType: @encode(float) at: &p.y];
return p;
}
- (NSRect) decodeRect
{
NSRect r;
[self decodeValueOfObjCType: @encode(float) at: &r.origin.x];
[self decodeValueOfObjCType: @encode(float) at: &r.origin.y];
[self decodeValueOfObjCType: @encode(float) at: &r.size.width];
[self decodeValueOfObjCType: @encode(float) at: &r.size.height];
return r;
}
- (NSSize) decodeSize
{
NSSize s;
[self decodeValueOfObjCType: @encode(float) at: &s.width];
[self decodeValueOfObjCType: @encode(float) at: &s.height];
return s;
}
- (id) delegate
{
return _delegate;