mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
Add keyed coding. This is still rather useless until we get a proper
implementation for -serializedRepresentation. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33294 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
61b0a0ae7b
commit
f29c54e66f
2 changed files with 65 additions and 46 deletions
|
@ -1,3 +1,7 @@
|
|||
2011-06-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSFileWrapper.m: Add keyed coding.
|
||||
|
||||
2011-06-13 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSBitmapImageRep.m: Reduce floating-point error in the
|
||||
|
|
|
@ -578,6 +578,12 @@
|
|||
//
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: [self serializedRepresentation] forKey: @"NSFileWrapperData"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_wrapperType];
|
||||
// Dont store the file name
|
||||
|
@ -586,8 +592,16 @@
|
|||
[aCoder encodeObject: _wrapperData];
|
||||
[aCoder encodeObject: _iconImage];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSData *data = [aDecoder decodeObjectForKey: @"NSFileWrapperData"];
|
||||
return [self initWithSerializedRepresentation: data];
|
||||
}
|
||||
else
|
||||
{
|
||||
int wrapperType;
|
||||
NSString *preferredFilename;
|
||||
|
@ -633,6 +647,7 @@
|
|||
{
|
||||
[self setIcon: iconImage];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue