ftp.nice.ch/pub/next/developer/objc/dbkit/DBTVTest.s.tar.gz#/DBTVTest/Tester.m

This is Tester.m in view mode; [Download] [Up]

#import "Tester.h"

@implementation Tester

- appDidInit:sender
{
	SimpleProperty *prop;
	
	
	prop = [[SimpleProperty alloc] init];
	[prop setName:"column0"];
	[[DBTV columnAt:0] setIdentifier:prop];
	
	prop = [[SimpleProperty alloc] init];
	[prop setName:"column1"];
	[[DBTV columnAt:1] setIdentifier:prop];

	[DBTV setDataSource:self];

    return self;
}

- (unsigned int)rowCount
{
#ifdef FULLDEBUG
	printf("-rowCount\n");
#endif /* FULLDEBUG */

	return 10;
}

- (unsigned int)columnCount
{
#ifdef FULLDEBUG
	printf("-columnCount\n");
#endif /* FULLDEBUG */

	return 2;
}

- getValueFor:rowIdentifier :columnIdentifier into:aValue
{
#ifdef FULLDEBUG
	printf("-getValueFor:rowIdentifier :columnIdentifier into:aValue\n");
	printf("\trowIdentifier name is '%s'\n", [rowIdentifier name]);
	printf("\tcolumnIdentifier name is '%s'\n", [columnIdentifier name]);
#endif /* FULLDEBUG */
	
	[aValue setStringValue:"Testing"];
	return self;
}

- getValueFor:identifier at:(unsigned int)aPosition into:aValue
{
	char buf[100];
	
#ifdef FULLDEBUG
	printf("-getValueFor:identifier at:%u into:aValue\n", aPosition);
	printf("\tidentifier name is '%s'\n", [identifier name]);
#endif /* FULLDEBUG */

	sprintf(buf, "Testing %s:row%u", [identifier name], aPosition);
	[aValue setStringValue:buf];
	return self;
}

- setValueFor:rowIdentifier :columnIdentifier from:aValue
{
#ifdef FULLDEBUG
	printf("-setValueFor:rowIdentifier :columnIdentifier from:aValue\n");
	printf("\trowIdentifier name is '%s'\n", [rowIdentifier name]);
	printf("\tcolumnIdentifier name is '%s'\n", [columnIdentifier name]);
#endif /* FULLDEBUG */
	
	return self;
}

- setValueFor:identifier at:(unsigned int)aPosition from:aValue
{
#ifdef FULLDEBUG
	printf("-setValueFor:identifier at:%u from:aValue\n", aPosition);
	printf("\tidentifier name is '%s'\n", [identifier name]);
#endif /* FULLDEBUG */

	return self;
}


@end

@implementation SimpleProperty

- init
{
	[super init];
	myName = NULL;
	return self;
}

- (const char *)name
{
	return myName;
}

- (BOOL)setName:(const char *)aName
{
	if (myName) free(myName);
	if (aName)  {
		myName = (char *)malloc(strlen(aName)+1);
		strcpy(myName, aName);
	}  else  {
		myName = NULL;
	}
	return YES;
}

- (id <DBEntities>)entity  { return nil; }

- (BOOL)isKey  { return NO; }
- (BOOL)isReadOnly  { return NO; }
- (BOOL)isSingular  {return YES; }

- (BOOL)matchesProperty:(id <DBProperties>)aProperty
{
	if (self==aProperty)  return YES;
	if (strcmp([self name], [aProperty name])==0)  return YES;
	return NO;
}

- (id <DBTypes>)propertyType  { return nil; }

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.