mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Introduce std::string_view
into wider use (#14368)
This commit is contained in:
parent
fa47af737f
commit
6ca214fefc
74 changed files with 501 additions and 456 deletions
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "irrlichttypes.h"
|
||||
#include "exceptions.h"
|
||||
#include <iostream>
|
||||
#include "util/pointer.h"
|
||||
#include <string_view>
|
||||
|
||||
/*
|
||||
Map format serialization version
|
||||
|
@ -83,19 +83,27 @@ inline bool ser_ver_supported(s32 v) {
|
|||
}
|
||||
|
||||
/*
|
||||
Misc. serialization functions
|
||||
Compression functions
|
||||
*/
|
||||
|
||||
void compressZlib(const u8 *data, size_t data_size, std::ostream &os, int level = -1);
|
||||
void compressZlib(const std::string &data, std::ostream &os, int level = -1);
|
||||
inline void compressZlib(std::string_view data, std::ostream &os, int level = -1)
|
||||
{
|
||||
compressZlib(reinterpret_cast<const u8*>(data.data()), data.size(), os, level);
|
||||
}
|
||||
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(const std::string &data, std::ostream &os, int level = 0);
|
||||
inline void compressZstd(std::string_view data, std::ostream &os, int level = 0)
|
||||
{
|
||||
compressZstd(reinterpret_cast<const u8*>(data.data()), data.size(), os, level);
|
||||
}
|
||||
void decompressZstd(std::istream &is, std::ostream &os);
|
||||
|
||||
// These choose between zlib and a self-made one according to version
|
||||
void compress(const SharedBuffer<u8> &data, std::ostream &os, u8 version, int level = -1);
|
||||
void compress(const std::string &data, std::ostream &os, u8 version, int level = -1);
|
||||
void compress(u8 *data, u32 size, std::ostream &os, u8 version, int level = -1);
|
||||
// These choose between zstd, zlib and a self-made one according to version
|
||||
void compress(const u8 *data, u32 size, std::ostream &os, u8 version, int level = -1);
|
||||
inline void compress(std::string_view data, std::ostream &os, u8 version, int level = -1)
|
||||
{
|
||||
compress(reinterpret_cast<const u8*>(data.data()), data.size(), os, version, level);
|
||||
}
|
||||
void decompress(std::istream &is, std::ostream &os, u8 version);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue