Classes | |
struct | mdbx::slice |
References a data located outside the slice. More... | |
struct | mdbx::default_capacity_policy |
struct | mdbx::to_hex |
Hexadecimal encoder which satisfy SliceTranscoder concept. More... | |
struct | mdbx::to_base58 |
Base58 encoder which satisfy SliceTranscoder concept. More... | |
struct | mdbx::to_base64 |
Base64 encoder which satisfy SliceTranscoder concept. More... | |
struct | mdbx::from_hex |
Hexadecimal decoder which satisfy SliceTranscoder concept. More... | |
struct | mdbx::from_base58 |
Base58 decoder which satisfy SliceTranscoder concept. More... | |
struct | mdbx::from_base64 |
Base64 decoder which satisfy SliceTranscoder concept. More... | |
class | mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > |
The chunk of data stored inside the buffer or located outside it. More... | |
struct | mdbx::value_result |
Combines data slice with boolean flag to represent result of certain operations. More... | |
struct | mdbx::pair |
Combines pair of slices for key and value to represent result of certain operations. More... | |
struct | mdbx::pair_result |
Combines pair of slices for key and value with boolean flag to represent result of certain operations. More... | |
Functions | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) > | |
buffer< ALLOCATOR, CAPACITY_POLICY > | mdbx::make_buffer (PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR()) |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) > | |
buffer< ALLOCATOR, CAPACITY_POLICY > | mdbx::make_buffer (const PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR()) |
template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) > | |
string< ALLOCATOR > | mdbx::make_string (PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR()) |
template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) > | |
string< ALLOCATOR > | mdbx::make_string (const PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR()) |
inline ::std::ostream & | mdbx::operator<< (::std::ostream &out, const to_hex &wrapper) |
inline ::std::ostream & | mdbx::operator<< (::std::ostream &out, const to_base58 &wrapper) |
inline ::std::ostream & | mdbx::operator<< (::std::ostream &out, const to_base64 &wrapper) |
Variables | |
template<typename T > | |
concept | mdbx::MutableByteProducer |
template<typename T > | |
concept | mdbx::ImmutableByteProducer |
template<typename T > | |
concept | mdbx::SliceTranscoder |
struct mdbx::slice |
References a data located outside the slice.
The slice
is similar in many ways to std::string_view
, but it implements specific capabilities and manipulates with bytes but not a characters.
Values returned from the database are valid only until a subsequent update operation, or the end of the transaction. Do not modify or free them, they commonly point into the database itself.
Key sizes must be between 0 and mdbx_env_get_maxkeysize() inclusive. The same applies to data sizes in databases with the MDBX_DUPSORT flag. Other data items can in theory be from 0 to MDBX_MAXDATASIZE bytes long.
Inherits MDBX_val.
Public Types | |
enum | { max_length = MDBX_MAXDATASIZE } |
Public Member Functions | |
slice () noexcept | |
Create an empty slice. More... | |
slice (const void *ptr, size_t bytes) | |
Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr. More... | |
slice (const void *begin, const void *end) | |
Create a slice that refers to [begin,end] of memory bytes. More... | |
template<size_t SIZE> | |
slice (const char(&text)[SIZE]) | |
Create a slice that refers to text[0,strlen(text)-1]. More... | |
slice (const char *c_str) | |
Create a slice that refers to c_str[0,strlen(c_str)-1]. More... | |
template<class CHAR , class T , class A > | |
slice (const ::std::basic_string< CHAR, T, A > &str) | |
Create a slice that refers to the contents of "str". More... | |
slice (const MDBX_val &src) | |
slice (const slice &) noexcept=default | |
slice (MDBX_val &&src) | |
slice (slice &&src) noexcept | |
template<class CHAR , class T > | |
slice (const ::std::basic_string_view< CHAR, T > &sv) | |
Create a slice that refers to the same contents as "string_view". More... | |
template<class CHAR , class T > | |
slice (::std::basic_string_view< CHAR, T > &&sv) | |
slice & | assign (const void *ptr, size_t bytes) |
slice & | assign (const slice &src) noexcept |
slice & | assign (const ::MDBX_val &src) |
slice & | assign (slice &&src) noexcept |
slice & | assign (::MDBX_val &&src) |
slice & | assign (const void *begin, const void *end) |
template<class CHAR , class T , class ALLOCATOR > | |
slice & | assign (const ::std::basic_string< CHAR, T, ALLOCATOR > &str) |
slice & | assign (const char *c_str) |
template<class CHAR , class T > | |
slice & | assign (const ::std::basic_string_view< CHAR, T > &view) |
template<class CHAR , class T > | |
slice & | assign (::std::basic_string_view< CHAR, T > &&view) |
slice & | operator= (const slice &) noexcept=default |
slice & | operator= (slice &&src) noexcept |
slice & | operator= (::MDBX_val &&src) |
template<class CHAR , class T > | |
slice & | operator= (const ::std::basic_string_view< CHAR, T > &view) |
template<class CHAR , class T > | |
slice & | operator= (::std::basic_string_view< CHAR, T > &&view) |
template<class CHAR = char, class T = ::std::char_traits<CHAR>> | |
::std::basic_string_view< CHAR, T > | string_view () const noexcept |
Return a string_view that references the same data as this slice. More... | |
template<class CHAR , class T > | |
operator::std::basic_string_view () const noexcept | |
Return a string_view that references the same data as this slice. More... | |
template<class CHAR = char, class T = ::std::char_traits<CHAR>, class ALLOCATOR = legacy_allocator> | |
::std::basic_string< CHAR, T, ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
template<class CHAR , class T , class ALLOCATOR > | |
operator::std::basic_string () const | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_hex_string (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a hexadecimal dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_base58_string (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a Base58 dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_base64_string (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a Base58 dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | encode_hex (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a hexadecimal dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | encode_base58 (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a Base58 dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | encode_base64 (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a Base64 dump of the slice content. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | hex_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes hexadecimal dump from the slice content to returned buffer. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | base58_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base58 dump from the slice content to returned buffer. More... | |
template<class ALLOCATOR = legacy_allocator, class CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | base64_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base64 dump from the slice content to returned buffer. More... | |
bool | is_printable (bool disable_utf8=false) const noexcept |
Checks whether the content of the slice is printable. More... | |
bool | is_hex (bool ignore_spaces=false) const noexcept |
Checks whether the content of the slice is a hexadecimal dump. More... | |
bool | is_base58 (bool ignore_spaces=false) const noexcept |
Checks whether the content of the slice is a Base58 dump. More... | |
bool | is_base64 (bool ignore_spaces=false) const noexcept |
Checks whether the content of the slice is a Base64 dump. More... | |
void | swap (slice &other) noexcept |
template<class CHAR , class T > | |
void | swap (::std::basic_string_view< CHAR, T > &view) noexcept |
const byte * | byte_ptr () const noexcept |
Returns casted to pointer to byte an address of data. More... | |
byte * | byte_ptr () noexcept |
const byte * | end_byte_ptr () const noexcept |
Returns casted to pointer to byte an end of data. More... | |
byte * | end_byte_ptr () noexcept |
const char * | char_ptr () const noexcept |
Returns casted to pointer to char an address of data. More... | |
char * | char_ptr () noexcept |
const char * | end_char_ptr () const noexcept |
Returns casted to pointer to char an end of data. More... | |
char * | end_char_ptr () noexcept |
const void * | data () const noexcept |
Return a pointer to the beginning of the referenced data. More... | |
void * | data () noexcept |
const void * | end () const noexcept |
Return a pointer to the ending of the referenced data. More... | |
void * | end () noexcept |
size_t | length () const noexcept |
Returns the number of bytes. More... | |
slice & | set_length (size_t bytes) |
Set slice length. More... | |
slice & | set_end (const void *ptr) |
Sets the length by specifying the end of the slice data. More... | |
bool | empty () const noexcept |
Checks whether the slice is empty. More... | |
bool | is_null () const noexcept |
Checks whether the slice data pointer is nullptr. More... | |
size_t | size () const noexcept |
Returns the number of bytes. More... | |
void | invalidate () noexcept |
Depletes content of slice and make it invalid. More... | |
void | clear () noexcept |
Makes the slice empty and referencing to nothing. More... | |
void | remove_prefix (size_t n) noexcept |
Drops the first "n" bytes from this slice. More... | |
void | remove_suffix (size_t n) noexcept |
Drops the last "n" bytes from this slice. More... | |
void | safe_remove_prefix (size_t n) |
Drops the first "n" bytes from this slice. More... | |
void | safe_remove_suffix (size_t n) |
Drops the last "n" bytes from this slice. More... | |
bool | starts_with (const slice &prefix) const noexcept |
Checks if the data starts with the given prefix. More... | |
bool | ends_with (const slice &suffix) const noexcept |
Checks if the data ends with the given suffix. More... | |
byte | operator[] (size_t n) const noexcept |
Returns the nth byte in the referenced data. More... | |
byte | at (size_t n) const |
Returns the nth byte in the referenced data with bounds checking. More... | |
slice | head (size_t n) const noexcept |
Returns the first "n" bytes of the slice. More... | |
slice | tail (size_t n) const noexcept |
Returns the last "n" bytes of the slice. More... | |
slice | middle (size_t from, size_t n) const noexcept |
Returns the middle "n" bytes of the slice. More... | |
slice | safe_head (size_t n) const |
Returns the first "n" bytes of the slice. More... | |
slice | safe_tail (size_t n) const |
Returns the last "n" bytes of the slice. More... | |
slice | safe_middle (size_t from, size_t n) const |
Returns the middle "n" bytes of the slice. More... | |
size_t | hash_value () const noexcept |
Returns the hash value of referenced data. More... | |
bool | is_valid () const noexcept |
Checks the slice is not refers to null address or has zero length. More... | |
Static Public Member Functions | |
template<size_t SIZE> | |
static slice | wrap (const char(&text)[SIZE]) |
template<typename POD > | |
static slice | wrap (const POD &pod) |
static intptr_t | compare_fast (const slice &a, const slice &b) noexcept |
Three-way fast non-lexicographically length-based comparison. More... | |
static intptr_t | compare_lexicographically (const slice &a, const slice &b) noexcept |
Three-way lexicographically comparison. More... | |
static slice | invalid () noexcept |
Build an invalid slice which non-zero length and refers to null address. More... | |
Protected Member Functions | |
slice (size_t invalid_length) noexcept | |
Friends | |
bool | operator== (const slice &a, const slice &b) noexcept |
bool | operator< (const slice &a, const slice &b) noexcept |
bool | operator> (const slice &a, const slice &b) noexcept |
bool | operator<= (const slice &a, const slice &b) noexcept |
bool | operator>= (const slice &a, const slice &b) noexcept |
bool | operator!= (const slice &a, const slice &b) noexcept |
|
inline |
Create a slice that refers to text[0,strlen(text)-1].
|
inlineexplicit |
Create a slice that refers to the contents of "str".
|
defaultnoexcept |
|
inline |
Create a slice that refers to the same contents as "string_view".
|
inline |
|
inlineprotectednoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticnoexcept |
Build an invalid slice which non-zero length and refers to null address.
|
noexcept |
Checks whether the content of the slice is printable.
[in] | disable_utf8 | By default if disable_utf8 is false function checks that content bytes are printable ASCII-7 characters or a valid UTF8 sequences. Otherwise, if if disable_utf8 is true function checks that content bytes are printable extended 8-bit ASCII codes. |
|
inlinenoexcept |
Checks the slice is not refers to null address or has zero length.
|
inlineexplicit |
|
inlineexplicitnoexcept |
Return a string_view that references the same data as this slice.
|
inline |
|
inline |
|
inlinenoexcept |
Return a string_view that references the same data as this slice.
|
inlinenoexcept |
|
inlinestatic |
|
inlinestatic |
struct mdbx::default_capacity_policy |
Public Types | |
enum | : size_t { extra_inplace_storage = 0 , pettiness_threshold = 64 , max_reserve = 65536 } |
Static Public Member Functions | |
static size_t | round (const size_t value) |
static size_t | advise (const size_t current, const size_t wanna) |
|
inlinestatic |
|
inlinestatic |
struct mdbx::to_hex |
Hexadecimal encoder which satisfy SliceTranscoder concept.
Public Member Functions | |
to_hex (const slice &source, bool uppercase=false, unsigned wrap_width=0) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a hexadecimal dump of a passed slice. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a hexadecimal dump of a passed slice. More... | |
size_t | envisage_result_length () const noexcept |
Returns the buffer size in bytes needed for hexadecimal dump of a passed slice. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the buffer by hexadecimal dump of a passed slice. More... | |
::std::ostream & | output (::std::ostream &out) const |
Output hexadecimal dump of passed slice to the std::ostream. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not. More... | |
Public Attributes | |
const slice | source |
const bool | uppercase = false |
const unsigned | wrap_width = 0 |
|
inlinenoexcept |
|
inline |
Returns a buffer with a hexadecimal dump of a passed slice.
|
inline |
Returns a string with a hexadecimal dump of a passed slice.
|
inlinenoexcept |
Returns the buffer size in bytes needed for hexadecimal dump of a passed slice.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
inlinenoexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.
::std::ostream& mdbx::to_hex::output | ( | ::std::ostream & | out | ) | const |
Output hexadecimal dump of passed slice to the std::ostream.
std::ios_base::failure | corresponding to std::ostream::write() behaviour. |
char* mdbx::to_hex::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the buffer by hexadecimal dump of a passed slice.
std::length_error | if given buffer is too small. |
const slice mdbx::to_hex::source |
const bool mdbx::to_hex::uppercase = false |
const unsigned mdbx::to_hex::wrap_width = 0 |
struct mdbx::to_base58 |
Base58 encoder which satisfy SliceTranscoder concept.
Public Member Functions | |
to_base58 (const slice &source, unsigned wrap_width=0) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a Base58 dump of a passed slice. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a Base58 dump of a passed slice. More... | |
size_t | envisage_result_length () const noexcept |
Returns the buffer size in bytes needed for Base58 dump of passed slice. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the buffer by Base58 dump of passed slice. More... | |
::std::ostream & | output (::std::ostream &out) const |
Output Base58 dump of passed slice to the std::ostream. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not. More... | |
Public Attributes | |
const slice | source |
const unsigned | wrap_width = 0 |
|
inlinenoexcept |
|
inline |
Returns a buffer with a Base58 dump of a passed slice.
|
inline |
Returns a string with a Base58 dump of a passed slice.
|
inlinenoexcept |
Returns the buffer size in bytes needed for Base58 dump of passed slice.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
inlinenoexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.
::std::ostream& mdbx::to_base58::output | ( | ::std::ostream & | out | ) | const |
Output Base58 dump of passed slice to the std::ostream.
std::ios_base::failure | corresponding to std::ostream::write() behaviour. |
char* mdbx::to_base58::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the buffer by Base58 dump of passed slice.
std::length_error | if given buffer is too small. |
const slice mdbx::to_base58::source |
const unsigned mdbx::to_base58::wrap_width = 0 |
struct mdbx::to_base64 |
Base64 encoder which satisfy SliceTranscoder concept.
Public Member Functions | |
to_base64 (const slice &source, unsigned wrap_width=0) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a string with a Base64 dump of a passed slice. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Returns a buffer with a Base64 dump of a passed slice. More... | |
size_t | envisage_result_length () const noexcept |
Returns the buffer size in bytes needed for Base64 dump of passed slice. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the buffer by Base64 dump of passed slice. More... | |
::std::ostream & | output (::std::ostream &out) const |
Output Base64 dump of passed slice to the std::ostream. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not. More... | |
Public Attributes | |
const slice | source |
const unsigned | wrap_width = 0 |
|
inlinenoexcept |
|
inline |
Returns a buffer with a Base64 dump of a passed slice.
|
inline |
Returns a string with a Base64 dump of a passed slice.
|
inlinenoexcept |
Returns the buffer size in bytes needed for Base64 dump of passed slice.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
inlinenoexcept |
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.
::std::ostream& mdbx::to_base64::output | ( | ::std::ostream & | out | ) | const |
Output Base64 dump of passed slice to the std::ostream.
std::ios_base::failure | corresponding to std::ostream::write() behaviour. |
char* mdbx::to_base64::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the buffer by Base64 dump of passed slice.
std::length_error | if given buffer is too small. |
const slice mdbx::to_base64::source |
const unsigned mdbx::to_base64::wrap_width = 0 |
struct mdbx::from_hex |
Hexadecimal decoder which satisfy SliceTranscoder concept.
Public Member Functions | |
from_hex (const slice &source, bool ignore_spaces=false) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes hexadecimal dump from a passed slice to returned string. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes hexadecimal dump from a passed slice to returned buffer. More... | |
size_t | envisage_result_length () const noexcept |
Returns the number of bytes needed for conversion hexadecimal dump from a passed slice to decoded data. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the destination with data decoded from hexadecimal dump from a passed slice. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore there could be decoded or not. More... | |
Public Attributes | |
const slice | source |
const bool | ignore_spaces = false |
|
inlinenoexcept |
|
inline |
Decodes hexadecimal dump from a passed slice to returned buffer.
|
inline |
Decodes hexadecimal dump from a passed slice to returned string.
|
inlinenoexcept |
Returns the number of bytes needed for conversion hexadecimal dump from a passed slice to decoded data.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
noexcept |
Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore there could be decoded or not.
char* mdbx::from_hex::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the destination with data decoded from hexadecimal dump from a passed slice.
std::length_error | if given buffer is too small. |
const bool mdbx::from_hex::ignore_spaces = false |
const slice mdbx::from_hex::source |
struct mdbx::from_base58 |
Base58 decoder which satisfy SliceTranscoder concept.
Public Member Functions | |
from_base58 (const slice &source, bool ignore_spaces=false) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base58 dump from a passed slice to returned string. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base58 dump from a passed slice to returned buffer. More... | |
size_t | envisage_result_length () const noexcept |
Returns the number of bytes needed for conversion Base58 dump from a passed slice to decoded data. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the destination with data decoded from Base58 dump from a passed slice. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid Base58 dump, and therefore there could be decoded or not. More... | |
Public Attributes | |
const slice | source |
const bool | ignore_spaces = false |
|
inlinenoexcept |
|
inline |
Decodes Base58 dump from a passed slice to returned buffer.
|
inline |
Decodes Base58 dump from a passed slice to returned string.
|
inlinenoexcept |
Returns the number of bytes needed for conversion Base58 dump from a passed slice to decoded data.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
noexcept |
Checks whether the content of a passed slice is a valid Base58 dump, and therefore there could be decoded or not.
char* mdbx::from_base58::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the destination with data decoded from Base58 dump from a passed slice.
std::length_error | if given buffer is too small. |
const bool mdbx::from_base58::ignore_spaces = false |
const slice mdbx::from_base58::source |
struct mdbx::from_base64 |
Base64 decoder which satisfy SliceTranscoder concept.
Public Member Functions | |
from_base64 (const slice &source, bool ignore_spaces=false) noexcept | |
template<class ALLOCATOR = legacy_allocator> | |
string< ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base64 dump from a passed slice to returned string. More... | |
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy> | |
buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR &allocator=ALLOCATOR()) const |
Decodes Base64 dump from a passed slice to returned buffer. More... | |
size_t | envisage_result_length () const noexcept |
Returns the number of bytes needed for conversion Base64 dump from a passed slice to decoded data. More... | |
char * | write_bytes (char *dest, size_t dest_size) const |
Fills the destination with data decoded from Base64 dump from a passed slice. More... | |
bool | is_empty () const noexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes. More... | |
bool | is_erroneous () const noexcept |
Checks whether the content of a passed slice is a valid Base64 dump, and therefore there could be decoded or not. More... | |
Public Attributes | |
const slice | source |
const bool | ignore_spaces = false |
|
inlinenoexcept |
|
inline |
Decodes Base64 dump from a passed slice to returned buffer.
|
inline |
Decodes Base64 dump from a passed slice to returned string.
|
inlinenoexcept |
Returns the number of bytes needed for conversion Base64 dump from a passed slice to decoded data.
|
inlinenoexcept |
Checks whether a passed slice is empty, and therefore there will be no output bytes.
|
noexcept |
Checks whether the content of a passed slice is a valid Base64 dump, and therefore there could be decoded or not.
char* mdbx::from_base64::write_bytes | ( | char * | dest, |
size_t | dest_size | ||
) | const |
Fills the destination with data decoded from Base64 dump from a passed slice.
std::length_error | if given buffer is too small. |
const bool mdbx::from_base64::ignore_spaces = false |
const slice mdbx::from_base64::source |
class mdbx::buffer |
The chunk of data stored inside the buffer or located outside it.
Public Types | |
enum | : size_t { max_length = MDBX_MAXDATASIZE , max_capacity = (max_length / 3u * 4u + 1023u) & ~size_t(1023) , extra_inplace_storage = reservation_policy::extra_inplace_storage , pettiness_threshold = reservation_policy::pettiness_threshold } |
using | allocator_type = typename ::std::allocator_traits< ALLOCATOR >::template rebind_alloc< uint64_t > |
using | allocator_traits = ::std::allocator_traits< allocator_type > |
using | reservation_policy = CAPACITY_POLICY |
Public Member Functions | |
allocator_type | get_allocator () const |
Returns the associated allocator. More... | |
bool | is_freestanding () const noexcept |
Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outside the buffer. More... | |
bool | is_reference () const noexcept |
Checks whether the buffer just refers to data located outside the buffer, rather than stores it. More... | |
size_t | capacity () const noexcept |
Returns the number of bytes that can be held in currently allocated storage. More... | |
size_t | headroom () const noexcept |
Returns the number of bytes that available in currently allocated storage ahead the currently beginning of data. More... | |
size_t | tailroom () const noexcept |
Returns the number of bytes that available in currently allocated storage after the currently data end. More... | |
const byte * | byte_ptr () const noexcept |
Returns casted to const pointer to byte an address of data. More... | |
const byte * | end_byte_ptr () const noexcept |
Returns casted to const pointer to byte an end of data. More... | |
byte * | byte_ptr () noexcept |
Returns casted to pointer to byte an address of data. More... | |
byte * | end_byte_ptr () noexcept |
Returns casted to pointer to byte an end of data. More... | |
const char * | char_ptr () const noexcept |
Returns casted to const pointer to char an address of data. More... | |
const char * | end_char_ptr () const noexcept |
Returns casted to const pointer to char an end of data. More... | |
char * | char_ptr () noexcept |
Returns casted to pointer to char an address of data. More... | |
char * | end_char_ptr () noexcept |
Returns casted to pointer to char an end of data. More... | |
const void * | data () const noexcept |
Return a const pointer to the beginning of the referenced data. More... | |
const void * | end () const noexcept |
Return a const pointer to the end of the referenced data. More... | |
void * | data () noexcept |
Return a pointer to the beginning of the referenced data. More... | |
void * | end () noexcept |
Return a pointer to the end of the referenced data. More... | |
size_t | length () const noexcept |
Returns the number of bytes. More... | |
buffer & | set_length (size_t bytes) |
Set length of data. More... | |
buffer & | set_end (const void *ptr) |
Sets the length by specifying the end of the data. More... | |
void | make_freestanding () |
Makes buffer owning the data. More... | |
buffer () noexcept=default | |
buffer (const allocator_type &allocator) noexcept | |
buffer (const struct slice &src, bool make_reference, const allocator_type &allocator=allocator_type()) | |
buffer (const buffer &src, bool make_reference, const allocator_type &allocator=allocator_type()) | |
buffer (const void *ptr, size_t bytes, bool make_reference, const allocator_type &allocator=allocator_type()) | |
template<class CHAR , class T , class A > | |
buffer (const ::std::basic_string< CHAR, T, A > &)=delete | |
template<class CHAR , class T , class A > | |
buffer (const ::std::basic_string< CHAR, T, A > &&)=delete | |
buffer (const char *c_str, bool make_reference, const allocator_type &allocator=allocator_type()) | |
template<class CHAR , class T > | |
buffer (const ::std::basic_string_view< CHAR, T > &view, bool make_reference, const allocator_type &allocator=allocator_type()) | |
buffer (const struct slice &src, const allocator_type &allocator=allocator_type()) | |
buffer (const buffer &src, const allocator_type &allocator=allocator_type()) | |
buffer (const void *ptr, size_t bytes, const allocator_type &allocator=allocator_type()) | |
template<class CHAR , class T , class A > | |
buffer (const ::std::basic_string< CHAR, T, A > &str, const allocator_type &allocator=allocator_type()) | |
buffer (const char *c_str, const allocator_type &allocator=allocator_type()) | |
template<class CHAR , class T > | |
buffer (const ::std::basic_string_view< CHAR, T > &view, const allocator_type &allocator=allocator_type()) | |
buffer (size_t head_room, size_t tail_room, const allocator_type &allocator=allocator_type()) | |
buffer (size_t capacity, const allocator_type &allocator=allocator_type()) | |
buffer (size_t head_room, const struct slice &src, size_t tail_room, const allocator_type &allocator=allocator_type()) | |
buffer (size_t head_room, const buffer &src, size_t tail_room, const allocator_type &allocator=allocator_type()) | |
buffer (const ::mdbx::txn &txn, const struct slice &src, const allocator_type &allocator=allocator_type()) | |
buffer (buffer &&src) noexcept(move_assign_alloc::is_nothrow()) | |
const struct slice & | slice () const noexcept |
operator const struct slice & () const noexcept | |
void | reserve (size_t wanna_headroom, size_t wanna_tailroom) |
Reserves storage space. More... | |
void | reserve_headroom (size_t wanna_headroom) |
Reserves space before the payload. More... | |
void | reserve_tailroom (size_t wanna_tailroom) |
Reserves space after the payload. More... | |
buffer & | assign_reference (const void *ptr, size_t bytes) |
buffer & | assign_freestanding (const void *ptr, size_t bytes) |
void | swap (buffer &other) noexcept(swap_alloc::is_nothrow()) |
buffer & | assign (const buffer &src, bool make_reference=false) |
buffer & | assign (const void *ptr, size_t bytes, bool make_reference=false) |
buffer & | assign (const struct slice &src, bool make_reference=false) |
buffer & | assign (const ::MDBX_val &src, bool make_reference=false) |
buffer & | assign (struct slice &&src, bool make_reference=false) |
buffer & | assign (::MDBX_val &&src, bool make_reference=false) |
buffer & | assign (const void *begin, const void *end, bool make_reference=false) |
template<class CHAR , class T , class A > | |
buffer & | assign (const ::std::basic_string< CHAR, T, A > &str, bool make_reference=false) |
buffer & | assign (const char *c_str, bool make_reference=false) |
buffer & | operator= (const buffer &src) |
buffer & | operator= (buffer &&src) noexcept(move_assign_alloc::is_nothrow()) |
buffer & | operator= (const struct slice &src) |
buffer & | operator= (struct slice &&src) |
template<class CHAR , class T > | |
buffer & | operator= (const ::std::basic_string_view< CHAR, T > &view) noexcept |
template<class CHAR = char, class T = ::std::char_traits<CHAR>> | |
::std::basic_string_view< CHAR, T > | string_view () const noexcept |
Return a string_view that references the data of this buffer. More... | |
template<class CHAR , class T > | |
operator::std::basic_string_view () const noexcept | |
Return a string_view that references the data of this buffer. More... | |
bool | empty () const noexcept |
Checks whether the string is empty. More... | |
bool | is_null () const noexcept |
Checks whether the data pointer of the buffer is nullptr. More... | |
size_t | size () const noexcept |
Returns the number of bytes. More... | |
size_t | hash_value () const noexcept |
Returns the hash value of the data. More... | |
template<class CHAR = char, class T = ::std::char_traits<CHAR>, class A = legacy_allocator> | |
::std::basic_string< CHAR, T, A > | as_string (const A &allocator=A()) const |
template<class CHAR , class T , class A > | |
operator::std::basic_string () const | |
bool | starts_with (const struct slice &prefix) const noexcept |
Checks if the data starts with the given prefix. More... | |
bool | ends_with (const struct slice &suffix) const noexcept |
Checks if the data ends with the given suffix. More... | |
void | clear () noexcept |
Clears the contents and storage. More... | |
void | shrink_to_fit () |
Reduces memory usage by freeing unused storage space. More... | |
void | remove_prefix (size_t n) noexcept |
Drops the first "n" bytes from the data chunk. More... | |
void | remove_suffix (size_t n) noexcept |
Drops the last "n" bytes from the data chunk. More... | |
void | safe_remove_prefix (size_t n) |
Drops the first "n" bytes from the data chunk. More... | |
void | safe_remove_suffix (size_t n) |
Drops the last "n" bytes from the data chunk. More... | |
byte | operator[] (size_t n) const noexcept |
Accesses the specified byte of data chunk. More... | |
byte & | operator[] (size_t n) noexcept |
Accesses the specified byte of data chunk. More... | |
byte | at (size_t n) const |
Accesses the specified byte of data chunk with bounds checking. More... | |
byte & | at (size_t n) |
Accesses the specified byte of data chunk with bounds checking. More... | |
struct slice | head (size_t n) const noexcept |
Returns the first "n" bytes of the data chunk. More... | |
struct slice | tail (size_t n) const noexcept |
Returns the last "n" bytes of the data chunk. More... | |
struct slice | middle (size_t from, size_t n) const noexcept |
Returns the middle "n" bytes of the data chunk. More... | |
struct slice | safe_head (size_t n) const |
Returns the first "n" bytes of the data chunk. More... | |
struct slice | safe_tail (size_t n) const |
Returns the last "n" bytes of the data chunk. More... | |
struct slice | safe_middle (size_t from, size_t n) const |
Returns the middle "n" bytes of the data chunk. More... | |
buffer & | append (const void *src, size_t bytes) |
buffer & | append (const struct slice &chunk) |
buffer & | add_header (const void *src, size_t bytes) |
buffer & | add_header (const struct slice &chunk) |
template<MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) > | |
buffer & | append_producer (PRODUCER &producer) |
template<MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) > | |
buffer & | append_producer (const PRODUCER &producer) |
buffer & | append_hex (const struct slice &data, bool uppercase=false, unsigned wrap_width=0) |
buffer & | append_base58 (const struct slice &data, unsigned wrap_width=0) |
buffer & | append_base64 (const struct slice &data, unsigned wrap_width=0) |
buffer & | append_decoded_hex (const struct slice &data, bool ignore_spaces=false) |
buffer & | append_decoded_base58 (const struct slice &data, bool ignore_spaces=false) |
buffer & | append_decoded_base64 (const struct slice &data, bool ignore_spaces=false) |
template<class ALLOCATOR , typename CAPACITY_POLICY > | |
buffer (const txn &txn, const struct slice &src, const allocator_type &allocator) | |
Static Public Member Functions | |
template<typename POD > | |
static buffer | wrap (const POD &pod, bool make_reference=false, const allocator_type &allocator=allocator_type()) |
static buffer | clone (const buffer &src, const allocator_type &allocator=allocator_type()) |
template<size_t SIZE> | |
static buffer | key_from (const char(&text)[SIZE], bool make_reference=true) |
template<class CHAR , class T > | |
static buffer | key_from (const ::std::basic_string_view< CHAR, T > &src, bool make_reference=false) |
static buffer | key_from (const char *src, bool make_reference=false) |
template<class CHAR , class T , class A > | |
static buffer | key_from (const ::std::basic_string< CHAR, T, A > &src, bool make_reference=false) |
static buffer | key_from (const silo &&src) noexcept |
static buffer | key_from (const double ieee754_64bit) |
static buffer | key_from (const double *ieee754_64bit) |
static buffer | key_from (const uint64_t unsigned_int64) |
static buffer | key_from (const int64_t signed_int64) |
static buffer | key_from_jsonInteger (const int64_t json_integer) |
static buffer | key_from (const float ieee754_32bit) |
static buffer | key_from (const float *ieee754_32bit) |
static buffer | key_from (const uint32_t unsigned_int32) |
static buffer | key_from (const int32_t signed_int32) |
Friends | |
class | txn |
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_traits = ::std::allocator_traits<allocator_type> |
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type = typename ::std::allocator_traits< ALLOCATOR>::template rebind_alloc<uint64_t> |
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reservation_policy = CAPACITY_POLICY |
anonymous enum : size_t |
|
defaultnoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
delete |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Accesses the specified byte of data chunk with bounds checking.
std::out_of_range | if n >= size() |
|
inline |
Accesses the specified byte of data chunk with bounds checking.
std::out_of_range | if n >= size() |
|
inlinenoexcept |
Returns casted to const pointer to byte an address of data.
|
inlinenoexcept |
Returns casted to pointer to byte an address of data.
|
inlinenoexcept |
Returns the number of bytes that can be held in currently allocated storage.
|
inlinenoexcept |
Returns casted to const pointer to char an address of data.
|
inlinenoexcept |
Returns casted to pointer to char an address of data.
|
inlinenoexcept |
Clears the contents and storage.
|
inlinestatic |
|
inlinenoexcept |
Return a const pointer to the beginning of the referenced data.
|
inlinenoexcept |
Return a pointer to the beginning of the referenced data.
|
inlinenoexcept |
Checks whether the string is empty.
|
inlinenoexcept |
Return a const pointer to the end of the referenced data.
|
inlinenoexcept |
Return a pointer to the end of the referenced data.
|
inlinenoexcept |
Returns casted to const pointer to byte an end of data.
|
inlinenoexcept |
Returns casted to pointer to byte an end of data.
|
inlinenoexcept |
Returns casted to const pointer to char an end of data.
|
inlinenoexcept |
Returns casted to pointer to char an end of data.
|
inlinenoexcept |
Checks if the data ends with the given suffix.
|
inline |
Returns the associated allocator.
|
inlinenoexcept |
Returns the hash value of the data.
|
inlinenoexcept |
Returns the first "n" bytes of the data chunk.
n <= size()
|
inlinenoexcept |
Returns the number of bytes that available in currently allocated storage ahead the currently beginning of data.
|
inlinenoexcept |
Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outside the buffer.
|
inlinenoexcept |
Checks whether the data pointer of the buffer is nullptr.
|
inlinenoexcept |
Checks whether the buffer just refers to data located outside the buffer, rather than stores it.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestaticnoexcept |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinenoexcept |
Returns the number of bytes.
|
inline |
Makes buffer owning the data.
If buffer refers to an external data, then makes it the owner of clone by allocating storage and copying the data.
|
inlinenoexcept |
Returns the middle "n" bytes of the data chunk.
from + n <= size()
|
inlinenoexcept |
|
inlineexplicit |
|
inlinenoexcept |
Return a string_view that references the data of this buffer.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Accesses the specified byte of data chunk.
n < size()
|
inlinenoexcept |
Accesses the specified byte of data chunk.
n < size()
|
inlinenoexcept |
Drops the first "n" bytes from the data chunk.
n <= size()
|
inlinenoexcept |
Drops the last "n" bytes from the data chunk.
n <= size()
|
inline |
Reserves storage space.
|
inline |
Reserves space before the payload.
|
inline |
Reserves space after the payload.
|
inline |
Returns the first "n" bytes of the data chunk.
std::out_of_range | if n >= size() |
|
inline |
Returns the middle "n" bytes of the data chunk.
std::out_of_range | if from + n >= size() |
|
inline |
Drops the first "n" bytes from the data chunk.
std::out_of_range | if n > size() |
|
inline |
Drops the last "n" bytes from the data chunk.
std::out_of_range | if n > size() |
|
inline |
Returns the last "n" bytes of the data chunk.
std::out_of_range | if n >= size() |
|
inline |
Sets the length by specifying the end of the data.
|
inline |
Set length of data.
|
inline |
Reduces memory usage by freeing unused storage space.
|
inlinenoexcept |
Returns the number of bytes.
|
inlinenoexcept |
|
inlinenoexcept |
Checks if the data starts with the given prefix.
|
inlinenoexcept |
Return a string_view that references the data of this buffer.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the last "n" bytes of the data chunk.
n <= size()
|
inlinenoexcept |
Returns the number of bytes that available in currently allocated storage after the currently data end.
|
inlinestatic |
|
friend |
struct mdbx::value_result |
Combines data slice with boolean flag to represent result of certain operations.
Public Member Functions | |
value_result (const slice &value, bool done) noexcept | |
value_result (const value_result &) noexcept=default | |
value_result & | operator= (const value_result &) noexcept=default |
Public Attributes | |
slice | value |
bool | done |
|
inlinenoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
bool mdbx::value_result::done |
slice mdbx::value_result::value |
struct mdbx::pair |
Combines pair of slices for key and value to represent result of certain operations.
Inherited by mdbx::pair_result.
Public Member Functions | |
pair (const slice &key, const slice &value) noexcept | |
pair (const pair &) noexcept=default | |
pair & | operator= (const pair &) noexcept=default |
Public Attributes | |
slice | key |
slice | value |
|
defaultnoexcept |
slice mdbx::pair::key |
slice mdbx::pair::value |
struct mdbx::pair_result |
Combines pair of slices for key and value with boolean flag to represent result of certain operations.
Inherits mdbx::pair.
Inherited by mdbx::cursor::move_result.
Public Member Functions | |
pair_result (const slice &key, const slice &value, bool done) noexcept | |
pair_result (const pair_result &) noexcept=default | |
pair_result & | operator= (const pair_result &) noexcept=default |
![]() | |
pair (const slice &key, const slice &value) noexcept | |
pair (const pair &) noexcept=default | |
pair & | operator= (const pair &) noexcept=default |
Public Attributes | |
bool | done |
![]() | |
slice | key |
slice | value |
|
defaultnoexcept |
|
defaultnoexcept |
bool mdbx::pair_result::done |
|
inline |
|
inline |
|
inline |
|
inline |
inline ::std::ostream& mdbx::operator<< | ( | ::std::ostream & | out, |
const to_base58 & | wrapper | ||
) |
inline ::std::ostream& mdbx::operator<< | ( | ::std::ostream & | out, |
const to_base64 & | wrapper | ||
) |
inline ::std::ostream& mdbx::operator<< | ( | ::std::ostream & | out, |
const to_hex & | wrapper | ||
) |
concept mdbx::ImmutableByteProducer |
concept mdbx::MutableByteProducer |
concept mdbx::SliceTranscoder |