libpgf  6.11.42
PGF - Progressive Graphics File
CPGFFileStream Class Reference

File stream class. More...

#include <PGFstream.h>

Inheritance diagram for CPGFFileStream:
CPGFStream

List of all members.

Public Member Functions

 CPGFFileStream ()
 CPGFFileStream (HANDLE hFile)
HANDLE GetHandle ()
virtual ~CPGFFileStream ()
virtual void Write (int *count, void *buffer) THROW_
virtual void Read (int *count, void *buffer) THROW_
virtual void SetPos (short posMode, INT64 posOff) THROW_
virtual UINT64 GetPos () const THROW_
virtual bool IsValid () const

Protected Attributes

HANDLE m_hFile
 file handle

Detailed Description

File stream class.

A PGF stream subclass for external storage files.

Author:
C. Stamm

Definition at line 82 of file PGFstream.h.


Constructor & Destructor Documentation

Definition at line 87 of file PGFstream.h.

: m_hFile(0) {}
CPGFFileStream::CPGFFileStream ( HANDLE  hFile) [inline]

Constructor

Parameters:
hFileFile handle

Definition at line 90 of file PGFstream.h.

: m_hFile(hFile) {}
virtual CPGFFileStream::~CPGFFileStream ( ) [inline, virtual]

Definition at line 94 of file PGFstream.h.

{ m_hFile = 0; }

Member Function Documentation

HANDLE CPGFFileStream::GetHandle ( ) [inline]
Returns:
File handle

Definition at line 92 of file PGFstream.h.

{ return m_hFile; }
UINT64 CPGFFileStream::GetPos ( ) const [virtual]

Get current stream position.

Returns:
Current stream position

Implements CPGFStream.

Definition at line 64 of file PGFstream.cpp.

                                           {
        ASSERT(IsValid());
        OSError err;
        UINT64 pos = 0;
        if ((err = GetFPos(m_hFile, &pos)) != NoError) ReturnWithError2(err, pos);
        return pos;
}
virtual bool CPGFFileStream::IsValid ( ) const [inline, virtual]

Check stream validity.

Returns:
True if stream and current position is valid

Implements CPGFStream.

Definition at line 99 of file PGFstream.h.

{ return m_hFile != 0; }
void CPGFFileStream::Read ( int *  count,
void *  buffer 
) [virtual]

Read some bytes from this stream and stores them into a buffer.

Parameters:
countA pointer to a value containing the number of bytes should be read. After this call it contains the number of read bytes.
bufferA memory buffer

Implements CPGFStream.

Definition at line 48 of file PGFstream.cpp.

                                                          {
        ASSERT(count);
        ASSERT(buffPtr);
        ASSERT(IsValid());
        OSError err;
        if ((err = FileRead(m_hFile, count, buffPtr)) != NoError) ReturnWithError(err);
}
void CPGFFileStream::SetPos ( short  posMode,
INT64  posOff 
) [virtual]

Set stream position either absolute or relative.

Parameters:
posModeA position mode (FSFromStart, FSFromCurrent, FSFromEnd)
posOffA new stream position (absolute positioning) or a position offset (relative positioning)

Implements CPGFStream.

Definition at line 57 of file PGFstream.cpp.

                                                              {
        ASSERT(IsValid());
        OSError err;
        if ((err = SetFPos(m_hFile, posMode, posOff)) != NoError) ReturnWithError(err);
}
void CPGFFileStream::Write ( int *  count,
void *  buffer 
) [virtual]

Write some bytes out of a buffer into this stream.

Parameters:
countA pointer to a value containing the number of bytes should be written. After this call it contains the number of written bytes.
bufferA memory buffer

Implements CPGFStream.

Definition at line 38 of file PGFstream.cpp.

                                                           {
        ASSERT(count);
        ASSERT(buffPtr);
        ASSERT(IsValid());
        OSError err;
        if ((err = FileWrite(m_hFile, count, buffPtr)) != NoError) ReturnWithError(err);
        
}

Member Data Documentation

HANDLE CPGFFileStream::m_hFile [protected]

file handle

Definition at line 84 of file PGFstream.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines