libfacade 1.1
A library for manipulating PNG images with payloads.
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
utility.hpp File Reference

Functions relating to the needs of images in the program. More...

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cctype>
#include <string>
#include <vector>
#include <zlib.h>
#include <facade/platform.hpp>

Go to the source code of this file.

Namespaces

namespace  facade
 

Functions

EXPORT std::uint16_t facade::endian_swap_16 (std::uint16_t value)
 Swap the endianness of a 16-bit value.
 
EXPORT std::uint32_t facade::endian_swap_32 (std::uint32_t value)
 Swap the endianness of a 32-bit value.
 
EXPORT 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.
 
EXPORT 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.
 
EXPORT 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.
 
EXPORT std::vector< std::uint8_t > facade::decompress (const void *ptr, std::size_t size)
 Decompress the given data buffer with zlib's inflate algorithm.
 
EXPORT std::vector< std::uint8_t > facade::decompress (const std::vector< std::uint8_t > &vec)
 Decompress the given data vector with zlib's inflate algorithm.
 
EXPORT bool facade::is_base64_string (const std::string &base64)
 Determine if the string is a base64 string.
 
EXPORT std::string facade::base64_encode (const void *ptr, std::size_t size)
 Base64 encode the given buffer data.
 
EXPORT std::string facade::base64_encode (const std::vector< std::uint8_t > &data)
 Base64 encode the given data vector.
 
EXPORT std::vector< std::uint8_t > facade::base64_decode (const std::string &data)
 Base64-decode the given string into a byte vector.
 
EXPORT std::vector< std::uint8_t > facade::read_file (const std::string &filename)
 Read a file into a byte vector.
 
EXPORT void facade::write_file (const std::string &filename, const void *ptr, std::size_t size)
 Write a given buffer to the given filename.
 
EXPORT void facade::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 facade::CRC32_TABLE [256]
 The table used for calculating a CRC32 value.
 
const std::string facade::BASE64_ALPHA
 The alphabet of base64 data.
 

Detailed Description

Functions relating to the needs of images in the program.

This file features code related to various functionality of the program, such as PNG's needs for compression utilities and CRC32 calculation.