home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWFiles / FWFileAc.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  2.3 KB  |  82 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWFileAc.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWFILEAC_H
  11. #define FWFILEAC_H
  12.  
  13. #ifndef FWRANSIN_H
  14. #include "FWRanSin.h"
  15. #endif
  16.  
  17. #include "SLFileAc.xh"
  18.  
  19. //========================================================================================
  20. //    CLASS FW_PFileSink
  21. //
  22. //        Inherited API for operator->()
  23. //            long GetReadableBytes();
  24. //            void Read(in void * destination, in long count);
  25. //            long GetWritableBytes();
  26. //            void Write(in void* source, in long count);
  27. //
  28. //            long GetLength();
  29. //            void SetLength(in long length);
  30. //            long GetPosition();
  31. //            void SetPosition(in long position);
  32. //
  33. //        New API for operator->()
  34. //            FW_OFile GetOFileRep();
  35. //
  36. //========================================================================================
  37.  
  38. class FW_PFileSink : public FW_PRandomAccessSink
  39. {
  40. public:
  41.     FW_PFileSink(Environment* ev, FW_OFileSink* theFileSink);
  42.     FW_PFileSink(Environment* ev, FW_OFile* theFile);
  43.  
  44.     virtual ~FW_PFileSink();
  45.  
  46. public:
  47.     // Covariant overrides
  48.     FW_OFileSink*     GetRep()        const;
  49.     FW_OFileSink*     operator->()    const;
  50.     operator         FW_OFileSink*()    const;
  51.  
  52. private:
  53.     FW_PFileSink(const FW_PFileSink&);
  54.     FW_PFileSink& operator=(const FW_PFileSink&);
  55. };
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    FW_PFileSink::GetRep
  59. //----------------------------------------------------------------------------------------
  60. inline FW_OFileSink* FW_PFileSink::GetRep() const
  61. {
  62.     return (FW_OFileSink*)FW_PRandomAccessSink::GetRep();
  63. }
  64.  
  65. //----------------------------------------------------------------------------------------
  66. //    FW_PFileSink::operator->
  67. //----------------------------------------------------------------------------------------
  68. inline FW_OFileSink* FW_PFileSink::operator->() const
  69. {
  70.     return GetRep();
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. //    FW_PFileSink::operator FW_OFileSink*
  75. //----------------------------------------------------------------------------------------
  76. inline FW_PFileSink::operator FW_OFileSink*() const
  77. {
  78.     return GetRep();
  79. }
  80.  
  81. #endif
  82.