#include <bsoncxx/v1/oid.hpp>
A BSON ObjectID.
- Attention
- This feature is experimental! It is not ready for use!
|
| | oid () |
| | Initialize with a unique ObjectID.
|
| | oid (std::uint8_t const *bytes, std::size_t len) |
| | Initialize with the given ObjectID byte representation.
|
| | oid (v1::stdx::string_view str) |
| | Initialize with the given ObjectID hexadecimal string representation.
|
| std::uint8_t const * | bytes () const |
| | Return a pointer to the byte representation.
|
| int | compare (oid const &other) const |
| | Equivalent to bson_oid_compare.
|
| std::time_t | get_time_t () const |
| | Return the timestamp component.
|
| std::string | to_string () const |
| | Return the hexadecimal representation.
|
|
| static constexpr std::size_t | k_oid_length = 12 |
| | The number of bytes required to represent an ObjectID.
|
|
| std::error_code | make_error_code (errc v) |
| | Support implicit conversion to std::error_code.
|
| bool | operator!= (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) != 0.
|
| bool | operator< (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) < 0.
|
| bool | operator<= (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) <= 0.
|
| bool | operator== (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) == 0.
|
| bool | operator> (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) > 0.
|
| bool | operator>= (oid const &lhs, oid const &rhs) |
| | Equivalent to lhs.compare(rhs) >= 0.
|
◆ errc
Errors codes may be returned by bsoncxx::v1::oid.
- Attention
- This feature is experimental! It is not ready for use!
| Enumerator |
|---|
| zero | Zero.
|
| null_bytes_ptr | Bytes pointer must not be null.
|
| invalid_length | Byte length must equal bsoncxx::v1::oid::k_oid_length.
|
| empty_string | String must not be empty.
|
| invalid_string | String is not a valid ObjectID representation.
|
◆ oid() [1/3]
| bsoncxx::v1::oid::oid |
( |
| ) |
|
Initialize with a unique ObjectID.
The ObjectID is generated using the bson library's bson_oid_init function with the default bson_context_t.
- Important
- On Windows only, the first call to this function initializes a static local variable which loads the Winsock DLL by calling WSAStartup(). The Winsock DLL is unloaded by calling WSACleanup() when the static local variable is destroyed.
- Exceptions
-
◆ oid() [2/3]
| bsoncxx::v1::oid::oid |
( |
std::uint8_t const * | bytes, |
|
|
std::size_t | len ) |
Initialize with the given ObjectID byte representation.
- Parameters
-
| bytes | A pointer to the ObjectID byte representation. |
| len | The length of the array pointed to by bytes. |
- Exceptions
-
◆ oid() [3/3]
Initialize with the given ObjectID hexadecimal string representation.
- Parameters
-
| str | A valid ObjectID represented. |
- Exceptions
-
◆ bytes()
| std::uint8_t const * bsoncxx::v1::oid::bytes |
( |
| ) |
const |
|
inline |
Return a pointer to the byte representation.
◆ compare()
| int bsoncxx::v1::oid::compare |
( |
oid const & | other | ) |
const |
◆ error_category()
| std::error_category const & bsoncxx::v1::oid::error_category |
( |
| ) |
|
|
static |
The error category for bsoncxx::v1::oid::errc.
- Attention
- This feature is experimental! It is not ready for use!
◆ get_time_t()
| std::time_t bsoncxx::v1::oid::get_time_t |
( |
| ) |
const |
Return the timestamp component.
◆ size()
| std::size_t bsoncxx::v1::oid::size |
( |
| ) |
|
|
inlinestatic |
◆ to_string()
| std::string bsoncxx::v1::oid::to_string |
( |
| ) |
const |
Return the hexadecimal representation.
◆ make_error_code
| std::error_code make_error_code |
( |
errc | v | ) |
|
|
friend |
Support implicit conversion to std::error_code.
- Attention
- This feature is experimental! It is not ready for use!
◆ operator!=
| bool operator!= |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) != 0.
◆ operator<
| bool operator< |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) < 0.
◆ operator<=
| bool operator<= |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) <= 0.
◆ operator==
| bool operator== |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) == 0.
◆ operator>
| bool operator> |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) > 0.
◆ operator>=
| bool operator>= |
( |
oid const & | lhs, |
|
|
oid const & | rhs ) |
|
friend |
Equivalent to lhs.compare(rhs) >= 0.
◆ k_oid_length
| std::size_t bsoncxx::v1::oid::k_oid_length = 12 |
|
staticconstexpr |
The number of bytes required to represent an ObjectID.
The documentation for this class was generated from the following file: