19#ifndef REALMCXX_BSON_HPP
20#define REALMCXX_BSON_HPP
22#include <cpprealm/types.hpp>
23#include <cpprealm/internal/bridge/utils.hpp>
30 struct RegularExpression;
62 using array = std::vector<bsoncxx>;
85 using CoreDocument = realm::bson::BsonDocument;
90 const std::string key;
93 explicit value(CoreDocument* d,
const std::string& k)
94 : key(k), m_document(d) {}
95 CoreDocument* m_document;
99 std::pair<std::string, bsoncxx> operator*();
104 bool operator!=(
const iterator& rhs)
const noexcept;
105 bool operator==(
const iterator& rhs)
const noexcept;
108 iterator(std::any&& i) : m_iterator(i) { }
115 document(const std::initializer_list<std::pair<std::
string,
bsoncxx>>&) noexcept;
121 void insert(const std::
string& key, const
bsoncxx&
value);
124 value operator[](const std::
string&);
125 operator CoreDocument() const;
129#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
130 internal::bridge::storage::BsonIndexedMap m_document[1];
132 std::shared_ptr<CoreDocument> m_document;
144 enum class option : uint8_t {
154 option get_options()
const;
155 std::string get_pattern()
const;
156 operator realm::bson::RegularExpression()
const;
161 std::string m_pattern;
166 explicit timestamp(uint32_t seconds, uint32_t increment) : m_seconds(seconds), m_increment(increment) {}
167 uint32_t get_seconds()
const noexcept {
return m_seconds; }
168 uint32_t get_increment()
const noexcept {
return m_increment; }
171 const uint32_t m_seconds;
172 const uint32_t m_increment;
177 explicit date(
const std::chrono::time_point<std::chrono::system_clock>& d) : m_date(d) {}
178 std::chrono::time_point<std::chrono::system_clock> get_date()
const noexcept {
return m_date; }
181 const std::chrono::time_point<std::chrono::system_clock> m_date;
206 bsoncxx(const std::vector<uint8_t>&) noexcept;
207 bsoncxx(const std::
string&) noexcept;
210 bsoncxx(const array&) noexcept;
211 type get_type() const;
212 operator realm::bson::Bson() const;
214 operator std::nullopt_t() const;
215 operator int32_t() const;
216 operator int64_t() const;
217 operator
bool() const;
218 operator
double() const;
222 operator
date() const;
225 operator
uuid() const;
227 operator std::vector<uint8_t>() const;
228 operator std::
string() const;
230 operator array() const;
232 std::
string to_string() const;
233 std::
string to_json() const;
234 bsoncxx(realm::bson::Bson&) noexcept;
236#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
237 internal::bridge::storage::Bson m_bson[1];
239 std::shared_ptr<realm::bson::Bson> m_bson;
249 bsoncxx::regular_expression::option operator|(
const bsoncxx::regular_expression::option& lhs,
250 const bsoncxx::regular_expression::option& rhs)
noexcept;
251 bsoncxx::regular_expression::option operator&(
const bsoncxx::regular_expression::option& lhs,
252 const bsoncxx::regular_expression::option& rhs)
noexcept;
A type representing a BSON datetime.
Definition: bson.hpp:176
MaxKey will always be the greatest value when comparing to other BSON types.
Definition: bson.hpp:139
MinKey will always be the smallest value when comparing to other BSON types.
Definition: bson.hpp:137
A type representing a BSON timestamp.
Definition: bson.hpp:165