libfacade 1.1
A library for manipulating PNG images with payloads.
|
Namespaces | |
namespace | exception |
namespace | ico |
namespace | png |
Classes | |
class | ICOPayload |
An icon file containing a payload. More... | |
class | PNGPayload |
A PNG-based payload helper class. More... | |
Functions | |
EXPORT std::uint16_t | endian_swap_16 (std::uint16_t value) |
Swap the endianness of a 16-bit value. | |
EXPORT std::uint32_t | endian_swap_32 (std::uint32_t value) |
Swap the endianness of a 32-bit value. | |
EXPORT std::uint32_t | crc32 (const void *ptr, std::size_t size, std::uint32_t init_crc=0) |
Calculate the CRC32 value of a given buffer. | |
EXPORT std::vector< std::uint8_t > | compress (const void *ptr, std::size_t size, int level) |
Compress the given data buffer with the given compression level. | |
EXPORT std::vector< std::uint8_t > | compress (const std::vector< std::uint8_t > &vec, int level) |
Compress the given byte vector with the given compression level. | |
EXPORT std::vector< std::uint8_t > | decompress (const void *ptr, std::size_t size) |
Decompress the given data buffer with zlib's inflate algorithm. | |
EXPORT std::vector< std::uint8_t > | decompress (const std::vector< std::uint8_t > &vec) |
Decompress the given data vector with zlib's inflate algorithm. | |
EXPORT bool | is_base64_string (const std::string &base64) |
Determine if the string is a base64 string. | |
EXPORT std::string | base64_encode (const void *ptr, std::size_t size) |
Base64 encode the given buffer data. | |
EXPORT std::string | base64_encode (const std::vector< std::uint8_t > &data) |
Base64 encode the given data vector. | |
EXPORT std::vector< std::uint8_t > | base64_decode (const std::string &data) |
Base64-decode the given string into a byte vector. | |
EXPORT std::vector< std::uint8_t > | read_file (const std::string &filename) |
Read a file into a byte vector. | |
EXPORT void | write_file (const std::string &filename, const void *ptr, std::size_t size) |
Write a given buffer to the given filename. | |
EXPORT void | write_file (const std::string &filename, const std::vector< std::uint8_t > &vec) |
Write a given byte vector to the given filename. | |
Variables | |
const std::uint32_t | CRC32_TABLE [256] |
The table used for calculating a CRC32 value. | |
const std::string | BASE64_ALPHA |
The alphabet of base64 data. | |
std::vector< std::uint8_t > facade::base64_decode | ( | const std::string & | data | ) |
Base64-decode the given string into a byte vector.
data | The base64-encoded string. |
facade::exception::InvalidBase64Character |
std::string facade::base64_encode | ( | const std::vector< std::uint8_t > & | data | ) |
Base64 encode the given data vector.
data | The vector of bytes to encode. |
std::string facade::base64_encode | ( | const void * | ptr, |
std::size_t | size | ||
) |
Base64 encode the given buffer data.
ptr | The data buffer to encode. |
size | The size, in bytes, of the given pointer. |
std::vector< std::uint8_t > facade::compress | ( | const std::vector< std::uint8_t > & | vec, |
int | level | ||
) |
Compress the given byte vector with the given compression level.
vec | The byte vector to compress. |
level | The compression level to give to deflate, see the zlib manual for possible values. |
std::vector< std::uint8_t > facade::compress | ( | const void * | ptr, |
std::size_t | size, | ||
int | level | ||
) |
Compress the given data buffer with the given compression level.
This utilizes zlib's deflate algorithm. For more on that, read zlib's documentation.
ptr | The given data pointer to compress. |
size | The size, in bytes, of the given data pointer. |
level | The compression level to pass to the deflate algorithm, see the zlib manual for possible values. |
facade::exception::ZLibError |
std::uint32_t facade::crc32 | ( | const void * | ptr, |
std::size_t | size, | ||
std::uint32_t | init_crc = 0 |
||
) |
Calculate the CRC32 value of a given buffer.
ptr | A pointer to the data whose CRC you wish to calculate. |
size | The size, in bytes, contained by the data pointer. |
init_crc | The initial CRC value to use. The default is 0 for an initial value. |
std::vector< std::uint8_t > facade::decompress | ( | const std::vector< std::uint8_t > & | vec | ) |
Decompress the given data vector with zlib's inflate algorithm.
vec | The compressed data vector. |
facade::exception::ZLibError |
std::vector< std::uint8_t > facade::decompress | ( | const void * | ptr, |
std::size_t | size | ||
) |
Decompress the given data buffer with zlib's inflate algorithm.
ptr | The compressed data pointer to decompress. |
size | The size, in bytes, of the data pointer. |
facade::exception::ZLibError |
std::uint16_t facade::endian_swap_16 | ( | std::uint16_t | value | ) |
Swap the endianness of a 16-bit value.
This converts big endian to little endian, or little endian to big endian.
value | The value whose endianness needs to be swapped. |
std::uint32_t facade::endian_swap_32 | ( | std::uint32_t | value | ) |
Swap the endianness of a 32-bit value.
This converts big endian to little endian, or little endian to big endian.
value | The value whose endianness needs to be swapped. |
bool facade::is_base64_string | ( | const std::string & | base64 | ) |
Determine if the string is a base64 string.
base64 | The string of (alleged) base64 data. |
std::vector< std::uint8_t > facade::read_file | ( | const std::string & | filename | ) |
Read a file into a byte vector.
filename | The given filename to read. |
facade::exception::OpenFileFailure |
void facade::write_file | ( | const std::string & | filename, |
const std::vector< std::uint8_t > & | vec | ||
) |
Write a given byte vector to the given filename.
filename | The filename to save to. |
vec | The byte vector to write. |
facade::exception::OpenFileFailure |
void facade::write_file | ( | const std::string & | filename, |
const void * | ptr, | ||
std::size_t | size | ||
) |
Write a given buffer to the given filename.
filename | The filename to save to. |
ptr | The data buffer to write. |
size | The size, in bytes, of the pointed data buffer. |
facade::exception::OpenFileFailure |
const std::string facade::BASE64_ALPHA |
The alphabet of base64 data.
const std::uint32_t facade::CRC32_TABLE[256] |
The table used for calculating a CRC32 value.