Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
serialization.h File Reference
#include "irrlichttypes.h"
#include "exceptions.h"
#include <iostream>
#include <string_view>
+ Include dependency graph for serialization.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool ser_ver_supported_read (s32 v)
 
bool ser_ver_supported_write (s32 v)
 
void compressZlib (const u8 *data, size_t data_size, std::ostream &os, int level=-1)
 
void compressZlib (std::string_view data, std::ostream &os, int level=-1)
 
void decompressZlib (std::istream &is, std::ostream &os, size_t limit=0)
 
void compressZstd (const u8 *data, size_t data_size, std::ostream &os, int level=0)
 
void compressZstd (std::string_view data, std::ostream &os, int level=0)
 
void decompressZstd (std::istream &is, std::ostream &os)
 
void compress (const u8 *data, u32 size, std::ostream &os, u8 version, int level=-1)
 
void compress (std::string_view data, std::ostream &os, u8 version, int level=-1)
 
void decompress (std::istream &is, std::ostream &os, u8 version)
 

Variables

constexpr u8 SER_FMT_VER_INVALID = 255
 
constexpr u8 SER_FMT_VER_HIGHEST_READ = 29
 
constexpr u8 SER_FMT_VER_HIGHEST_WRITE = 29
 
constexpr u8 SER_FMT_VER_LOWEST_READ = 0
 
constexpr u8 SER_FMT_VER_LOWEST_WRITE = 24
 

Function Documentation

◆ compress() [1/2]

void compress ( const u8 * data,
u32 size,
std::ostream & os,
u8 version,
int level = -1 )

References compressZlib(), compressZstd(), and writeU32().

Referenced by compress(), ModApiUtil::Initialize(), ModApiUtil::InitializeAsync(), ModApiUtil::InitializeClient(), MapBlock::serialize(), Schematic::serializeToMts(), and TestCompression::testRLECompression().

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

◆ compress() [2/2]

void compress ( std::string_view data,
std::ostream & os,
u8 version,
int level = -1 )
inline

References compress().

+ Here is the call graph for this function:

◆ compressZlib() [1/2]

void compressZlib ( const u8 * data,
size_t data_size,
std::ostream & os,
int level = -1 )

References zerr().

Referenced by TestCompression::_testZlibLimit(), compress(), compressZlib(), encodePNG(), ModApiUtil::l_compress(), Server::SendItemDef(), Server::sendMetadataChanged(), Server::SendNodeDef(), TestCompression::testZlibCompression(), and TestCompression::testZlibLargeData().

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

◆ compressZlib() [2/2]

void compressZlib ( std::string_view data,
std::ostream & os,
int level = -1 )
inline

References compressZlib().

+ Here is the call graph for this function:

◆ compressZstd() [1/2]

void compressZstd ( const u8 * data,
size_t data_size,
std::ostream & os,
int level = 0 )

References dstream.

Referenced by compress(), compressZstd(), ModApiUtil::l_compress(), and TestCompression::testZstdLargeData().

+ Here is the caller graph for this function:

◆ compressZstd() [2/2]

void compressZstd ( std::string_view data,
std::ostream & os,
int level = 0 )
inline

References compressZstd().

+ Here is the call graph for this function:

◆ decompress()

void decompress ( std::istream & is,
std::ostream & os,
u8 version )

References decompressZlib(), decompressZstd(), and readU32().

Referenced by MapBlock::deSerialize(), MapBlock::deSerialize_pre22(), Schematic::deserializeFromMts(), ModApiUtil::Initialize(), ModApiUtil::InitializeAsync(), ModApiUtil::InitializeClient(), and TestCompression::testRLECompression().

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

◆ decompressZlib()

void decompressZlib ( std::istream & is,
std::ostream & os,
size_t limit = 0 )

References dstream, and zerr().

Referenced by TestCompression::_testZlibLimit(), decompress(), MapBlock::deSerialize_pre22(), Client::handleCommand_ItemDef(), Client::handleCommand_NodeDef(), Client::handleCommand_NodemetaChanged(), ModApiUtil::l_decompress(), TestCompression::testZlibCompression(), and TestCompression::testZlibLargeData().

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

◆ decompressZstd()

void decompressZstd ( std::istream & is,
std::ostream & os )

References dstream.

Referenced by decompress(), ModApiUtil::l_decompress(), TestMapBlock::testSave29(), and TestCompression::testZstdLargeData().

+ Here is the caller graph for this function:

◆ ser_ver_supported_read()

bool ser_ver_supported_read ( s32 v)
inline

References SER_FMT_VER_HIGHEST_READ, and SER_FMT_VER_LOWEST_READ.

Referenced by MapBlock::deSerialize(), MapNode::deSerialize(), MapNode::deSerializeBulk(), Client::handleCommand_Hello(), and MapNode::serializedLength().

+ Here is the caller graph for this function:

◆ ser_ver_supported_write()

bool ser_ver_supported_write ( s32 v)
inline

References SER_FMT_VER_HIGHEST_WRITE, and SER_FMT_VER_LOWEST_WRITE.

Referenced by Server::handleCommand_Init(), MapBlock::serialize(), MapNode::serialize(), and MapNode::serializeBulk().

+ Here is the caller graph for this function:

Variable Documentation

◆ SER_FMT_VER_HIGHEST_READ

u8 SER_FMT_VER_HIGHEST_READ = 29
constexpr

◆ SER_FMT_VER_HIGHEST_WRITE

◆ SER_FMT_VER_INVALID

u8 SER_FMT_VER_INVALID = 255
constexpr

◆ SER_FMT_VER_LOWEST_READ

u8 SER_FMT_VER_LOWEST_READ = 0
constexpr

Referenced by ser_ver_supported_read().

◆ SER_FMT_VER_LOWEST_WRITE

u8 SER_FMT_VER_LOWEST_WRITE = 24
constexpr