Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
FilebufAppend Class Reference

Optimizes std::filebuf for random-access reading. More...

#include <filebuf.h>

Inheritance diagram for FilebufAppend:
Inheritance graph
[legend]
Collaboration diagram for FilebufAppend:
Collaboration graph
[legend]

Public Member Functions

 FilebufAppend ()
 
errorT open (const std::string &filename, fileModeT fmode)
 Opens a file and store its size. More...
 
unsigned long long size () const
 Returns the size of the file. More...
 
int pubsync ()
 Invokes std::filebuf::sync() to write all pending output to the file. More...
 
errorT append (const char_type *s, std::streamsize count)
 Writes, at the end of the file, count characters from the character array whose first element is pointed to by s. More...
 
std::streamsize sgetn (char_type *s, std::streamsize count)
 Invoke filebuf::xsgetn() and update filePos_. More...
 
std::streamoff pubseekpos (std::streamoff pos)
 Repositions the internal buffer or invoke filebuf::seekpos(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from Filebuf
errorT Open (const char *filename, fileModeT fmode)
 Opens a file. More...
 
size_t getline (char *str, size_t count)
 Equivalent to std::fstream::getline, but faster (no sentry [27.7.2.1.3]). More...
 
byte ReadOneByte ()
 Reads a 8-bit unsigned integer. More...
 
uint16_t ReadTwoBytes ()
 Reads a 16-bit unsigned integer. More...
 
uint32_t ReadThreeBytes ()
 Reads a 24-bit unsigned integer. More...
 
uint32_t ReadFourBytes ()
 Reads a 32-bit unsigned integer. More...
 
int WriteOneByte (byte value)
 Writes a 8-bit unsigned integer. More...
 
int WriteTwoBytes (uint32_t value)
 Writes a 16-bit unsigned integer. More...
 
int WriteThreeBytes (uint32_t value)
 Writes a 24-bit unsigned integer. More...
 
int WriteFourBytes (uint32_t value)
 Writes a 32-bit unsigned integer. More...
 

Detailed Description

Optimizes std::filebuf for random-access reading.

Definition at line 184 of file filebuf.h.

Constructor & Destructor Documentation

◆ FilebufAppend()

FilebufAppend::FilebufAppend ( )
inline

Definition at line 189 of file filebuf.h.

Member Function Documentation

◆ append()

errorT FilebufAppend::append ( const char_type *  s,
std::streamsize  count 
)
inline

Writes, at the end of the file, count characters from the character array whose first element is pointed to by s.

Returns
OK in case of success, an error code otherwise.

Definition at line 223 of file filebuf.h.

◆ open()

errorT FilebufAppend::open ( const std::string &  filename,
fileModeT  fmode 
)
inline

Opens a file and store its size.

Parameters
filenamepath to the file to be opened.
fmodeopen the file for reading, writing, or both.
Returns
OK on success, an errorT code on failure.

Definition at line 197 of file filebuf.h.

◆ pubseekpos()

std::streamoff FilebufAppend::pubseekpos ( std::streamoff  pos)
inline

Repositions the internal buffer or invoke filebuf::seekpos().

In the standard implementation, the buffer must be abandoned to ensure consistency when transitioning from reading to writing.

Definition at line 252 of file filebuf.h.

◆ pubsync()

int FilebufAppend::pubsync ( )
inline

Invokes std::filebuf::sync() to write all pending output to the file.

Returns
0 in case of success, -1 in case of failure.

Definition at line 216 of file filebuf.h.

◆ sgetn()

std::streamsize FilebufAppend::sgetn ( char_type *  s,
std::streamsize  count 
)
inline

Invoke filebuf::xsgetn() and update filePos_.

Definition at line 241 of file filebuf.h.

◆ size()

unsigned long long FilebufAppend::size ( ) const
inline

Returns the size of the file.

Definition at line 210 of file filebuf.h.


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