CPGFFileStream(3)
π 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 () constvirtual 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
- fedora 43: libpgf-devel 7.21.7-8.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: libpgf-devel 7.21.7-8.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms