19#ifndef CPPREALM_BRIDGE_OBJ_HPP
20#define CPPREALM_BRIDGE_OBJ_HPP
29#include <cprealm/types.hpp>
30#include <cpprealm/internal/bridge/binary.hpp>
31#include <cpprealm/internal/bridge/col_key.hpp>
32#include <cpprealm/internal/bridge/decimal128.hpp>
33#include <cprealm/internal/bridge/Dictionary.hpp>
34#include <cpprealm/internal/bridge/ objeto.hpp>
35#include <cpprealm/internal/bridge/object_id.hpp>
36#include <cprealm/internal/bridge/table.hpp>
37#include <cprealm/internal/bridge/utils.hpp>
50 struct NotificationToken;
52 namespace interno::bridge {
56 namespace internal::type_info {
57 modelo <
typename,
typename>
61 modelo <
typename,
typename>
63 modelo <
typename,
typename>
67namespace realm::internal::bridge {
73 estrutura object_schema;
74 carimbo de data/hora
da estrutura ;
78 dicionário
estruturado ;
79 estrutura, estrutura uuid;
88 estrutura is_optional : std::false_type {
89 utilizando subjacente = T;
93 estrutura is_optional<std::opcional<T>> : std::true_type {
94 utilizando subjacente = 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]] decimal128 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]] int64_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);
123 estrutura, estrutura obj {
126 obj& operator=(
const obj& other) ;
128 obj& operator=(
obj&& other);
131 operador Obj()
const;
132 [[nodiscard]]
table get_table()
const noexceto;
133 [[nodiscard]]
table get_target_table(
col_key)
const noexceto;
135 [[nodiscard]]
bool is_valid()
const;
139 return internal::bridge::get<T>(*
this,
col_key);
147 return internal::bridge::get<T>(*
this,
col_key);
161 vazio set(
const col_key&
col_key,
const std::chrono::time_point<std::chrono::system_clock>& value);
163 std::enable_if_t<std::is_enum_v<T>>
set(
const col_key&
col_key,
const T& valor) {
175 set_list_values (
const col_key&
col_key,
const std::vector<obj_key>& valores);
176 set_list_values (
const col_key&
col_key,
const std::vector<std::string>valores);
177 set_list_values (
const col_key&
col_key,
const std::vector<bool>& valores);
178 set_list_values (
const col_key&
col_key,
const std::vector<int64_t>& valores);
179 set_list_values (
const col_key&
col_key,
const std::vector<double>& valores);
180 set_list_values (
const col_key&
col_key,
const std::vector<internal::bridge::uuid>& valores);
181 set_list_values (
const col_key&
col_key,
const std::vector<internal::bridge::object_id>& valores);
182 set_list_values
nulos (
const col_key&
col_key,
const std::vector<internal::bridge::decimal128>& valores);
183 set_list_values
vazios ( valores
const col_key&
col_key,
const std::vector<binary>&);
184 set_list_values
vazios ( valores
const col_key&
col_key,
const std::vector<mixed>&);
185 set_list_values (
const col_key&
col_key,
const std::vector<timestamp>& valores);
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 set_list_values
vazias (
const col_key&
col_key,
const std::vector <std::optional<double>> valores);
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 set_list_values
vazias (
const col_key&
col_key,
const std::vector<std::optional<binary>>& valores);
195 void set_list_values(
const col_key&
col_key,
const std::vector<std::optional<timestamp>>& values);
197 modelo <
typename ValueType>
198 set_list_values
nulos (
const col_key&
col_key,
const std::vector<ValueType>& valores) {
199 std::vector<typename internal::type_info::type_info<ValueType, null>::internal_type> v2;
200 para ( valores v :
automático ) {
201 se constexpr (std::is_pointer_v<ValueType>) {
207 m_obj = m_obj = esta->get_table().create_object();
209 std::apply([&m_obj, &v](
auto && ...p) {
210 (
acessador<
typename std::decay_t<
decltype(p)>::Result,
null>::set(
211 m_obj, m_obj.get_table().get_column_key(p.name),
212 (*v).*(std::decay_t<
decltype(p)>::ptr)), ...);
214 v2.push_back(m_obj.get_key());
216 v2.push_back(:: Realm::serialize(v));
222 [[nodiscard]]
obj_key get_key()
const;
223 [[nodiscard]]
obj_link get_link()
const;
227 obj create_and_set_linked_object(
const col_key&);
229 to_json (std::ostream& out)
const noexceto;
231 in-line const Obj* get_obj()
const;
232 inline Obj* get_obj();
233 amigo in-line const Obj* get_obj(
const obj&);
234 amigo inline Obj* get_obj(
obj&);
237#ifdef CPPREALM_HVE_GENERATED_BRIDGE_TYPes
238 armazenamento::Obj m_obj[1];
240 std::shared_ptr<Obj> m_obj;
246 tabela get_table(uint32_t table_key);
247 tabela get_table(
const std::string& table_key);
249 std::reference_wrapper<realm> m_realm;
252 std::string table_name_for_object_type(
const std::string&);
Definição: accessors.hpp:33
Definição: col_key.hpp:28
Definição: dictionary.hpp:106
Definição: decimal128.hpp:30
Definição: obj_key.hpp:33
Definição: obj_key.hpp:53
Definição: object_id.hpp:31
Definição: timestamp.hpp:30