home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWFiles / Include / FWFileAc.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.1 KB  |  129 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWFileAc.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWFILEAC_H
  11. #define FWFILEAC_H
  12.  
  13. #ifndef FWEXCDEF_H
  14. #include "FWExcDef.h"
  15. #endif
  16.  
  17. #ifndef FWASINKS_H
  18. #include "FWASinks.h"
  19. #endif
  20.  
  21. #ifndef FWFILESY_H
  22. #include "FWFileSy.h"
  23. #endif
  24.  
  25. #ifndef FWFILESP_H
  26. #include "FWFileSp.h"
  27. #endif
  28.  
  29. #ifndef FWACCBUF_H
  30. #include "FWAccBuf.h"
  31. #endif
  32.  
  33. #ifndef FWFILREP_H
  34. #include "FWFilRep.h"
  35. #endif
  36.  
  37. #if defined(FW_BUILD_WIN) && !defined(__WINDOWS_H)
  38. #include <windows.h>
  39. #endif
  40.  
  41. #if FW_LIB_EXPORT_PRAGMAS
  42. #pragma lib_export on
  43. #endif
  44.  
  45. //========================================================================================
  46. //    CLASS FW_CFileSink
  47. //========================================================================================
  48.  
  49. class FW_CLASS_ATTR FW_CFileSink : public FW_CRandomAccessSink
  50. {
  51. public:
  52.  
  53.     FW_CFileSink(FW_PFile rep);
  54.         
  55.     virtual ~ FW_CFileSink();
  56.  
  57.  
  58.     //===========================================================
  59.     // Read/Write
  60.     //===========================================================
  61.  
  62.     virtual void Read(void * destination, long count);
  63.         // Read 'count' bytes from current position to 'destination' and 
  64.         // increment current position by 'count'.
  65.         
  66.     virtual long GetWritableBytes() const;
  67.         // Return number of bytes that may be written to this sink.
  68.         
  69.     virtual void Write(const void* source, long count);
  70.         // Write 'count' bytes from 'source' to current file position.
  71.         
  72.     //===========================================================
  73.     // File Positioning
  74.     //===========================================================
  75.  
  76.     virtual long GetLength() const;
  77.         // Return the logical size of the file.
  78.                                     
  79.     virtual void SetLength(long length);
  80.         // Set the logical size of the file.
  81.  
  82.     virtual long GetPosition() const;
  83.         // Return current file position.
  84.         
  85.     virtual void SetPosition(long length);
  86.         // Set current file position.
  87.  
  88.     //===========================================================
  89.     // Sink "peek" optimization
  90.     //===========================================================
  91.  
  92.     virtual const void* ReadPeek(long& availableReadBytes);
  93.         // Return read-only pointer to 'availableReadBytes' bytes of data
  94.         // at current file position.
  95.         
  96.     virtual void ReadPeekAdvance(long bytesRead);
  97.         // Advance position in ReadPeek() buffer by 'bytesRead' bytes.
  98.     
  99.     virtual void* WritePeek(long& availableWriteBytes);
  100.         // Return write-only pointer to 'availableWriteBytes' bytes of data
  101.         // at current file position. 
  102.         
  103.     virtual void WritePeekAdvance(long bytesWritten);
  104.         // Advance position in WritePeek() buffer by 'bytesWritten' bytes.
  105.     
  106.     
  107. public:
  108.  
  109.     FW_PFile    GetFile();
  110.         // Return the underlying FW_PFile representation object
  111.         
  112. private:
  113.  
  114.     FW_CFileSink(const FW_CFileSink& other);
  115.         // Copy constructor.
  116.  
  117.     FW_CFileSink& operator=(const FW_CFileSink& theOtherFile);
  118.         // Assignment operator.
  119.  
  120.  
  121.     FW_PFile fRep;
  122. };
  123.  
  124. #if FW_LIB_EXPORT_PRAGMAS
  125. #pragma lib_export off
  126. #endif
  127.  
  128. #endif
  129.