ftp.nice.ch/pub/next/games/card/Solitaire.2.1.s.tar.gz#/Solitaire.2.1.s/Solitaire/CardSet.subproj/Pasteboard-CardSet.m

This is Pasteboard-CardSet.m in view mode; [Download] [Up]

/* indent:4  tabsize:8  font:fixed-width */


#import "Pasteboard-CardSet.h"


@implementation Pasteboard(CardSet)

/*---------------------------------------------------------------------------
|
|    - writeType:(const char *)dataType asObject:(id)anObject
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Perform gyrations necessary to archive an object to a stream and write 
|    the stream to the pasteboard
|
\----------------------------------------------------------------------------*/

- writeType:(const char *)dataType asObject:(id)anObject
{
    char *data;
    int length;

    data = NXWriteRootObjectToBuffer(anObject, &length);
    [self writeType:dataType data:data length:length];
    NXFreeObjectBuffer(data, length);
    return self;
}


/*---------------------------------------------------------------------------
|
|    - writeType:(const char *) dataType asObject:(id) anObject
|
|    returns: (id) self
|
|----------------------------------------------------------------------------
|
|    Perform gyrations necessary to convert a pasteboard data type into a 
|    stream and dearchive an object from it
|
\----------------------------------------------------------------------------*/

- readType:(const char *)dataType asObject:(id *)anObjectPtr
{
    char *data;
    int length;

    [self readType:dataType data:&data length:&length];
    *anObjectPtr = NXReadObjectFromBuffer(data, length);
    vm_deallocate(task_self(), (vm_address_t)data, length);
    return self;
}

@end

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