19#ifndef CPPREALM_BRIDGE_OBJ_HPP
20#define CPPREALM_BRIDGE_OBJ_HPP
29#include <cpprealm/types.hpp>
30#include <cpprealm/internal/bridge/binary.hpp>
31#include <cpprealm/internal/bridge/col_key.hpp>
32#include <cpprealm/internal/bridge/decimal 128 .hpp>
33#include <cpprealm/internal/bridge/dictionary.hpp>
34#include <cpprealm/internal/bridge/ 对象.hpp>
35#include <cpprealm/internal/bridge/object_id.hpp>
36#include <cpprealm/internal/bridge/table.hpp>
37#include <cpprealm/internal/bridge/utils.hpp>
50 structNotificationToken ;
57 template <
typename ,
typename >
61 template <
typename ,
typename >
63 template <
typename ,
typename >
67命名空间realm::internal::bridge {
87 template <
typename T>
88 struct is_Optional : std::false_type {
92 template <
typename T>
93 struct is_Optional<std::Optional<T>> : std::true_type {
98 template <
typename T>
99 [[nodiscard]] T get(
const obj&,
const col_key& col_key);
101 [[nodiscard]] std::string get(
const obj&,
const col_key& col_key);
103 [[nodiscard]] uuid get(
const obj&,
const col_key& col_key);
105 [[nodiscard]] object_id get(
const obj&,
const col_key& col_key);
107 [[nodiscard]] Decimal 128 get(
const obj&,
const col_key& col_key);
109 [[nodiscard]] binary get(
const obj&,
const col_key& col_key);
111 [[nodiscard]] timestamp get(
const obj&,
const col_key& col_key);
113 [[nodiscard]] int 64 _t get(
const obj&,
const col_key& col_key);
115 [[nodiscard]]
double get(
const obj&,
const col_key& col_key);
117 [[nodiscard]]
bool get(
const obj&,
const col_key& col_key);
119 [[nodiscard]] Mixed get(
const obj&,
const col_key& col_key);
121 [[nodiscard]] core_dictionary get(
const obj&,
const col_key& col_key);
125 obj (
const obj & other) ;
126 obj & 操作符=(
const obj & other) ;
128 obj & Operator=(
obj && other);
132 [[nodiscard]]
table get_table()
const noException ;
135 [[nodiscard]]
bool is_valid()
const ;
137 template <
typename T>
139 returninternal ::bridge::get<T> (*
this ,
col_key );
142 template <
typename T>
147 returninternal ::bridge::get<T> (*
this ,
col_key );
161 void 设立 (
const col_key &
col_key ,
const std::chrono::time_point<std::chrono::system_clock>& value);
162 template <
typename T>
163 std::enable_if_t<std::is_enum_v<T>>
设立 (
const col_key &
col_key ,
const T& value) {
166 template <
typename T>
175 void set_list_values(
const col_key &
col_key ,
const std::vector<obj_key>&values);
176 void set_list_values(
const col_key &
col_key ,
const std::vector<std::string>&values);
177 void set_list_values(
const col_key &
col_key ,
const std::vector<bool>&values);
178 void set_list_values(
const col_key &
col_key ,
const std::vector<int 64 _t>&values);
179 void set_list_values(
const col_key &
col_key ,
const std::vector<double>&values);
180 void set_list_values(
const col_key &
col_key ,
const std::vector<internal::bridge::uuid>&values);
181 void set_list_values(
const col_key &
col_key ,
const std::vector<internal::bridge::object_id>&values);
182 void set_list_values(
const col_key &
col_key ,
const std::vector<internal::bridge::decimal 128 >&values);
183 void set_list_values(
const col_key &
col_key ,
const std::vector<binary>&values);
184 void set_list_values(
const col_key &
col_key ,
const std::vector<mixed>&values);
185 void set_list_values(
const col_key &
col_key ,
const std::vector<timestamp>&values);
187 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<int64_t>>& values);
188 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<bool>>& values);
189 void set_list_values(
const col_key &
col_key ,
const std::vector<std::Optional<double>>&values);
190 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<std::string>>& values);
191 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<obj_key>>& values);
192 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<internal::bridge::uuid>>& values);
193 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<internal::bridge::object_id>>& values);
194 void set_list_values(
const col_key &
col_key ,
const std::vector<std::Optional<binary>>&values);
195 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<timestamp>>& values);
197 template <
typename ValueType>
198 void set_list_values(
const col_key &
col_key ,
const std::vector<ValueType>&values) {
199 std::vector<typenameInternal::type_info::type_info<ValueType, void>::internal_type> v 2 ;
200 for (
auto v : values) {
201 if constexpr (std::is_pointer_v<ValueType>) {
207 m_obj = m_obj = this->get_table().create_object();
209 std:: 应用([&m_obj, &v](
auto && ...p) {
210 (
accessor <
typename std::decay_t<
decltype (p)>::Result,
void >:: 设立(
211 m_obj, m_obj.get_table().get_column_key(p.name),
212 (*v).*(std::decay_t<
decltype (p)>::ptr)), ...);
214 v 2 .push_back(m_obj.get_key());
216 v 2 .push_back(:: 域::serialize(v));
219 set_list_values(
col_key , v 2 );
222 [[nodiscard]]
obj_key get_key()
const ;
223 [[nodiscard]]
obj_link get_link()
const ;
226 void set_null(
const col_key &);
227 obj create_and_set_linked_object(
const col_key &);
229 void to_json(std::ostream& out)
const noException ;
231 内联 const Obj* get_obj()
const;
232 inline Obj* get_obj();
233 朋友 内联 const Obj* get_obj(
const obj&);
234 朋友 inline Obj* get_obj(
obj &);
235 template <
typename T>
237#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
240 std::shared_ptr<Obj> m_obj;
246 Table get_table(uint 32 _ttable_key);
247 Table get_table(
const std::string&table_key);
249std::reference_wrapper<realm> m_realm;
252 std::string classtable_name_for_object_type(
const std::string&);