OpenTTD Source 20241224-master-gf74b0cf984
LZMASaveFilter Struct Reference

Filter using LZMA compression. More...

Inheritance diagram for LZMASaveFilter:
SaveFilter

Public Member Functions

 LZMASaveFilter (std::shared_ptr< SaveFilter > chain, uint8_t compression_level)
 Initialise this filter.
 
 ~LZMASaveFilter ()
 Clean up what we allocated.
 
void WriteLoop (uint8_t *p, size_t len, lzma_action action)
 Helper loop for writing the data.
 
void Write (uint8_t *buf, size_t size) override
 Write a given number of bytes into the savegame.
 
void Finish () override
 Prepare everything to finish writing the savegame.
 
- Public Member Functions inherited from SaveFilter
 SaveFilter (std::shared_ptr< SaveFilter > chain)
 Initialise this filter.
 
virtual ~SaveFilter ()=default
 Make sure the writers are properly closed.
 

Data Fields

lzma_stream lzma
 Stream state that we are writing to.
 
uint8_t fwrite_buf [MEMORY_CHUNK_SIZE]
 Buffer for writing to the file.
 
- Data Fields inherited from SaveFilter
std::shared_ptr< SaveFilterchain
 Chained to the (savegame) filters.
 

Detailed Description

Filter using LZMA compression.

Definition at line 2623 of file saveload.cpp.

Constructor & Destructor Documentation

◆ LZMASaveFilter()

LZMASaveFilter::LZMASaveFilter ( std::shared_ptr< SaveFilter chain,
uint8_t  compression_level 
)
inline

Initialise this filter.

Parameters
chainThe next filter in this chain.
compression_levelThe requested level of compression.

Definition at line 2632 of file saveload.cpp.

References SlError().

◆ ~LZMASaveFilter()

LZMASaveFilter::~LZMASaveFilter ( )
inline

Clean up what we allocated.

Definition at line 2638 of file saveload.cpp.

Member Function Documentation

◆ Finish()

void LZMASaveFilter::Finish ( )
inlineoverridevirtual

Prepare everything to finish writing the savegame.

Reimplemented from SaveFilter.

Definition at line 2674 of file saveload.cpp.

References SaveFilter::chain, and WriteLoop().

◆ Write()

void LZMASaveFilter::Write ( uint8_t *  buf,
size_t  len 
)
inlineoverridevirtual

Write a given number of bytes into the savegame.

Parameters
bufThe bytes to write.
lenThe number of bytes to write.

Implements SaveFilter.

Definition at line 2669 of file saveload.cpp.

References WriteLoop().

◆ WriteLoop()

void LZMASaveFilter::WriteLoop ( uint8_t *  p,
size_t  len,
lzma_action  action 
)
inline

Helper loop for writing the data.

Parameters
pThe bytes to write.
lenAmount of bytes to write.
actionAction for lzma_code.

Definition at line 2649 of file saveload.cpp.

References SaveFilter::chain, fwrite_buf, and SlError().

Referenced by Finish(), and Write().

Field Documentation

◆ fwrite_buf

uint8_t LZMASaveFilter::fwrite_buf[MEMORY_CHUNK_SIZE]

Buffer for writing to the file.

Definition at line 2625 of file saveload.cpp.

Referenced by WriteLoop().

◆ lzma

lzma_stream LZMASaveFilter::lzma

Stream state that we are writing to.

Definition at line 2624 of file saveload.cpp.


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