CPGFFileStream(3)

πŸ“¦
version 7.21.7 Β· 4 versions
, in fedora 43

πŸ’– CPGFFileStream β€” a libpgf manual page, but make it cute ✨

okay bestie, gather round, because today we're talking about CPGFFileStream from libpgf, and honestly? she's giving "file stream class" and I am obsessed. πŸ’…


🌸 NAME 🌸

CPGFFileStream β€” File stream class. that's it, that's the name, she's simple, she's iconic. πŸ‘‘


✨ SYNOPSIS ✨

#include <PGFstream.h>

Inherits CPGFStream. yes bestie, she's a subclass, she got it from her mama. 🫢

πŸŽ€ 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. she handles your files outside the cozy little world of memory, and she does it flawlessly, no cap. πŸ’œ

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) {}

look at her, starting life with a zeroed handle. the way that's literally just m_hFile(0) and nothing else. so clean. 😭✨

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

Constructor πŸŽ€

Parameters

  • hFile β€” File handle

Definition at line 90 of file PGFstream.h.

90 : m_hFile(hFile) {}

you hand her a handle, she holds it. that's the whole vibe. πŸ’–

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

Definition at line 94 of file PGFstream.h.

94 { m_hFile = 0; }

destructor said "imma head out" and resets the handle to 0. graceful exit, queen. πŸ‘‘


πŸ”₯ Member Function Documentation πŸ”₯

🌈 HANDLE CPGFFileStream::GetHandle () [inline]

Returns β€” File handle

Definition at line 92 of file PGFstream.h.

92 { return m_hFile; }

just giving you the handle back, bestie. no notes. 🫢

🌈 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 }

note the ASSERT(IsValid()) at the top β€” she will check that you're valid before she does anything, and honestly? boundary queen behavior. πŸ’…

🌈 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; }

the vibe check of the whole class, fr fr. m_hFile != 0 β€” if the handle isn't zero, we're valid. periodt. ✨

🌈 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 }

three ASSERTs before she even lifts a finger β€” count, buffer, validity β€” and then FileRead does the thing. if it comes back anything other than NoError, ReturnWithError(err) and we're done. so much main character energy for a read function. πŸ˜­πŸ’–

🌈 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 }

mode plus offset, that's the whole recipe. absolute or relative, your choice bestie, she doesn't judge. 🌸

🌈 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 }

same energy as Read but make it output β€” asserts first, then FileWrite, then bail with ReturnWithError(err) if anything's not NoError. she ate and left no crumbs. πŸ”₯


πŸ“ Member Data Documentation πŸ“

HANDLE CPGFFileStream::m_hFile [protected]

file handle πŸ—„οΈ

Definition at line 84 of file PGFstream.h.

the one and only protected attribute. she's tiny, she's lowercase, she holds an entire file. lowkey iconic. πŸ’œ


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libpgf from the source code. (so if the prose is a little stiff, blame the robot, not me πŸ™ˆ)


that's the whole page bestie!! and just so you know, this was Version 7.21.2, dated Thu Jul 24 2025 00:00:00 β€” so go forth, stream your files, and stay valid (m_hFile != 0). mwah πŸ’‹βœ¨πŸŽ€

πŸ“¦ where this page comes from