home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / dbkit / containers.h next >
Text File  |  1992-03-27  |  2KB  |  59 lines

  1. /*
  2. **      containers.h
  3. **      Database Kit$    slease 3.0
  4. **      Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import <objc/Object.h>
  8.  
  9. @class DBBinder;
  10.  
  11. /*
  12. ** This is the protocol used by the binder to maintain a container object.
  13. **  Flushing the binder will cause an empty, and potentially a freeObjects
  14. **  (depending on the state of the options flags).  Before any "outgoing"
  15. **  operation (insert, update, or delete) the container is given the
  16. **  opportunity to prepare its objects.  The binder then iterates
  17. **  on the contents of the container, and after it has finished, calls
  18. **  either reject or accept for the objects.
  19. **
  20. ** Data that is incoming from the database will have addObject:fromBinder:
  21. **  called for each object.
  22. */
  23. @protocol DBContainers
  24.  
  25. - freeObjects;
  26. - empty;
  27. - (unsigned)count;
  28.  
  29. /*
  30. ** This is called when a binder adds objects to the container.
  31. */
  32. - addObject:anObject forBinder:(DBBinder*)aBinder;
  33.  
  34. /*
  35. ** These are called when the container is expected to provide objects to
  36. **  a binder.  prepareForBinder should return the number of objects
  37. **  that are ready to submit, while objectAt:forBinder: returns the
  38. **  object at the indexed position.
  39. */
  40. - (unsigned)prepareForBinder:(DBBinder*)aBinder;
  41. - objectAt:(unsigned)index forBinder:(DBBinder*)aBinder;
  42.  
  43. @end
  44.  
  45. @interface Object (DBContainers)
  46.  
  47. /*
  48. ** The container can optionally implement these methods, which are called
  49. **  after objects from the container have been submitted to the database.
  50. **
  51. ** If the object is accepted, didAcceptObject: is called, otherwise, 
  52. **  didRejectObject is called.  These methods should not change the structure
  53. **  of the container, since they are called DURING the transaction.
  54. */
  55. - binder:(DBBinder*)aBinder didAcceptObject:anObject;
  56. - binder:(DBBinder*)aBinder didRejectObject:anObject;
  57.  
  58. @end
  59.