home *** CD-ROM | disk | FTP | other *** search
- /*
- ** containers.h
- ** Database Kit, Release 3.0
- ** Copyright (c) 1992, NeXT Computer, Inc. All rights reserved.
- */
-
- #import <objc/Object.h>
-
- @class DBBinder;
-
- /*
- ** This is the protocol used by the binder to maintain a container object.
- ** Flushing the binder will cause an empty, and potentially a freeObjects
- ** (depending on the state of the options flags). Before any "outgoing"
- ** operation (insert, update, or delete) the container is given the
- ** opportunity to prepare its objects. The binder then iterates
- ** on the contents of the container, and after it has finished, calls
- ** either reject or accept for the objects.
- **
- ** Data that is incoming from the database will have addObject:fromBinder:
- ** called for each object.
- */
- @protocol DBContainers
-
- - freeObjects;
- - empty;
- - (unsigned)count;
-
- /*
- ** This is called when a binder adds objects to the container.
- */
- - addObject:anObject forBinder:(DBBinder*)aBinder;
-
- /*
- ** These are called when the container is expected to provide objects to
- ** a binder. prepareForBinder should return the number of objects
- ** that are ready to submit, while objectAt:forBinder: returns the
- ** object at the indexed position.
- */
- - (unsigned)prepareForBinder:(DBBinder*)aBinder;
- - objectAt:(unsigned)index forBinder:(DBBinder*)aBinder;
-
- @end
-
- @interface Object (DBContainers)
-
- /*
- ** The container can optionally implement these methods, which are called
- ** after objects from the container have been submitted to the database.
- **
- ** If the object is accepted, didAcceptObject: is called, otherwise,
- ** didRejectObject is called. These methods should not change the structure
- ** of the container, since they are called DURING the transaction.
- */
- - binder:(DBBinder*)aBinder didAcceptObject:anObject;
- - binder:(DBBinder*)aBinder didRejectObject:anObject;
-
- @end
-