21#include <bsoncxx/string/view_or_value.hpp>
23#include <bsoncxx/config/prelude.hpp>
26BSONCXX_INLINE_NAMESPACE_BEGIN
38class BSONCXX_API
oid {
70 explicit oid(
const char* bytes, std::size_t len);
109 explicit operator bool()
const;
126 friend BSONCXX_PRIVATE
int oid_compare(
const oid& lhs,
const oid& rhs);
130 std::array<char, 12> _bytes;
133BSONCXX_INLINE_NAMESPACE_END
136#include <bsoncxx/config/postlude.hpp>
Represents a MongoDB ObjectId.
Definition oid.hpp:38
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.
oid(init_tag_t tag)
Constructs an oid and initializes it to a newly generated ObjectId.
oid(const string::view_or_value &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.
std::string to_string() const
Converts this oid to a hexadecimal string.
oid()
Constructs an uninitialized oid.
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.
std::time_t get_time_t() const
Extracts the timestamp portion of the underlying ObjectId.
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.
Class representing a view-or-value variant type for strings.
Definition view_or_value.hpp:36