Struct mdbx::to_hex
Hexadecimal encoder which satisfy SliceTranscoder concept.
#include <mdbx.h++>
Public Attributes
| Type | Name |
|---|---|
| const slice | source The slice to be encoded. |
| const bool | uppercase Use uppercase letters for hexadecimal digits. |
| const unsigned | wrap_width The width to wrap lines with a newline, zero means no wrapping. |
Public Functions
| Type | Name |
|---|---|
| size_t | envisage_result_length () noexcept const Returns the buffer size in bytes needed for hexadecimal dump of a passed 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 the passed slice could be encoded; this encoder always returns false . |
| ::std::ostream & | output (::std::ostream & out) const Output hexadecimal dump of passed slice to the std::ostream. |
| constexpr | to_hex (const slice & source, bool uppercase=false, unsigned wrap_width=0) noexcept Constructs the encoder for the given slice. |
| char * | write_bytes (char * dest, size_t dest_size) const Fills the buffer by hexadecimal dump of a passed slice. |
Public Attributes Documentation
variable source
The slice to be encoded.
const slice mdbx::to_hex::source;
variable uppercase
Use uppercase letters for hexadecimal digits.
const bool mdbx::to_hex::uppercase;
variable wrap_width
The width to wrap lines with a newline, zero means no wrapping.
const unsigned mdbx::to_hex::wrap_width;
Public Functions Documentation
function envisage_result_length
Returns the buffer size in bytes needed for hexadecimal dump of a passed slice.
inline size_t mdbx::to_hex::envisage_result_length () noexcept const
Returns:
The required buffer size in bytes.
function is_empty
Checks whether a passed slice is empty, and therefore there will be no output bytes.
inline bool mdbx::to_hex::is_empty () noexcept const
Returns:
true if the source slice is empty.
function is_erroneous
Checks whether the content of the passed slice could be encoded; this encoder always returns false .
inline bool mdbx::to_hex::is_erroneous () noexcept const
Returns:
Always false for the hexadecimal encoder.
function output
Output hexadecimal dump of passed slice to the std::ostream.
::std::ostream & mdbx::to_hex::output (
::std::ostream & out
) const
Parameters:
outThe output stream.
Returns:
A reference to the given output stream.
Exception:
std::ios_base::failurecorresponding to std::ostream::write() behaviour.
function to_hex
Constructs the encoder for the given slice.
inline constexpr mdbx::to_hex::to_hex (
const slice & source,
bool uppercase=false,
unsigned wrap_width=0
) noexcept
Parameters:
sourceThe slice to be encoded.uppercaseUse uppercase letters for hexadecimal digits.wrap_widthThe width to wrap lines with a newline, zero means no wrapping.
function write_bytes
Fills the buffer by hexadecimal dump of a passed slice.
char * mdbx::to_hex::write_bytes (
char * dest,
size_t dest_size
) const
Parameters:
destThe destination buffer to be filled.dest_sizeThe size of the destination buffer.
Returns:
The pointer just after the last written byte.
Exception:
std::length_errorif given buffer is too small.
The documentation for this class was generated from the following file mdbx.h++