Skip to content

Struct mdbx::from_hex

ClassList > mdbx > from_hex

Hexadecimal decoder which satisfy SliceTranscoder concept.

  • #include <mdbx.h++>

Public Attributes

Type Name
const bool ignore_spaces
Skip whitespaces while decoding.
const slice source
The slice with a hexadecimal dump to be decoded.

Public Functions

Type Name
size_t envisage_result_length () noexcept const
Returns the number of bytes needed for conversion hexadecimal dump from a passed slice to decoded data.
constexpr from_hex (const slice & source, bool ignore_spaces=false) noexcept
Constructs the decoder for the given slice.
bool is_empty () noexcept const
Checks whether a passed slice is empty, and therefore there will be no output bytes.
bool is_erroneous () noexcept const
Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore can be decoded without errors.
char * write_bytes (char * dest, size_t dest_size) const
Fills the destination with data decoded from hexadecimal dump from a passed slice.

Public Attributes Documentation

variable ignore_spaces

Skip whitespaces while decoding.

const bool mdbx::from_hex::ignore_spaces;

variable source

The slice with a hexadecimal dump to be decoded.

const slice mdbx::from_hex::source;

Public Functions Documentation

function envisage_result_length

Returns the number of bytes needed for conversion hexadecimal dump from a passed slice to decoded data.

inline size_t mdbx::from_hex::envisage_result_length () noexcept const

Returns:

The required buffer size in bytes.


function from_hex

Constructs the decoder for the given slice.

inline constexpr mdbx::from_hex::from_hex (
    const slice & source,
    bool ignore_spaces=false
) noexcept

Parameters:

  • source The slice with a hexadecimal dump to be decoded.
  • ignore_spaces Skip whitespaces while decoding.

function is_empty

Checks whether a passed slice is empty, and therefore there will be no output bytes.

inline bool mdbx::from_hex::is_empty () noexcept const

Returns:

true if the source slice is empty.


function is_erroneous

Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore can be decoded without errors.

bool mdbx::from_hex::is_erroneous () noexcept const

Returns:

true if the source slice is NOT a valid hexadecimal dump.


function write_bytes

Fills the destination with data decoded from hexadecimal dump from a passed slice.

char * mdbx::from_hex::write_bytes (
    char * dest,
    size_t dest_size
) const

Parameters:

  • dest The destination buffer to be filled.
  • dest_size The size of the destination buffer.

Returns:

The pointer just after the last written byte.

Exception:

  • std::length_error if given buffer is too small.


The documentation for this class was generated from the following file mdbx.h++