Use <Encoding> and <Decoding> protocols in argument types.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@786 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-01-24 03:16:05 +00:00
parent f13e22a000
commit fae6d412cc
4 changed files with 23 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/* Implementation for Objective-C Array collection object
Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
Date: May 1993
@ -23,6 +23,7 @@
#include <objects/Array.h>
#include <objects/ArrayPrivate.h>
#include <objects/NSString.h>
@implementation Array
@ -62,23 +63,23 @@
/* Archiving must mimic the above designated initializer */
- (void) _encodeCollectionWithCoder: (Coder*)coder
- (void) _encodeCollectionWithCoder: (id <Encoding>)coder
{
const char *encoding = [self contentType];
[super _encodeCollectionWithCoder:coder];
[coder encodeValueOfCType:@encode(char*)
at:&encoding
withName:"Array Encoding Type"];
withName:@"Array Encoding Type"];
[coder encodeValueOfCType:@encode(unsigned)
at:&_grow_factor
withName:"Array Grow Factor"];
withName:@"Array Grow Factor"];
[coder encodeValueOfCType:@encode(unsigned)
at:&_capacity
withName:"Array Capacity"];
withName:@"Array Capacity"];
}
- _initCollectionWithCoder: (Coder*)coder
- _initCollectionWithCoder: (id <Decoding>)coder
{
char *encoding;
[super _initCollectionWithCoder:coder];

View file

@ -1,5 +1,5 @@
/* Implementation for Objective-C BinaryTree collection object
Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
Date: May 1993
@ -66,14 +66,14 @@ static id nilBinaryTreeNode;
return self;
}
- (void) _encodeContentsWithCoder: (Coder*)aCoder
- (void) _encodeContentsWithCoder: (id <Encoding>)aCoder
{
[aCoder startEncodingInterconnectedObjects];
[super _encodeContentsWithCoder:aCoder];
[aCoder finishEncodingInterconnectedObjects];
}
- (void) _decodeContentsWithCoder: (Coder*)aCoder
- (void) _decodeContentsWithCoder: (id <Decoding>)aCoder
{
[aCoder startDecodingInterconnectedObjects];
[super _decodeContentsWithCoder:aCoder];

View file

@ -1,5 +1,5 @@
/* Implementation for Objective-C IndexedCollection object
Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
Date: May 1993
@ -25,6 +25,7 @@
#include <objects/IndexedCollectionPrivate.h>
#include <stdio.h>
#include <objects/Array.h>
#include <objects/NSString.h>
@implementation IndexedCollection
@ -1058,7 +1059,7 @@
return self;
}
- (void) _encodeContentsWithCoder: (Coder*)coder
- (void) _encodeContentsWithCoder: (id <Encoding>)coder
{
unsigned int count = [self count];
const char *encoding = [self contentType];
@ -1066,16 +1067,16 @@
{
[coder encodeValueOfObjCType:encoding
at:elt_get_ptr_to_member(encoding, &e)
withName:"IndexedCollection Element"];
withName:@"IndexedCollection Element"];
}
[coder encodeValueOfCType:@encode(unsigned int)
at:&count
withName:"IndexedCollection Contents Count"];
withName:@"IndexedCollection Contents Count"];
[self withElementsCall:archiveElement];
}
- (void) _decodeContentsWithCoder: (Coder*)coder
- (void) _decodeContentsWithCoder: (id <Decoding>)coder
{
unsigned int count, i;
elt newElement;

View file

@ -1,5 +1,5 @@
/* Implementation for Objective-C KeyedCollection collection object
Copyright (C) 1993,1994 Free Software Foundation, Inc.
Copyright (C) 1993,1994, 1996 Free Software Foundation, Inc.
Written by: R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
Date: May 1993
@ -25,6 +25,7 @@
#include <objects/CollectionPrivate.h>
#include <stdio.h>
#include <objects/Array.h>
#include <objects/NSString.h>
@implementation KeyedCollection
@ -458,7 +459,7 @@
return self;
}
- (void) _encodeContentsWithCoder: (Coder*)aCoder
- (void) _encodeContentsWithCoder: (id <Encoding>)aCoder
{
unsigned int count = [self count];
const char *ce = [self contentType];
@ -467,19 +468,19 @@
{
[aCoder encodeValueOfObjCType:ke
at:elt_get_ptr_to_member(ke, &key)
withName:"KeyedCollection key element"];
withName:@"KeyedCollection key element"];
[aCoder encodeValueOfObjCType:ce
at:elt_get_ptr_to_member(ce, &content)
withName:"KeyedCollection content element"];
withName:@"KeyedCollection content element"];
}
[aCoder encodeValueOfCType:@encode(unsigned)
at:&count
withName:"Collection element count"];
withName:@"Collection element count"];
[self withKeyElementsAndContentElementsCall:archiveKeyAndContent];
}
- (void) _decodeContentsWithCoder: (Coder*)aCoder
- (void) _decodeContentsWithCoder: (id <Decoding>)aCoder
{
unsigned int count, i;
elt newKey, newContent;