libmdbx  0.11.9.0 (2022-08-02T12:00:30+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
slices and buffers

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
 

Detailed Description


Class Documentation

◆ mdbx::slice

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.

See also
mdbx::slice
mdbx::buffer

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.

Note
The notable difference between MDBX and LMDB is that MDBX support zero length keys.

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)
 
sliceassign (const void *ptr, size_t bytes)
 
sliceassign (const slice &src) noexcept
 
sliceassign (const ::MDBX_val &src)
 
sliceassign (slice &&src) noexcept
 
sliceassign (::MDBX_val &&src)
 
sliceassign (const void *begin, const void *end)
 
template<class CHAR , class T , class ALLOCATOR >
sliceassign (const ::std::basic_string< CHAR, T, ALLOCATOR > &str)
 
sliceassign (const char *c_str)
 
template<class CHAR , class T >
sliceassign (const ::std::basic_string_view< CHAR, T > &view)
 
template<class CHAR , class T >
sliceassign (::std::basic_string_view< CHAR, T > &&view)
 
sliceoperator= (const slice &) noexcept=default
 
sliceoperator= (slice &&src) noexcept
 
sliceoperator= (::MDBX_val &&src)
 
template<class CHAR , class T >
sliceoperator= (const ::std::basic_string_view< CHAR, T > &view)
 
template<class CHAR , class T >
sliceoperator= (::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 bytebyte_ptr () const noexcept
 Returns casted to pointer to byte an address of data. More...
 
bytebyte_ptr () noexcept
 
const byteend_byte_ptr () const noexcept
 Returns casted to pointer to byte an end of data. More...
 
byteend_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...
 
sliceset_length (size_t bytes)
 Set slice length. More...
 
sliceset_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
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
max_length 

Constructor & Destructor Documentation

◆ slice() [1/6]

template<size_t SIZE>
mdbx::slice::slice ( const char(&)  text[SIZE])
inline

Create a slice that refers to text[0,strlen(text)-1].

◆ slice() [2/6]

template<class CHAR , class T , class A >
mdbx::slice::slice ( const ::std::basic_string< CHAR, T, A > &  str)
inlineexplicit

Create a slice that refers to the contents of "str".

Note
'explicit' to avoid reference to the temporary std::string instance.

◆ slice() [3/6]

mdbx::slice::slice ( const slice )
defaultnoexcept

◆ slice() [4/6]

template<class CHAR , class T >
mdbx::slice::slice ( const ::std::basic_string_view< CHAR, T > &  sv)
inline

Create a slice that refers to the same contents as "string_view".

◆ slice() [5/6]

template<class CHAR , class T >
mdbx::slice::slice ( ::std::basic_string_view< CHAR, T > &&  sv)
inline

◆ slice() [6/6]

mdbx::slice::slice ( size_t  invalid_length)
inlineprotectednoexcept

Member Function Documentation

◆ as_string()

template<class CHAR = char, class T = ::std::char_traits<CHAR>, class ALLOCATOR = legacy_allocator>
::std::basic_string<CHAR, T, ALLOCATOR> mdbx::slice::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

◆ assign() [1/3]

template<class CHAR , class T >
slice& mdbx::slice::assign ( ::std::basic_string_view< CHAR, T > &&  view)
inline

◆ assign() [2/3]

template<class CHAR , class T , class ALLOCATOR >
slice& mdbx::slice::assign ( const ::std::basic_string< CHAR, T, ALLOCATOR > &  str)
inline

◆ assign() [3/3]

template<class CHAR , class T >
slice& mdbx::slice::assign ( const ::std::basic_string_view< CHAR, T > &  view)
inline

◆ invalid()

static slice mdbx::slice::invalid ( )
inlinestaticnoexcept

Build an invalid slice which non-zero length and refers to null address.

◆ is_printable()

bool mdbx::slice::is_printable ( bool  disable_utf8 = false) const
noexcept

Checks whether the content of the slice is printable.

Parameters
[in]disable_utf8By 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.

◆ is_valid()

bool mdbx::slice::is_valid ( ) const
inlinenoexcept

Checks the slice is not refers to null address or has zero length.

◆ operator::std::basic_string()

template<class CHAR , class T , class ALLOCATOR >
mdbx::slice::operator::std::basic_string ( ) const
inlineexplicit

◆ operator::std::basic_string_view()

template<class CHAR , class T >
mdbx::slice::operator::std::basic_string_view ( ) const
inlineexplicitnoexcept

Return a string_view that references the same data as this slice.

◆ operator=() [1/3]

template<class CHAR , class T >
slice& mdbx::slice::operator= ( ::std::basic_string_view< CHAR, T > &&  view)
inline

◆ operator=() [2/3]

template<class CHAR , class T >
slice& mdbx::slice::operator= ( const ::std::basic_string_view< CHAR, T > &  view)
inline

◆ operator=() [3/3]

slice& mdbx::slice::operator= ( const slice )
defaultnoexcept

◆ string_view()

template<class CHAR = char, class T = ::std::char_traits<CHAR>>
::std::basic_string_view<CHAR, T> mdbx::slice::string_view ( ) const
inlinenoexcept

Return a string_view that references the same data as this slice.

◆ swap()

template<class CHAR , class T >
void mdbx::slice::swap ( ::std::basic_string_view< CHAR, T > &  view)
inlinenoexcept

◆ wrap() [1/2]

template<size_t SIZE>
static slice mdbx::slice::wrap ( const char(&)  text[SIZE])
inlinestatic

◆ wrap() [2/2]

template<typename POD >
static slice mdbx::slice::wrap ( const POD &  pod)
inlinestatic

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const slice a,
const slice b 
)
friend

