CPGFFileStream(3)

NAME
CPGFFileStream - File stream class.

SYNOPSIS

#include <PGFstream.h>

Inherits CPGFStream.

  Public Member Functions
CPGFFileStream ()
CPGFFileStream (HANDLE hFile)
HANDLE GetHandle ()
virtual ~CPGFFileStream ()
virtual void Write (int *count, void *buffer)
virtual void Read (int *count, void *buffer)
virtual void SetPos (short posMode, INT64 posOff)
virtual UINT64 GetPos () const
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

  CPGFFileStream::CPGFFileStream () [inline]

Definition at line 87 of file PGFstream.h.
87 : m_hFile(0) {}

  CPGFFileStream::CPGFFileStream (HANDLE hFile) [inline]
Constructor

Parameters
    hFile File handle

Definition at line 90 of file PGFstream.h.
90 : m_hFile(hFile) {}

  virtual CPGFFileStream::~CPGFFileStream () [inline], [virtual]

Definition at line 94 of file PGFstream.h.
94 { m_hFile = 0; }

Member Function Documentation

  HANDLE CPGFFileStream::GetHandle () [inline]

Returns
    File handle

Definition at line 92 of file PGFstream.h.
92 { 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.
64                                     {
65         ASSERT(IsValid());
66         OSError err;
67         UINT64 pos = 0;
68         if ((err = GetFPos(m_hFile, &pos)) != NoError) ReturnWithError2(err, pos);
69         return pos;
70 }

  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.
99 { 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
    count A pointer to a value containing the number of bytes should be read. After this call it contains the number of read bytes.
    buffer A memory buffer

Implements CPGFStream.

Definition at line 48 of file PGFstream.cpp.
48                                                    {
49         ASSERT(count);
50         ASSERT(buffPtr);
51         ASSERT(IsValid());
52         OSError err;
53         if ((err = FileRead(m_hFile, count, buffPtr)) != NoError) ReturnWithError(err);
54 }

  void CPGFFileStream::SetPos (short posMode, INT64 posOff) [virtual]
Set stream position either absolute or relative.

Parameters
    posMode A position mode (FSFromStart, FSFromCurrent, FSFromEnd)
    posOff A new stream position (absolute positioning) or a position offset (relative positioning)

Implements CPGFStream.

Definition at line 57 of file PGFstream.cpp.
57                                                        {
58         ASSERT(IsValid());
59         OSError err;
60         if ((err = SetFPos(m_hFile, posMode, posOff)) != NoError) ReturnWithError(err);
61 }

  void CPGFFileStream::Write (int * count, void * buffer) [virtual]
Write some bytes out of a buffer into this stream.

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

Implements CPGFStream.

Definition at line 38 of file PGFstream.cpp.
38                                                     {
39         ASSERT(count);
40         ASSERT(buffPtr);
41         ASSERT(IsValid());
42         OSError err;
43         if ((err = FileWrite(m_hFile, count, buffPtr)) != NoError) ReturnWithError(err);
44
45 }

Member Data Documentation

  HANDLE CPGFFileStream::m_hFile [protected]

file handle

Definition at line 84 of file PGFstream.h.

Author

Generated automatically by Doxygen for libpgf from the source code.