This is RZRefCountedList.m in view mode; [Download] [Up]
/*
* RZRefCountedList - a List that implements reference counting
*
* You may freely copy, distribute and reuse the code in this example.
* This code is provided AS IS without warranty of any kind, expressed
* or implied, as to its fitness for any particular use.
*
* Copyright 1995 Ralph Zazula (rzazula@next.com). All Rights Reserved.
*
*/
#import "RZRefCountedList.h"
@implementation RZRefCountedList
- init
{
if(self = [super init]) {
refs = 1;
}
return self;
}
- addReference
{
refs++;
return self;
}
- free
{
refs--;
if (refs > 0) return self;
return [super free];
}
- (unsigned int)references
{
return refs;
}
- freeObjects
{
if(refs == 1) {
return [super freeObjects];
}
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.