◆ operator<

bool operator< ( const slice a,
const slice b 
)
friend

◆ operator<=

bool operator<= ( const slice a,
const slice b 
)
friend

◆ operator==

bool operator== ( const slice a,
const slice b 
)
friend

◆ operator>

bool operator> ( const slice a,
const slice b 
)
friend

◆ operator>=

bool operator>= ( const slice a,
const slice b 
)
friend

◆ mdbx::default_capacity_policy

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)
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : size_t
Enumerator
extra_inplace_storage 
pettiness_threshold 
max_reserve 

Member Function Documentation

◆ advise()

static size_t mdbx::default_capacity_policy::advise ( const size_t  current,
const size_t  wanna 
)
inlinestatic

◆ round()

static size_t mdbx::default_capacity_policy::round ( const size_t  value)
inlinestatic

◆ mdbx::to_hex

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
 

Constructor & Destructor Documentation

◆ to_hex()

mdbx::to_hex::to_hex ( const slice source,
bool  uppercase = false,
unsigned  wrap_width = 0 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::to_hex::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a buffer with a hexadecimal dump of a passed slice.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::to_hex::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a string with a hexadecimal dump of a passed slice.

◆ envisage_result_length()

size_t mdbx::to_hex::envisage_result_length ( ) const
inlinenoexcept

Returns the buffer size in bytes needed for hexadecimal dump of a passed slice.

◆ is_empty()

bool mdbx::to_hex::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::to_hex::is_erroneous ( ) const
inlinenoexcept

Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.

◆ output()

::std::ostream& mdbx::to_hex::output ( ::std::ostream &  out) const

Output hexadecimal dump of passed slice to the std::ostream.

Exceptions
std::ios_base::failurecorresponding to std::ostream::write() behaviour.

◆ write_bytes()

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

Fills the buffer by hexadecimal dump of a passed slice.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ source

const slice mdbx::to_hex::source

◆ uppercase

const bool mdbx::to_hex::uppercase = false

◆ wrap_width

const unsigned mdbx::to_hex::wrap_width = 0

◆ mdbx::to_base58

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
 

Constructor & Destructor Documentation

◆ to_base58()

mdbx::to_base58::to_base58 ( const slice source,
unsigned  wrap_width = 0 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::to_base58::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a buffer with a Base58 dump of a passed slice.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::to_base58::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a string with a Base58 dump of a passed slice.

◆ envisage_result_length()

size_t mdbx::to_base58::envisage_result_length ( ) const
inlinenoexcept

Returns the buffer size in bytes needed for Base58 dump of passed slice.

◆ is_empty()

bool mdbx::to_base58::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::to_base58::is_erroneous ( ) const
inlinenoexcept

Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.

◆ output()

::std::ostream& mdbx::to_base58::output ( ::std::ostream &  out) const

Output Base58 dump of passed slice to the std::ostream.

Exceptions
std::ios_base::failurecorresponding to std::ostream::write() behaviour.

◆ write_bytes()

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

Fills the buffer by Base58 dump of passed slice.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ source

const slice mdbx::to_base58::source

◆ wrap_width

const unsigned mdbx::to_base58::wrap_width = 0

◆ mdbx::to_base64

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
 

Constructor & Destructor Documentation

◆ to_base64()

mdbx::to_base64::to_base64 ( const slice source,
unsigned  wrap_width = 0 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::to_base64::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a buffer with a Base64 dump of a passed slice.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::to_base64::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Returns a string with a Base64 dump of a passed slice.

◆ envisage_result_length()

size_t mdbx::to_base64::envisage_result_length ( ) const
inlinenoexcept

Returns the buffer size in bytes needed for Base64 dump of passed slice.

◆ is_empty()

bool mdbx::to_base64::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::to_base64::is_erroneous ( ) const
inlinenoexcept

Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not.

◆ output()

::std::ostream& mdbx::to_base64::output ( ::std::ostream &  out) const

Output Base64 dump of passed slice to the std::ostream.

Exceptions
std::ios_base::failurecorresponding to std::ostream::write() behaviour.

◆ write_bytes()

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

Fills the buffer by Base64 dump of passed slice.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ source

const slice mdbx::to_base64::source

◆ wrap_width

const unsigned mdbx::to_base64::wrap_width = 0

◆ mdbx::from_hex

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
 

Constructor & Destructor Documentation

◆ from_hex()

mdbx::from_hex::from_hex ( const slice source,
bool  ignore_spaces = false 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::from_hex::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes hexadecimal dump from a passed slice to returned buffer.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::from_hex::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes hexadecimal dump from a passed slice to returned string.

◆ envisage_result_length()

size_t mdbx::from_hex::envisage_result_length ( ) const
inlinenoexcept

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

◆ is_empty()

bool mdbx::from_hex::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::from_hex::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.

◆ write_bytes()

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.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ ignore_spaces

const bool mdbx::from_hex::ignore_spaces = false

◆ source

const slice mdbx::from_hex::source

◆ mdbx::from_base58

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
 

Constructor & Destructor Documentation

◆ from_base58()

mdbx::from_base58::from_base58 ( const slice source,
bool  ignore_spaces = false 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::from_base58::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes Base58 dump from a passed slice to returned buffer.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::from_base58::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes Base58 dump from a passed slice to returned string.

◆ envisage_result_length()

size_t mdbx::from_base58::envisage_result_length ( ) const
inlinenoexcept

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

◆ is_empty()

bool mdbx::from_base58::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::from_base58::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.

◆ write_bytes()

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.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ ignore_spaces

const bool mdbx::from_base58::ignore_spaces = false

◆ source

const slice mdbx::from_base58::source

◆ mdbx::from_base64

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
 

Constructor & Destructor Documentation

◆ from_base64()

mdbx::from_base64::from_base64 ( const slice source,
bool  ignore_spaces = false 
)
inlinenoexcept

Member Function Documentation

◆ as_buffer()

template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy>
buffer<ALLOCATOR, CAPACITY_POLICY> mdbx::from_base64::as_buffer ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes Base64 dump from a passed slice to returned buffer.

◆ as_string()

template<class ALLOCATOR = legacy_allocator>
string<ALLOCATOR> mdbx::from_base64::as_string ( const ALLOCATOR &  allocator = ALLOCATOR()) const
inline

Decodes Base64 dump from a passed slice to returned string.

◆ envisage_result_length()

size_t mdbx::from_base64::envisage_result_length ( ) const
inlinenoexcept

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

◆ is_empty()

bool mdbx::from_base64::is_empty ( ) const
inlinenoexcept

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

◆ is_erroneous()

bool mdbx::from_base64::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.

◆ write_bytes()

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.

Exceptions
std::length_errorif given buffer is too small.

Member Data Documentation

◆ ignore_spaces

const bool mdbx::from_base64::ignore_spaces = false

◆ source

const slice mdbx::from_base64::source

◆ mdbx::buffer

class mdbx::buffer

template<class ALLOCATOR, typename CAPACITY_POLICY>
class mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >

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 bytebyte_ptr () const noexcept
 Returns casted to const pointer to byte an address of data. More...
 
const byteend_byte_ptr () const noexcept
 Returns casted to const pointer to byte an end of data. More...
 
bytebyte_ptr () noexcept
 Returns casted to pointer to byte an address of data. More...
 
byteend_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...
 
bufferset_length (size_t bytes)
 Set length of data. More...
 
bufferset_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 sliceslice () 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...
 
bufferassign_reference (const void *ptr, size_t bytes)
 
bufferassign_freestanding (const void *ptr, size_t bytes)
 
void swap (buffer &other) noexcept(swap_alloc::is_nothrow())
 
bufferassign (const buffer &src, bool make_reference=false)
 
bufferassign (const void *ptr, size_t bytes, bool make_reference=false)
 
bufferassign (const struct slice &src, bool make_reference=false)
 
bufferassign (const ::MDBX_val &src, bool make_reference=false)
 
bufferassign (struct slice &&src, bool make_reference=false)
 
bufferassign (::MDBX_val &&src, bool make_reference=false)
 
bufferassign (const void *begin, const void *end, bool make_reference=false)
 
template<class CHAR , class T , class A >
bufferassign (const ::std::basic_string< CHAR, T, A > &str, bool make_reference=false)
 
bufferassign (const char *c_str, bool make_reference=false)
 
bufferoperator= (const buffer &src)
 
bufferoperator= (buffer &&src) noexcept(move_assign_alloc::is_nothrow())
 
bufferoperator= (const struct slice &src)
 
bufferoperator= (struct slice &&src)
 
template<class CHAR , class T >
bufferoperator= (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...
 
byteoperator[] (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...
 
byteat (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...
 
bufferappend (const void *src, size_t bytes)
 
bufferappend (const struct slice &chunk)
 
bufferadd_header (const void *src, size_t bytes)
 
bufferadd_header (const struct slice &chunk)
 
template<MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) >
bufferappend_producer (PRODUCER &producer)
 
template<MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) >
bufferappend_producer (const PRODUCER &producer)
 
bufferappend_hex (const struct slice &data, bool uppercase=false, unsigned wrap_width=0)
 
bufferappend_base58 (const struct slice &data, unsigned wrap_width=0)
 
bufferappend_base64 (const struct slice &data, unsigned wrap_width=0)
 
bufferappend_decoded_hex (const struct slice &data, bool ignore_spaces=false)
 
bufferappend_decoded_base58 (const struct slice &data, bool ignore_spaces=false)
 
bufferappend_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
 

Member Typedef Documentation

◆ allocator_traits

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_traits = ::std::allocator_traits<allocator_type>

◆ allocator_type

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type = typename ::std::allocator_traits< ALLOCATOR>::template rebind_alloc<uint64_t>

◆ reservation_policy

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reservation_policy = CAPACITY_POLICY

Member Enumeration Documentation

◆ anonymous enum

template<class ALLOCATOR , typename CAPACITY_POLICY >
anonymous enum : size_t
Enumerator
max_length 
max_capacity 
extra_inplace_storage 
pettiness_threshold 

Constructor & Destructor Documentation

◆ buffer() [1/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( )
defaultnoexcept

◆ buffer() [2/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const allocator_type allocator)
inlinenoexcept

◆ buffer() [3/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const struct slice src,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [4/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [5/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const void *  ptr,
size_t  bytes,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [6/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &  )
delete

◆ buffer() [7/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &&  )
delete

◆ buffer() [8/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const char *  c_str,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [9/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string_view< CHAR, T > &  view,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [10/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const struct slice src,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [11/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [12/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const void *  ptr,
size_t  bytes,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [13/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &  str,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [14/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const char *  c_str,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [15/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string_view< CHAR, T > &  view,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [16/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [17/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  capacity,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [18/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
const struct slice src,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [19/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [20/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::mdbx::txn txn,
const struct slice src,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [21/21]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( buffer< ALLOCATOR, CAPACITY_POLICY > &&  src)
inlinenoexcept

Member Function Documentation

◆ add_header() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::add_header ( const struct slice chunk)
inline

◆ add_header() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::add_header ( const void *  src,
size_t  bytes 
)
inline

◆ append() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append ( const struct slice chunk)
inline

◆ append() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append ( const void *  src,
size_t  bytes 
)
inline

◆ append_base58()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_base58 ( const struct slice data,
unsigned  wrap_width = 0 
)
inline

◆ append_base64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_base64 ( const struct slice data,
unsigned  wrap_width = 0 
)
inline

◆ append_decoded_base58()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_base58 ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_decoded_base64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_base64 ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_decoded_hex()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_hex ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_hex()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_hex ( const struct slice data,
bool  uppercase = false,
unsigned  wrap_width = 0 
)
inline

◆ append_producer() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_producer ( const PRODUCER &  producer)
inline

◆ append_producer() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_producer ( PRODUCER &  producer)
inline

◆ as_string()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR = char, class T = ::std::char_traits<CHAR>, class A = legacy_allocator>
::std::basic_string<CHAR, T, A> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_string ( const A &  allocator = A()) const
inline

◆ assign() [1/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( ::MDBX_val &&  src,
bool  make_reference = false 
)
inline

◆ assign() [2/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const ::MDBX_val src,
bool  make_reference = false 
)
inline

◆ assign() [3/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const ::std::basic_string< CHAR, T, A > &  str,
bool  make_reference = false 
)
inline

◆ assign() [4/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
bool  make_reference = false 
)
inline

◆ assign() [5/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const char *  c_str,
bool  make_reference = false 
)
inline

◆ assign() [6/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const struct slice src,
bool  make_reference = false 
)
inline

◆ assign() [7/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const void *  begin,
const void *  end,
bool  make_reference = false 
)
inline

◆ assign() [8/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const void *  ptr,
size_t  bytes,
bool  make_reference = false 
)
inline

◆ assign() [9/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( struct slice &&  src,
bool  make_reference = false 
)
inline

◆ assign_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign_freestanding ( const void *  ptr,
size_t  bytes 
)
inline

◆ assign_reference()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign_reference ( const void *  ptr,
size_t  bytes 
)
inline

◆ at() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::at ( size_t  n)
inline

Accesses the specified byte of data chunk with bounds checking.

Exceptions
std::out_of_rangeif n >= size()

◆ at() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::at ( size_t  n) const
inline

Accesses the specified byte of data chunk with bounds checking.

Exceptions
std::out_of_rangeif n >= size()

◆ byte_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::byte_ptr ( ) const
inlinenoexcept

Returns casted to const pointer to byte an address of data.

◆ byte_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::byte_ptr ( )
inlinenoexcept

Returns casted to pointer to byte an address of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ capacity()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::capacity ( ) const
inlinenoexcept

Returns the number of bytes that can be held in currently allocated storage.

◆ char_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::char_ptr ( ) const
inlinenoexcept

Returns casted to const pointer to char an address of data.

◆ char_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::char_ptr ( )
inlinenoexcept

Returns casted to pointer to char an address of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ clear()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::clear ( )
inlinenoexcept

Clears the contents and storage.

◆ clone()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::clone ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
const allocator_type allocator = allocator_type() 
)
inlinestatic

◆ data() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::data ( ) const
inlinenoexcept

Return a const pointer to the beginning of the referenced data.

◆ data() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::data ( )
inlinenoexcept

Return a pointer to the beginning of the referenced data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ empty()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::empty ( ) const
inlinenoexcept

Checks whether the string is empty.

◆ end() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end ( ) const
inlinenoexcept

Return a const pointer to the end of the referenced data.

◆ end() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end ( )
inlinenoexcept

Return a pointer to the end of the referenced data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ end_byte_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_byte_ptr ( ) const
inlinenoexcept

Returns casted to const pointer to byte an end of data.

◆ end_byte_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_byte_ptr ( )
inlinenoexcept

Returns casted to pointer to byte an end of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ end_char_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
const char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_char_ptr ( ) const
inlinenoexcept

Returns casted to const pointer to char an end of data.

◆ end_char_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_char_ptr ( )
inlinenoexcept

Returns casted to pointer to char an end of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ ends_with()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::ends_with ( const struct slice suffix) const
inlinenoexcept

Checks if the data ends with the given suffix.

◆ get_allocator()

template<class ALLOCATOR , typename CAPACITY_POLICY >
allocator_type mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::get_allocator ( ) const
inline

Returns the associated allocator.

◆ hash_value()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hash_value ( ) const
inlinenoexcept

Returns the hash value of the data.

Attention
Function implementation and returned hash values may changed version to version, and in future the t1ha3 will be used here. Therefore values obtained from this function shouldn't be persisted anywhere.

◆ head()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::head ( size_t  n) const
inlinenoexcept

Returns the first "n" bytes of the data chunk.

Precondition
REQUIRES: n <= size()

◆ headroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::headroom ( ) const
inlinenoexcept

Returns the number of bytes that available in currently allocated storage ahead the currently beginning of data.

◆ is_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_freestanding ( ) const
inlinenoexcept

Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outside the buffer.

◆ is_null()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_null ( ) const
inlinenoexcept

Checks whether the data pointer of the buffer is nullptr.

◆ is_reference()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_reference ( ) const
inlinenoexcept

Checks whether the buffer just refers to data located outside the buffer, rather than stores it.

◆ key_from() [1/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const ::std::basic_string< CHAR, T, A > &  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [2/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const ::std::basic_string_view< CHAR, T > &  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [3/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const char *  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [4/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<size_t SIZE>
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const char(&)  text[SIZE],
bool  make_reference = true 
)
inlinestatic

◆ key_from() [5/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const double *  ieee754_64bit)
inlinestatic

◆ key_from() [6/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const double  ieee754_64bit)
inlinestatic

◆ key_from() [7/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const float *  ieee754_32bit)
inlinestatic

◆ key_from() [8/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const float  ieee754_32bit)
inlinestatic

◆ key_from() [9/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const int32_t  signed_int32)
inlinestatic

◆ key_from() [10/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const int64_t  signed_int64)
inlinestatic

◆ key_from() [11/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const silo &&  src)
inlinestaticnoexcept

◆ key_from() [12/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const uint32_t  unsigned_int32)
inlinestatic

◆ key_from() [13/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const uint64_t  unsigned_int64)
inlinestatic

◆ key_from_jsonInteger()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_jsonInteger ( const int64_t  json_integer)
inlinestatic

◆ length()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::length ( ) const
inlinenoexcept

Returns the number of bytes.

◆ make_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::make_freestanding ( )
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.

◆ middle()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::middle ( size_t  from,
size_t  n 
) const
inlinenoexcept

Returns the middle "n" bytes of the data chunk.

Precondition
REQUIRES: from + n <= size()

◆ operator const struct slice &()

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator const struct slice & ( ) const
inlinenoexcept

◆ operator::std::basic_string()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator::std::basic_string ( ) const
inlineexplicit

◆ operator::std::basic_string_view()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator::std::basic_string_view ( ) const
inlinenoexcept

Return a string_view that references the data of this buffer.

◆ operator=() [1/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( buffer< ALLOCATOR, CAPACITY_POLICY > &&  src)
inlinenoexcept

◆ operator=() [2/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const ::std::basic_string_view< CHAR, T > &  view)
inlinenoexcept

◆ operator=() [3/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src)
inline

◆ operator=() [4/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const struct slice src)
inline

◆ operator=() [5/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( struct slice &&  src)
inline

◆ operator[]() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator[] ( size_t  n) const
inlinenoexcept

Accesses the specified byte of data chunk.

Precondition
REQUIRES: n < size()

◆ operator[]() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
byte& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator[] ( size_t  n)
inlinenoexcept

Accesses the specified byte of data chunk.

Precondition
REQUIRES: n < size()

◆ remove_prefix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::remove_prefix ( size_t  n)
inlinenoexcept

Drops the first "n" bytes from the data chunk.

Precondition
REQUIRES: n <= size()

◆ remove_suffix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::remove_suffix ( size_t  n)
inlinenoexcept

Drops the last "n" bytes from the data chunk.

Precondition
REQUIRES: n <= size()

◆ reserve()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve ( size_t  wanna_headroom,
size_t  wanna_tailroom 
)
inline

Reserves storage space.

◆ reserve_headroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve_headroom ( size_t  wanna_headroom)
inline

Reserves space before the payload.

◆ reserve_tailroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve_tailroom ( size_t  wanna_tailroom)
inline

Reserves space after the payload.

◆ safe_head()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_head ( size_t  n) const
inline

Returns the first "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif n >= size()

◆ safe_middle()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_middle ( size_t  from,
size_t  n 
) const
inline

Returns the middle "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif from + n >= size()

◆ safe_remove_prefix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_remove_prefix ( size_t  n)
inline

Drops the first "n" bytes from the data chunk.

Exceptions
std::out_of_rangeif n > size()

◆ safe_remove_suffix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_remove_suffix ( size_t  n)
inline

Drops the last "n" bytes from the data chunk.

Exceptions
std::out_of_rangeif n > size()

◆ safe_tail()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_tail ( size_t  n) const
inline

Returns the last "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif n >= size()

◆ set_end()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::set_end ( const void *  ptr)
inline

Sets the length by specifying the end of the data.

◆ set_length()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::set_length ( size_t  bytes)
inline

Set length of data.

◆ shrink_to_fit()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::shrink_to_fit ( )
inline

Reduces memory usage by freeing unused storage space.

◆ size()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::size ( ) const
inlinenoexcept

Returns the number of bytes.

◆ slice()

template<class ALLOCATOR , typename CAPACITY_POLICY >
const struct slice& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::slice ( ) const
inlinenoexcept

◆ starts_with()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::starts_with ( const struct slice prefix) const
inlinenoexcept

Checks if the data starts with the given prefix.

◆ string_view()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR = char, class T = ::std::char_traits<CHAR>>
::std::basic_string_view<CHAR, T> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::string_view ( ) const
inlinenoexcept

Return a string_view that references the data of this buffer.

◆ swap()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::swap ( buffer< ALLOCATOR, CAPACITY_POLICY > &  other)
inlinenoexcept

◆ tail()

template<class ALLOCATOR , typename CAPACITY_POLICY >
struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::tail ( size_t  n) const
inlinenoexcept

Returns the last "n" bytes of the data chunk.

Precondition
REQUIRES: n <= size()

◆ tailroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::tailroom ( ) const
inlinenoexcept

Returns the number of bytes that available in currently allocated storage after the currently data end.

◆ wrap()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::wrap ( const POD &  pod,
bool  make_reference = false,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Friends And Related Function Documentation

◆ txn

template<class ALLOCATOR , typename CAPACITY_POLICY >
friend class txn
friend

◆ mdbx::value_result

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_resultoperator= (const value_result &) noexcept=default
 

Public Attributes

slice value
 
bool done
 

Constructor & Destructor Documentation

◆ value_result() [1/2]

mdbx::value_result::value_result ( const slice value,
bool  done 
)
inlinenoexcept

◆ value_result() [2/2]

mdbx::value_result::value_result ( const value_result )
defaultnoexcept

Member Function Documentation

◆ operator=()

value_result& mdbx::value_result::operator= ( const value_result )
defaultnoexcept

Member Data Documentation

◆ done

bool mdbx::value_result::done

◆ value

slice mdbx::value_result::value

◆ mdbx::pair

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
 
pairoperator= (const pair &) noexcept=default
 

Public Attributes

slice key
 
slice value
 

Constructor & Destructor Documentation

◆ pair() [1/2]

mdbx::pair::pair ( const slice key,
const slice value 
)
inlinenoexcept

◆ pair() [2/2]

mdbx::pair::pair ( const pair )
defaultnoexcept

Member Function Documentation

◆ operator=()

pair& mdbx::pair::operator= ( const pair )
defaultnoexcept

Member Data Documentation

◆ key

slice mdbx::pair::key

◆ value

slice mdbx::pair::value

◆ mdbx::pair_result

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_resultoperator= (const pair_result &) noexcept=default
 
- Public Member Functions inherited from mdbx::pair
 pair (const slice &key, const slice &value) noexcept
 
 pair (const pair &) noexcept=default
 
pairoperator= (const pair &) noexcept=default
 

Public Attributes

bool done
 
- Public Attributes inherited from mdbx::pair
slice key
 
slice value
 

Constructor & Destructor Documentation

◆ pair_result() [1/2]

mdbx::pair_result::pair_result ( const slice key,
const slice value,
bool  done 
)
inlinenoexcept

◆ pair_result() [2/2]

mdbx::pair_result::pair_result ( const pair_result )
defaultnoexcept

Member Function Documentation

◆ operator=()

pair_result& mdbx::pair_result::operator= ( const pair_result )
defaultnoexcept

Member Data Documentation

◆ done

bool mdbx::pair_result::done

Function Documentation

◆ make_buffer() [1/2]

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() 
)
inline

◆ make_buffer() [2/2]

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() 
)
inline

◆ make_string() [1/2]

template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) >
string< ALLOCATOR > mdbx::make_string ( const PRODUCER &  producer,
const ALLOCATOR &  allocator = ALLOCATOR() 
)
inline

◆ make_string() [2/2]

template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) >
string< ALLOCATOR > mdbx::make_string ( PRODUCER &  producer,
const ALLOCATOR &  allocator = ALLOCATOR() 
)
inline

◆ operator<<() [1/3]

inline ::std::ostream& mdbx::operator<< ( ::std::ostream &  out,
const to_base58 wrapper 
)

◆ operator<<() [2/3]

inline ::std::ostream& mdbx::operator<< ( ::std::ostream &  out,
const to_base64 wrapper 
)

◆ operator<<() [3/3]

inline ::std::ostream& mdbx::operator<< ( ::std::ostream &  out,
const to_hex wrapper 
)

Variable Documentation

◆ ImmutableByteProducer

template<typename T >
concept mdbx::ImmutableByteProducer
Initial value:
= requires(const T &a, char array[42]) {
{ a.is_empty() } -> std::same_as<bool>;
{ a.envisage_result_length() } -> std::same_as<size_t>;
{ a.write_bytes(&array[0], size_t(42)) } -> std::same_as<char *>;
}

◆ MutableByteProducer

template<typename T >
concept mdbx::MutableByteProducer
Initial value:
= requires(T a, char array[42]) {
{ a.is_empty() } -> std::same_as<bool>;
{ a.envisage_result_length() } -> std::same_as<size_t>;
{ a.write_bytes(&array[0], size_t(42)) } -> std::same_as<char *>;
}

◆ SliceTranscoder

template<typename T >
concept mdbx::SliceTranscoder
Initial value:
= ImmutableByteProducer<T> &&
requires(const slice &source, const T &a) {
T(source);
{ a.is_erroneous() } -> std::same_as<bool>;
}