Pottu
Public Member Functions | Public Attributes | Friends | List of all members
pottu::GZFile Class Reference

Public Member Functions

 GZFile ()=default
 Default constructor. Does nothing.
 
 GZFile (const GZFile &o)=delete
 
 GZFile (GZFile &&rhs)
 
GZFileoperator= (GZFile rhs) noexcept
 
 GZFile (const std::string &filename, const std::string &openmode)
 Opens the file.
 
 ~GZFile ()
 Destructor.
 
void open (const std::string &filename, const std::string &openmode)
 
void close ()
 
int read (char *buf, unsigned int size)
 Reads data from the file to a buffer. More...
 
void seek (size_t position)
 Seeks the file position.
 
bool isOpen () const noexcept
 Checks if file is open.
 
bool isZipped () const noexcept
 Tells whether the file is zipped. More...
 
bool isEof () const noexcept
 
uint64_t getPosition () const noexcept
 

Public Attributes

gzFile _f {nullptr}
 

Friends

void swap (GZFile &lhs, GZFile &rhs) noexcept
 

Member Function Documentation

◆ isZipped()

bool pottu::GZFile::isZipped ( ) const
inlinenoexcept

Tells whether the file is zipped.

If file is not open will return always true.

◆ read()

int pottu::GZFile::read ( char *  buf,
unsigned int  size 
)
inline

Reads data from the file to a buffer.

Returns
number of bytes actually read

Throws runtime_error if read fails. It is still possible that read will read less bytes than requested (for example if the file ends).


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