home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.1 KB | 129 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWFileAc.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWFILEAC_H
- #define FWFILEAC_H
-
- #ifndef FWEXCDEF_H
- #include "FWExcDef.h"
- #endif
-
- #ifndef FWASINKS_H
- #include "FWASinks.h"
- #endif
-
- #ifndef FWFILESY_H
- #include "FWFileSy.h"
- #endif
-
- #ifndef FWFILESP_H
- #include "FWFileSp.h"
- #endif
-
- #ifndef FWACCBUF_H
- #include "FWAccBuf.h"
- #endif
-
- #ifndef FWFILREP_H
- #include "FWFilRep.h"
- #endif
-
- #if defined(FW_BUILD_WIN) && !defined(__WINDOWS_H)
- #include <windows.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // CLASS FW_CFileSink
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CFileSink : public FW_CRandomAccessSink
- {
- public:
-
- FW_CFileSink(FW_PFile rep);
-
- virtual ~ FW_CFileSink();
-
-
- //===========================================================
- // Read/Write
- //===========================================================
-
- virtual void Read(void * destination, long count);
- // Read 'count' bytes from current position to 'destination' and
- // increment current position by 'count'.
-
- virtual long GetWritableBytes() const;
- // Return number of bytes that may be written to this sink.
-
- virtual void Write(const void* source, long count);
- // Write 'count' bytes from 'source' to current file position.
-
- //===========================================================
- // File Positioning
- //===========================================================
-
- virtual long GetLength() const;
- // Return the logical size of the file.
-
- virtual void SetLength(long length);
- // Set the logical size of the file.
-
- virtual long GetPosition() const;
- // Return current file position.
-
- virtual void SetPosition(long length);
- // Set current file position.
-
- //===========================================================
- // Sink "peek" optimization
- //===========================================================
-
- virtual const void* ReadPeek(long& availableReadBytes);
- // Return read-only pointer to 'availableReadBytes' bytes of data
- // at current file position.
-
- virtual void ReadPeekAdvance(long bytesRead);
- // Advance position in ReadPeek() buffer by 'bytesRead' bytes.
-
- virtual void* WritePeek(long& availableWriteBytes);
- // Return write-only pointer to 'availableWriteBytes' bytes of data
- // at current file position.
-
- virtual void WritePeekAdvance(long bytesWritten);
- // Advance position in WritePeek() buffer by 'bytesWritten' bytes.
-
-
- public:
-
- FW_PFile GetFile();
- // Return the underlying FW_PFile representation object
-
- private:
-
- FW_CFileSink(const FW_CFileSink& other);
- // Copy constructor.
-
- FW_CFileSink& operator=(const FW_CFileSink& theOtherFile);
- // Assignment operator.
-
-
- FW_PFile fRep;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-