Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

DBFormatConversion
(informal protocol)


Category Of: Object
Declared In: dbkit/customType.h



Category Description

This category is the companion of the category DBFormatInitialization.  The two provide part of the mechanism the Database Kit uses to transfer Objective C objects between the database and the application.  DBFormatConversion provides a method that specifies the format of the data contained in a buffer that the adaptor will use while transferring data from the application to the database.  You'll need explicit use of these methods only if your application uses formats other than those already supported in the Database Kit.  (The kit supports any object in the archive format appropriate to its class, as well as NXData using RTF format, or NXImage using TIFF or EPS format.)



Instance Methods

writeBuffer:ofLength:usingFormat:
writeBuffer:(void **)bufferPtr
ofLength:(unsigned *)lengthPtr
usingFormat:(const char *)aFormatName;

If  your application creates a custom class that's associated with a property and your class implements this method, this method will be invoked automatically when the Database Kit tries to store the object into the database.

The pointer *bufferPtr may point either to an existing buffer or to NULL.  If it points to an existing buffer, *lengthPtr points to the buffer's length.  But if *bufferPtr points to NULL, the method should allocate space for a new buffer as needed, and should write the length it allocates into the location that *lengthPtr points to.

The argument aFormatName is a string containing the name of the format in which the data is written.  The Database Kit defines the following names for formats:

"EPS"
"RTF"
"TIFF"

Alternatively, the string may be the name of any type your application recognizes, as declared in DBModeler's Attribute Inspector for data of type Object.