galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::ZLib Class Referencefinal

Zip (de)compressor. More...

#include <ZLib.hpp>

+ Collaboration diagram for galaxy::ZLib:

Public Types

enum class  Mode : int { COMPRESS = 0 , DECOMPRESS = 1 }
 ZLib mode to start in. More...
 

Public Member Functions

 ~ZLib ()
 Destructor.
 

Static Public Member Functions

static std::string encode (const std::string &input)
 Compresses string into ZLib.
 
static std::string decode (const std::string &input)
 Decompresses string into ZLib.
 

Private Member Functions

 ZLib (const Mode mode)
 Constructor.
 
std::string compressor (const std::string &input)
 Compresses string.
 
std::string finish ()
 Completes the compression.
 
std::string decompressor (const std::string &input)
 Decompresses a zlib string.
 

Private Attributes

Mode m_mode
 ZLib mode.
 
z_stream m_stream
 Stream object.
 
bool m_finished
 Has the compression finished.
 
char m_in [GALAXY_ZLIB_COMPLETE_CHUNK]
 Input buffer.
 
char m_out [GALAXY_ZLIB_COMPLETE_CHUNK]
 Output buffer.
 

Detailed Description

Zip (de)compressor.

Definition at line 21 of file ZLib.hpp.

Member Enumeration Documentation

◆ Mode

enum class galaxy::ZLib::Mode : int
strong

ZLib mode to start in.

Enumerator
COMPRESS 

ZLib deflation.

DECOMPRESS 

ZLib inflation.

Definition at line 27 of file ZLib.hpp.

Constructor & Destructor Documentation

◆ ~ZLib()

galaxy::ZLib::~ZLib ( )

Destructor.

Definition at line 62 of file ZLib.cpp.

◆ ZLib()

galaxy::ZLib::ZLib ( const Mode mode)
private

Constructor.

Parameters
modeZLib mode to start in.

Definition at line 23 of file ZLib.cpp.

+ Here is the caller graph for this function:

Member Function Documentation

◆ encode()

std::string galaxy::ZLib::encode ( const std::string & input)
staticnodiscard

Compresses string into ZLib.

Parameters
inputInput data to convert.
Returns
Returns output data if successful, std::nullopt otherwise.

Definition at line 81 of file ZLib.cpp.

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

◆ decode()

std::string galaxy::ZLib::decode ( const std::string & input)
staticnodiscard

Decompresses string into ZLib.

Parameters
inputInput data to convert.
Returns
Returns output data if successful, std::nullopt otherwise.

Definition at line 124 of file ZLib.cpp.

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

◆ compressor()

std::string galaxy::ZLib::compressor ( const std::string & input)
nodiscardprivate

Compresses string.

Parameters
inputData to compress.
Returns
Compressed string.

Definition at line 165 of file ZLib.cpp.

◆ finish()

std::string galaxy::ZLib::finish ( )
nodiscardprivate

Completes the compression.

Returns
Compressed string containing termination block.

Definition at line 219 of file ZLib.cpp.

◆ decompressor()

std::string galaxy::ZLib::decompressor ( const std::string & input)
nodiscardprivate

Decompresses a zlib string.

Parameters
inputData to decompress.
Returns
String containing decompressed data.

Definition at line 265 of file ZLib.cpp.

Member Data Documentation

◆ m_mode

Mode galaxy::ZLib::m_mode
private

ZLib mode.

Definition at line 105 of file ZLib.hpp.

◆ m_stream

z_stream galaxy::ZLib::m_stream
private

Stream object.

Definition at line 110 of file ZLib.hpp.

◆ m_finished

bool galaxy::ZLib::m_finished
private

Has the compression finished.

Definition at line 115 of file ZLib.hpp.

◆ m_in

char galaxy::ZLib::m_in[GALAXY_ZLIB_COMPLETE_CHUNK]
private

Input buffer.

Definition at line 120 of file ZLib.hpp.

◆ m_out

char galaxy::ZLib::m_out[GALAXY_ZLIB_COMPLETE_CHUNK]
private

Output buffer.

Definition at line 125 of file ZLib.hpp.


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