| libpgf 7.21.2 PGF - Progressive Graphics File

Public Member Functions | Protected Attributes | List of all members
CPGFFileStream Class Reference

File stream class. More...

`#include <PGFstream.h>`

Inheritance diagram for CPGFFileStream:

## 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 More...

## 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() [1/2]

CPGFFileStream::CPGFFileStream | ( |  | ) |
| inline

Definition at line 87 of file PGFstream.h.

87 : m_hFile(0) {}
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ CPGFFileStream() [2/2]

CPGFFileStream::CPGFFileStream | ( | HANDLE | hFile | ) |
| inline

Constructor

Parameters

  hFile | File handle

Definition at line 90 of file PGFstream.h.

90 : m_hFile(hFile) {}
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ ~CPGFFileStream()

virtual CPGFFileStream::~CPGFFileStream | ( |  | ) |
| inline virtual

Definition at line 94 of file PGFstream.h.

94 { m_hFile = 0; }
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## Member Function Documentation

## ◆ GetHandle()

HANDLE CPGFFileStream::GetHandle | ( |  | ) |
| inline

Returns
  File handle

Definition at line 92 of file PGFstream.h.

92 { return m_hFile; }
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ GetPos()

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 }
CPGFFileStream::IsValid
virtual bool IsValid() const
Definition: PGFstream.h:99
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ IsValid()

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; }
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ Read()

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 }
CPGFFileStream::IsValid
virtual bool IsValid() const
Definition: PGFstream.h:99
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ SetPos()

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 }
CPGFFileStream::IsValid
virtual bool IsValid() const
Definition: PGFstream.h:99
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## ◆ Write()

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 }
CPGFFileStream::IsValid
virtual bool IsValid() const
Definition: PGFstream.h:99
CPGFFileStream::m_hFile
HANDLE m_hFile
file handle
Definition: PGFstream.h:84

## Member Data Documentation

## ◆ m_hFile

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:

- PGFstream.h
- PGFstream.cpp