Realm C++ SDK版本 v 2.2.0

Mixed.hpp

1
2//
3// 版权所有 2024 Realm Inc.
4//
5// 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
6// 除非符合合规,否则不得使用此文件。
7// 您可以在以下网址获取许可证副本:
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// 除非适用法律要求或书面同意,否则软件
12// 根据许可证分发是按“原样”分发的,
13// 不提供任何类型的Express或暗示的保证或条件。
14// 请参阅管理权限的特定语言的许可证和
15// 许可证下的限制。
16//
18
19#ifndef CPPREALM_BRIDGE_MIXED_HPP
20#define CPPREALM_BRIDGE_MIXED_HPP
21
22#include <string>
23#include<optional>
24#include <variant>
25#include <cpprealm/internal/bridge/ 属性>
26#include <cpprealm/internal/bridge/binary.hpp>
27#include <cpprealm/internal/bridge/uuid.hpp>
28#include <cpprealm/internal/bridge/timestamp.hpp>
29#include <cpprealm/internal/bridge/obj_key.hpp>
30#include <cpprealm/internal/bridge/object_id.hpp>
31#include <cpprealm/internal/bridge/decimal 128 .hpp>
32
33命名空间域 {
34 class Mixed;
35
36 使用混合= std::variant<
37 std::monostate,
38 int 64 _t,
39 bool,
40 std::string,
41 double ,
42 std::vector<uint 8 _t>,
43 std::chrono::time_point<std::chrono::system_clock>,
44 uuid,
45 object_id,
46十进制128 >;
47 }
48
49命名空间realm::internal::bridge {
50 枚举 class data_type {
51 // 注意:赋值必须与 <realm/column_type.h> 保持同步
52 // 注意:对此枚举进行的任何更改都是文件格式的破坏性变更 (breaking change)。
53 Int = 0 ,
54 Bool = 1 ,
55 string = 2,
56二进制 = 4 ,
57混合 = 6 ,
58时间戳 = 8 ,
59浮点 = 9 ,
60 double = 10,
61 Decimal = 11 ,
62链接 = 12 ,
63 LinkList = 13 ,
64 ObjectId = 15 ,
65 TypedLink = 16,
66 UUID = 17,
67 };
68
69 struct 混合{
70 混合();
71 混合( const混合& other) ;
72 Mixed & Operator=( const Mixed & other) ;
73 混合(混合&& other);
74 混合&操作符=(混合&&其他);
75 ~mixed ();
76
77 显式 混合( const std::string&);
78 混合( const std::monostate&); //NOLINT(google-explicit-constructor)
79 混合( const int &); //NOLINT(google-explicit-constructor)
80 ixed ( const int 64 _t&); //NOLINT(google-explicit-constructor)
81 混合( const double &); //NOLINT(google-explicit-constructor)
82 混合( const bool &); //NOLINT(google-explicit-constructor)
83 混合( const struct uuid &); //NOLINT(google-explicit-constructor)
84 Mixed ( const struct object_id &); //NOLINT(google-explicit-constructor)
85 Mixed ( const struct Decimal 128 &); //NOLINT(google-explicit-constructor)
86 Mixed ( const struct timestamp &); //NOLINT(google-explicit-constructor)
87 混合( const struct obj_link &); //NOLINT(google-explicit-constructor)
88 混合( const struct obj_key &); //NOLINT(google-explicit-constructor)
89 混合const struct binary &); //NOLINT(google-explicit-constructor)
90 混合( const Mixed&); //NOLINT(google-explicit-constructor)
91 template < typename T>
92 混合( const std::Optional<T>& o); //NOLINT(google-explicit-constructor)
93 操作符 std::string() const//NOLINT(google-explicit-constructor)
94 操作符 int 64 _t() const ; //NOLINT(google-explicit-constructor)
95 操作符 double() const ; //NOLINT(google-explicit-constructor)
96 Operator bool() const ; //NOLINT(google-explicit-constructor)
97 运算符 bridge::uuid () const ; //NOLINT(google-explicit-constructor)
98 运算符 bridge::object_id () const ; //NOLINT(google-explicit-constructor)
99 运算符 bridge::decimal 128 () const ; //NOLINT(google-explicit-constructor)
100 运算符 bridge::timestamp () const ; //NOLINT(google-explicit-constructor)
101 运算符 bridge::obj_link () const ; //NOLINT(google-explicit-constructor)
102 运算符 bridge::obj_key () const ; //NOLINT(google-explicit-constructor)
103 运算符 bridge::binary () const ; //NOLINT(google-explicit-constructor)
104
105 显式 操作符 Mixed() const ;
106
107 [[nodiscard]] data_type type() const noException ;
108 [[nodiscard]] bool is_null() const noException ;
109 private :
110 std::string m_own_string;
111 二进制m_own_data;
112#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
113 存储::Mixed m_mixed[ 1 ];
114#else
115 std::shared_ptr<Mixed> m_mixed;
116#endif
117 朋友 bool操作符 ==( const混合&, const混合&);
118 朋友 bool操作符!=( const混合&, const混合&);
119 朋友 bool操作符>( const混合&, const混合&);
120 朋友 bool操作符<( const混合&, const混合&);
121 朋友 bool操作符 >=( const混合&, const混合&);
122 朋友 bool操作符<=( const混合&, const混合&);
123 };
124
125 bool操作符 ==( const混合&, const混合&);
126 bool操作符!=( const混合&, const混合&);
127 bool操作符>( const混合&, const混合&);
128 bool操作符<( const混合&, const混合&);
129 bool操作符 >=( const混合&, const混合&);
130 bool操作符<=( const混合&, const混合&);
131 }
132
133
134#endif //CPREALM_BRIDGE_MIXED_HPP
定义: binary.hpp: 30
定义:十进制128 .hpp: 30
定义: mixed.hpp:69
定义: obj_key.hpp: 33
定义: object_id.hpp:31
定义: timestamp.hpp: 30
定义: uuid.hpp:32