This is Cookie.m in view mode; [Download] [Up]
/* Generated by Interface Builder */
#import "Cookie.h"
#import <c.h>
BOOL hasTitle(char *line)
{
int count;
for(count = 0; line[count]; count++)
if(line[count] == '%')
return TRUE;
return FALSE;
}
@implementation Cookie
- (BOOL)blank
{
if(!cookieLines)
return TRUE;
if([((List *)cookieLines) count] == 0)
return TRUE;
if(([((List *)cookieLines) count] == 1) && (!([[cookieLines objectAt:0] string][0])))
return TRUE;
return FALSE;
}
- (char *)title
{
return [title string];
}
- (List *)cookieLines
{
return cookieLines;
}
- setLines :(List *)list
{
if(cookieLines)
[cookieLines free];
cookieLines = [list copy];
return self;
}
- setTitle :(char *)string
{
if(!title)
title = [[String alloc] init];
[title setString:string];
return self;
}
- init
{
[super init];
title = NULL;
cookieLines = NULL;
return self;
}
- (void)free
{
[cookieLines freeObjects];
[title free];
[super free];
}
- addLine :(char *)line
{
int count = 0;
if((!title) && (hasTitle(line)))
{
char temp[1024];
for(count = 0; line[count] != '%' && line[count]; count++)
temp[count] = line[count];
temp[count] = 0;
count++;
if(!title)
title = [[String alloc] init];
[title setString:temp];
}
if(!cookieLines)
cookieLines = [[List alloc] init];
[cookieLines addObject:[[[String alloc] init] setString:&line[count]]];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.