crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
Bytes.hpp File Reference
#include <algorithm>
#include <array>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <string>
#include <vector>
Include dependency graph for Bytes.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 crawlservpp::Helper::Bytes
 Namespace for global byte operation helper functions.
 

Typedefs

using crawlservpp::Helper::Bytes::Bytes = std::vector< std::uint8_t >
 

Constants

constexpr auto crawlservpp::Helper::Bytes::first {0}
 Index of the first byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::second {1}
 Index of the second byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::third {2}
 Index of the third byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::fourth {3}
 Index of the fourth byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::fifth {4}
 Index of the fifth byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::sixth {5}
 Index of the sixth byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::seventh {6}
 Index of the seventh byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::eighth {7}
 Index of the eighth byte. More...
 
constexpr auto crawlservpp::Helper::Bytes::oneByteBits {8}
 One byte in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::twoBytesBits {16}
 Two bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::threeBytesBits {24}
 Three bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::fourBytesBits {32}
 Four bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::fiveBytesBits {40}
 Five bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::sixBytesBits {48}
 Six bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::sevenBytesBits {56}
 Seven bytes in bits. More...
 
constexpr auto crawlservpp::Helper::Bytes::sizeEight {8}
 Size of eight bytes. More...
 
constexpr auto crawlservpp::Helper::Bytes::sizeFour {4}
 Size of four bytes. More...
 
constexpr auto crawlservpp::Helper::Bytes::sizeTwo {2}
 Size of two bytes. More...
 

Endianness

bool crawlservpp::Helper::Bytes::isBigEndian () noexcept
 Returns whether the machine running this code uses big endianness. More...
 
bool crawlservpp::Helper::Bytes::isFloatBigEndian () noexcept
 Returns whether the machine running this code uses big endianness for floating-point numbers. More...
 

Bytes-to-Number Conversion

std::uint64_t crawlservpp::Helper::Bytes::bytesToUInt64 (const Bytes &bytes, std::size_t &pos)
 Retrieve an unsigned 64-bit number from a vector of bytes. More...
 
std::uint64_t crawlservpp::Helper::Bytes::bytesToUInt64 (const Bytes &bytes, std::size_t &pos, std::size_t len)
 Retrieve an unsigned 64-bit number from a vector of bytes. More...
 
std::int64_t crawlservpp::Helper::Bytes::bytesToInt64 (const Bytes &bytes, std::size_t &pos)
 Retrieve a signed 64-bit number from a vector of bytes. More...
 
std::int64_t crawlservpp::Helper::Bytes::bytesToInt64 (const Bytes &bytes, std::size_t &pos, std::size_t len)
 Retrieve a signed 64-bit number from a vector of bytes. More...
 
std::uint32_t crawlservpp::Helper::Bytes::bytesToUInt32 (const Bytes &bytes, std::size_t &pos)
 Retrieve an unsigned 32-bit number from a vector of bytes. More...
 
std::int32_t crawlservpp::Helper::Bytes::bytesToInt32 (const Bytes &bytes, std::size_t &pos)
 Retrieve a signed 32-bit number from a vector of bytes. More...
 
std::uint16_t crawlservpp::Helper::Bytes::bytesToUInt16 (const Bytes &bytes, std::size_t &pos)
 Retrieve an unsigned 16-bit number from a vector of bytes. More...
 
std::int16_t crawlservpp::Helper::Bytes::bytesToInt16 (const Bytes &bytes, std::size_t &pos)
 Retrieve a signed 16-bit number from a vector of bytes. More...
 
double crawlservpp::Helper::Bytes::bytesToDouble (const Bytes &bytes, std::size_t &pos)
 Retrieves a IEEE 754 double-precision binary floating-point number from a vector of bytes. More...
 

Number-to-Bytes Conversion

std::array< std::uint8_t, sizeEight > crawlservpp::Helper::Bytes::uInt64ToBytes (std::uint64_t number)
 Converts an unsigned 64-bit number to an array of eight bytes. More...
 
std::array< std::uint8_t, sizeEight > crawlservpp::Helper::Bytes::int64ToBytes (std::int64_t number)
 Converts a signed 64-bit number to an array of eight bytes. More...
 
std::array< std::uint8_t, sizeFour > crawlservpp::Helper::Bytes::uInt32ToBytes (std::uint32_t number)
 Converts an unsigned 32-bit number to an array of four bytes. More...
 
std::array< std::uint8_t, sizeFour > crawlservpp::Helper::Bytes::int32ToBytes (std::int32_t number)
 Converts an signed 32-bit number to an array of four bytes. More...
 
std::array< std::uint8_t, sizeTwo > crawlservpp::Helper::Bytes::uInt16ToBytes (std::uint16_t number)
 Converts an unsigned 16-bit number to an array of two bytes. More...
 
std::array< std::uint8_t, sizeTwo > crawlservpp::Helper::Bytes::int16ToBytes (std::int16_t number)
 Converts an signed 16-bit number to an array of two bytes. More...
 
std::array< std::uint8_t, sizeEight > crawlservpp::Helper::Bytes::doubleToBytes (double number)
 Converts a floating-point number with double precision to an array of four bytes. More...
 

String Representation

std::string crawlservpp::Helper::Bytes::byteToHexString (std::uint8_t byte)
 Converts a byte to a string containing the byte in hexadecimal format. More...
 
std::string crawlservpp::Helper::Bytes::charToString (char c)
 Converts a character to a string. More...