Inherits MDBX_val.
|
MDBX_CXX11_CONSTEXPR | slice () noexcept |
| Create an empty slice. More...
|
|
MDBX_CXX14_CONSTEXPR | slice (const void *ptr, size_t bytes) |
| Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr. More...
|
|
MDBX_CXX14_CONSTEXPR | slice (const void *begin, const void *end) |
| Create a slice that refers to [begin,end] of memory bytes. More...
|
|
template<size_t SIZE> |
MDBX_CXX14_CONSTEXPR | slice (const char(&text)[SIZE]) |
| Create a slice that refers to text[0,strlen(text)-1]. More...
|
|
MDBX_CXX17_CONSTEXPR | 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 > |
MDBX_CXX20_CONSTEXPR | slice (const ::std::basic_string< CHAR, T, A > &str) |
| Create a slice that refers to the contents of "str". More...
|
|
MDBX_CXX14_CONSTEXPR | slice (const MDBX_val &src) |
|
MDBX_CXX11_CONSTEXPR | slice (const slice &) noexcept=default |
|
MDBX_CXX14_CONSTEXPR | slice (MDBX_val &&src) |
|
MDBX_CXX14_CONSTEXPR | slice (slice &&src) noexcept |
|
template<class CHAR , class T > |
MDBX_CXX14_CONSTEXPR | 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>> |
MDBX_CXX11_CONSTEXPR ::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 > |
MDBX_CXX11_CONSTEXPR | 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> |
MDBX_CXX20_CONSTEXPR ::std::basic_string< CHAR, T, ALLOCATOR > | as_string (const ALLOCATOR &allocator=ALLOCATOR()) const |
|
template<class CHAR , class T , class ALLOCATOR > |
MDBX_CXX20_CONSTEXPR | 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...
|
|
MDBX_NOTHROW_PURE_FUNCTION bool | is_printable (bool disable_utf8=false) const noexcept |
| Checks whether the content of the slice is printable. More...
|
|
MDBX_NOTHROW_PURE_FUNCTION bool | is_hex (bool ignore_spaces=false) const noexcept |
| Checks whether the content of the slice is a hexadecimal dump. More...
|
|
MDBX_NOTHROW_PURE_FUNCTION bool | is_base58 (bool ignore_spaces=false) const noexcept |
| Checks whether the content of the slice is a Base58 dump. More...
|
|
MDBX_NOTHROW_PURE_FUNCTION 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 MDBX_CXX11_CONSTEXPR byte * | byte_ptr () const noexcept |
| Returns casted to pointer to byte an address of data. More...
|
|
MDBX_CXX11_CONSTEXPR byte * | byte_ptr () noexcept |
|
const MDBX_CXX11_CONSTEXPR byte * | end_byte_ptr () const noexcept |
| Returns casted to pointer to byte an end of data. More...
|
|
MDBX_CXX11_CONSTEXPR byte * | end_byte_ptr () noexcept |
|
const MDBX_CXX11_CONSTEXPR char * | char_ptr () const noexcept |
| Returns casted to pointer to char an address of data. More...
|
|
MDBX_CXX11_CONSTEXPR char * | char_ptr () noexcept |
|
const MDBX_CXX11_CONSTEXPR char * | end_char_ptr () const noexcept |
| Returns casted to pointer to char an end of data. More...
|
|
MDBX_CXX11_CONSTEXPR char * | end_char_ptr () noexcept |
|
const MDBX_CXX11_CONSTEXPR void * | data () const noexcept |
| Return a pointer to the beginning of the referenced data. More...
|
|
MDBX_CXX11_CONSTEXPR void * | data () noexcept |
|
const MDBX_CXX11_CONSTEXPR void * | end () const noexcept |
| Return a pointer to the ending of the referenced data. More...
|
|
MDBX_CXX11_CONSTEXPR void * | end () noexcept |
|
MDBX_CXX11_CONSTEXPR size_t | length () const noexcept |
| Returns the number of bytes. More...
|
|
MDBX_CXX14_CONSTEXPR slice & | set_length (size_t bytes) |
| Set slice length. More...
|
|
MDBX_CXX14_CONSTEXPR slice & | set_end (const void *ptr) |
| Sets the length by specifying the end of the slice data. More...
|
|
MDBX_CXX11_CONSTEXPR bool | empty () const noexcept |
| Checks whether the slice is empty. More...
|
|
MDBX_CXX11_CONSTEXPR bool | is_null () const noexcept |
| Checks whether the slice data pointer is nullptr. More...
|
|
MDBX_CXX11_CONSTEXPR size_t | size () const noexcept |
| Returns the number of bytes. More...
|
|
MDBX_CXX11_CONSTEXPR | operator bool () const noexcept |
| Returns true if slice is not empty. More...
|
|
MDBX_CXX14_CONSTEXPR void | invalidate () noexcept |
| Depletes content of slice and make it invalid. More...
|
|
MDBX_CXX14_CONSTEXPR 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...
|
|
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool | starts_with (const slice &prefix) const noexcept |
| Checks if the data starts with the given prefix. More...
|
|
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool | ends_with (const slice &suffix) const noexcept |
| Checks if the data ends with the given suffix. More...
|
|
MDBX_CXX11_CONSTEXPR byte | operator[] (size_t n) const noexcept |
| Returns the nth byte in the referenced data. More...
|
|
MDBX_CXX11_CONSTEXPR byte | at (size_t n) const |
| Returns the nth byte in the referenced data with bounds checking. More...
|
|
MDBX_CXX14_CONSTEXPR slice | head (size_t n) const noexcept |
| Returns the first "n" bytes of the slice. More...
|
|
MDBX_CXX14_CONSTEXPR slice | tail (size_t n) const noexcept |
| Returns the last "n" bytes of the slice. More...
|
|
MDBX_CXX14_CONSTEXPR slice | middle (size_t from, size_t n) const noexcept |
| Returns the middle "n" bytes of the slice. More...
|
|
MDBX_CXX14_CONSTEXPR slice | safe_head (size_t n) const |
| Returns the first "n" bytes of the slice. More...
|
|
MDBX_CXX14_CONSTEXPR slice | safe_tail (size_t n) const |
| Returns the last "n" bytes of the slice. More...
|
|
MDBX_CXX14_CONSTEXPR slice | safe_middle (size_t from, size_t n) const |
| Returns the middle "n" bytes of the slice. More...
|
|
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR size_t | hash_value () const noexcept |
| Returns the hash value of referenced data. More...
|
|
MDBX_CXX11_CONSTEXPR bool | is_valid () const noexcept |
| Checks the slice is not refers to null address or has zero length. More...
|
|
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.