MongoDB C++ Driver
mongocxx-3.6.2
|
21 #include <bsoncxx/stdx/string_view.hpp>
23 #include <bsoncxx/config/prelude.hpp>
26 BSONCXX_INLINE_NAMESPACE_BEGIN
38 class BSONCXX_API
oid {
40 static constexpr std::size_t k_oid_length = 12;
57 explicit oid(
const char* bytes, std::size_t len);
68 explicit oid(
const bsoncxx::stdx::string_view& str);
82 static std::size_t
size() {
118 friend BSONCXX_PRIVATE
int oid_compare(
const oid& lhs,
const oid& rhs);
120 std::array<char, k_oid_length> _bytes;
123 BSONCXX_INLINE_NAMESPACE_END
126 #include <bsoncxx/config/postlude.hpp>
oid(const bsoncxx::stdx::string_view &str)
Constructs an oid and initializes it from the provided hex string.
Top level namespace for MongoDB C++ BSON functionality.
Definition: element.hpp:24
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.
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.
Represents a MongoDB ObjectId.
Definition: oid.hpp:38
std::time_t get_time_t() const
Extracts the timestamp portion of the underlying ObjectId.
oid()
Constructs an oid and initializes it to a newly generated ObjectId.
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.
oid(const char *bytes, std::size_t len)
Constructs an oid initializes it to the contents of the provided buffer.
static std::size_t size()
Returns the number of bytes in this ObjectId.
Definition: oid.hpp:82
friend bool operator>=(const oid &lhs, const oid &rhs)
Relational operators for OIDs.