PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CBufferedFile Class Reference

Non-refcounted RAII wrapper around a FILE* that implements a ring buffer to deserialize from. More...

#include <streams.h>

Public Member Functions

 CBufferedFile (FILE *fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn)
 
 ~CBufferedFile ()
 
void fclose ()
 
bool eof () const
 
CBufferedFileread (char *pch, size_t nSize)
 
uint64_t GetPos ()
 
bool SetPos (uint64_t nPos)
 
bool Seek (uint64_t nPos)
 
bool SetLimit (uint64_t nPos=(uint64_t)(-1))
 
template<typename T >
CBufferedFileoperator>> (T &obj)
 
void FindByte (char ch)
 

Protected Member Functions

bool Fill ()
 

Private Member Functions

 CBufferedFile (const CBufferedFile &)
 
CBufferedFileoperator= (const CBufferedFile &)
 

Private Attributes

int nType
 
int nVersion
 
FILE * src
 
uint64_t nSrcPos
 
uint64_t nReadPos
 
uint64_t nReadLimit
 
uint64_t nRewind
 
std::vector< char > vchBuf
 

Detailed Description

Non-refcounted RAII wrapper around a FILE* that implements a ring buffer to deserialize from.

It guarantees the ability to rewind a given number of bytes.

Will automatically close the file when it goes out of scope if not null. If you need to close the file early, use file.fclose() instead of fclose(file).

Definition at line 433 of file streams.h.

Constructor & Destructor Documentation

◆ CBufferedFile() [1/2]

CBufferedFile::CBufferedFile ( const CBufferedFile )
private

◆ CBufferedFile() [2/2]

CBufferedFile::CBufferedFile ( FILE *  fileIn,
uint64_t  nBufSize,
uint64_t  nRewindIn,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 471 of file streams.h.

◆ ~CBufferedFile()

CBufferedFile::~CBufferedFile ( )
inline

Definition at line 478 of file streams.h.

Here is the call graph for this function:

Member Function Documentation

◆ eof()

bool CBufferedFile::eof ( ) const
inline

Definition at line 492 of file streams.h.

◆ fclose()

void CBufferedFile::fclose ( )
inline

Definition at line 483 of file streams.h.

Here is the caller graph for this function:

◆ Fill()

bool CBufferedFile::Fill ( )
inlineprotected

Definition at line 452 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindByte()

void CBufferedFile::FindByte ( char  ch)
inline

Definition at line 574 of file streams.h.

Here is the call graph for this function:

◆ GetPos()

uint64_t CBufferedFile::GetPos ( )
inline

Definition at line 522 of file streams.h.

◆ operator=()

CBufferedFile& CBufferedFile::operator= ( const CBufferedFile )
private

◆ operator>>()

template<typename T >
CBufferedFile& CBufferedFile::operator>> ( T &  obj)
inline

Definition at line 566 of file streams.h.

Here is the call graph for this function:

◆ read()

CBufferedFile& CBufferedFile::read ( char *  pch,
size_t  nSize 
)
inline

Definition at line 498 of file streams.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Seek()

bool CBufferedFile::Seek ( uint64_t  nPos)
inline

Definition at line 542 of file streams.h.

◆ SetLimit()

bool CBufferedFile::SetLimit ( uint64_t  nPos = (uint64_t)(-1))
inline

Definition at line 557 of file streams.h.

◆ SetPos()

bool CBufferedFile::SetPos ( uint64_t  nPos)
inline

Definition at line 528 of file streams.h.

Member Data Documentation

◆ nReadLimit

uint64_t CBufferedFile::nReadLimit
private

Definition at line 446 of file streams.h.

◆ nReadPos

uint64_t CBufferedFile::nReadPos
private

Definition at line 445 of file streams.h.

◆ nRewind

uint64_t CBufferedFile::nRewind
private

Definition at line 447 of file streams.h.

◆ nSrcPos

uint64_t CBufferedFile::nSrcPos
private

Definition at line 444 of file streams.h.

◆ nType

int CBufferedFile::nType
private

Definition at line 440 of file streams.h.

◆ nVersion

int CBufferedFile::nVersion
private

Definition at line 441 of file streams.h.

◆ src

FILE* CBufferedFile::src
private

Definition at line 443 of file streams.h.

◆ vchBuf

std::vector<char> CBufferedFile::vchBuf
private

Definition at line 448 of file streams.h.


The documentation for this class was generated from the following file: