userver: userver/utils/encoding/hex.hpp File Reference
Loading...
Searching...
No Matches
hex.hpp File Reference

Detailed Description

Encoders, decoders and helpers for hexadecimal representations.

Definition in file hex.hpp.

Go to the source code of this file.

#include <cstdint>
#include <string>
#include <userver/utils/span.hpp>
+ This graph shows which files directly or indirectly include this file:

Namespaces

namespace  utils
 General-purpose utilities used across userver libraries.
 
namespace  utils::encoding
 Encoders/decoders: TSKV, hex, and related parsers.
 

Functions

char utils::encoding::ToHexChar (int num)
 Converts number to hex character; number must be within range [0,16)
 
constexpr size_t utils::encoding::FromHexUpperBound (size_t size) noexcept
 Return upper limit on number of characters required to unhex input of given size.
 
void utils::encoding::ToHex (std::string_view input, std::string &out) noexcept
 Converts input to hex and writes data to output out.
 
void utils::encoding::ToHexBuffer (std::string_view input, utils::span< char > out) noexcept
 Converts input to hex and writes data to output out.
 
std::string utils::encoding::ToHex (std::string_view data) noexcept
 Allocates std::string, converts input and writes into said string.
 
std::string utils::encoding::ToHex (const void *encoded, size_t len) noexcept
 Allocates std::string, converts input and writes into said string.
 
size_t utils::encoding::FromHex (std::string_view encoded, std::string &out) noexcept
 Converts as much of input from hex as possible and writes data into out.
 
std::string utils::encoding::FromHex (std::string_view encoded) noexcept
 This FromHex overload allocates string and calls FromHex; if data is not fully a hex string, then it will be only partially processed.
 
std::string_view utils::encoding::GetHexPart (std::string_view encoded) noexcept
 
bool utils::encoding::IsHexData (std::string_view encoded) noexcept
 Checks that given range is fully a hex string. That is, if passed to FromHex, it will be fully processed.
 
std::string utils::encoding::ToHexString (uint64_t value)
 Interprets uint64_t value as array of bytes and applies ToHex to it.
 
constexpr size_t utils::encoding::LengthInHexForm (size_t size) noexcept
 Calculate expected length of input after being hex encoded.
 
constexpr size_t utils::encoding::LengthInHexForm (std::string_view data) noexcept