home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWODMisc / Include / FWSUSink.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  3.0 KB  |  95 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWSUSink.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSUSINK_H
  11. #define FWSUSINK_H
  12.  
  13. #include "SLSUSink.xh"
  14.  
  15. #ifndef FWRANSIN_H
  16. #include "FWRanSin.h"
  17. #endif
  18.  
  19. //========================================================================================
  20. //    CLASS FW_PStorageUnitSink
  21. //    Smart pointer for FW_OStorageUnitSink
  22. //
  23. //        Inherited API for operator->()
  24. //            long GetReadableBytes();
  25. //            void Read(in void * destination, in long count);
  26. //            long GetWritableBytes();
  27. //            void Write(in void* source, in long count);
  28. //
  29. //            long GetLength();
  30. //            void SetLength(in long length);
  31. //            long GetPosition();
  32. //            void SetPosition(in long position);
  33. //
  34. //        New API for operator->()
  35. //            ODStorageUnitView GetStorageUnitView();
  36. //
  37. //========================================================================================
  38.  
  39. class FW_PStorageUnitSink : public FW_PRandomAccessSink
  40. {
  41. public:
  42.     FW_PStorageUnitSink(Environment* ev, FW_OStorageUnitSink* theStorageUnitSink);
  43.         // The sink assumes ownership of theStorageUnitSink
  44.  
  45.     FW_PStorageUnitSink(Environment* ev, ODStorageUnitView* storageUnitView);
  46.         // Create a sink attached to the storage unit view.
  47.         // The sink does not assume ownership of the view.
  48.          
  49.     FW_PStorageUnitSink(Environment* ev, 
  50.                         ODStorageUnit* storageUnit, 
  51.                         ODPropertyName propertyName, 
  52.                         ODValueType valueType);
  53.         // Create a sink attached to the given (storageUnit, propertyName, valueType).
  54.         // The "bufferCapacity" is for buffering reads from the storage unit
  55.  
  56.     virtual ~FW_PStorageUnitSink();
  57.  
  58.     operator FW_OStorageUnitSink*() const;
  59.     FW_OStorageUnitSink* operator->() const;
  60.  
  61.     FW_OStorageUnitSink* GetStorageUnitSink() const;
  62.  
  63. private:
  64.     FW_PStorageUnitSink(const FW_PStorageUnitSink&);
  65.     FW_PStorageUnitSink& operator=(const FW_PStorageUnitSink&);
  66. };
  67.  
  68.  
  69. //----------------------------------------------------------------------------------------
  70. //    FW_PStorageUnitSink::operator FW_OStorageUnitSink*
  71. //----------------------------------------------------------------------------------------
  72. inline FW_PStorageUnitSink::operator FW_OStorageUnitSink*() const
  73. {
  74.     return (FW_OStorageUnitSink*)GetRep();
  75. }
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    FW_PStorageUnitSink::operator->
  79. //----------------------------------------------------------------------------------------
  80. inline FW_OStorageUnitSink* FW_PStorageUnitSink::operator->() const
  81. {
  82.     return (FW_OStorageUnitSink*)GetRep();
  83. }
  84.  
  85. //----------------------------------------------------------------------------------------
  86. //    FW_PStorageUnitSink::GetStorageUnitSink
  87. //----------------------------------------------------------------------------------------
  88. inline FW_OStorageUnitSink* FW_PStorageUnitSink::GetStorageUnitSink() const
  89. {
  90.     return (FW_OStorageUnitSink*)GetRep();
  91. }
  92.  
  93.  
  94. #endif
  95.