21 #include <bsoncxx/oid-fwd.hpp>
23 #include <bsoncxx/stdx/string_view.hpp>
25 #include <bsoncxx/config/prelude.hpp>
42 static constexpr std::size_t k_oid_length = 12;
59 explicit oid(
const char*
bytes, std::size_t len);
70 explicit oid(
const stdx::string_view& str);
84 static std::size_t
size() {
120 friend BSONCXX_PRIVATE
int oid_compare(
const oid& lhs,
const oid& rhs);
122 std::array<char, k_oid_length> _bytes;
128 #include <bsoncxx/config/postlude.hpp>
Represents a MongoDB ObjectId.
Definition: oid.hpp:40
std::string to_string() const
Converts this oid to a hexadecimal string.
friend bool operator==(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
friend bool operator!=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
static std::size_t size()
Returns the number of bytes in this ObjectId.
Definition: oid.hpp:84
friend bool operator<(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
oid()
Constructs an oid and initializes it to a newly generated ObjectId.
friend bool operator>(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
oid(const stdx::string_view &str)
Constructs an oid and initializes it from the provided hex string.
friend bool operator>=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
friend bool operator<=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.
const char * bytes() const
An accessor for the internal data buffer in the oid.
oid(const char *bytes, std::size_t len)
Constructs an oid initializes it to the contents of the provided buffer.
std::time_t get_time_t() const
Extracts the timestamp portion of the underlying ObjectId.
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19