Realm C++ SDK Version v2.2.0

object_id.hpp

1
2//
3// Copyright 2024 Realm Inc.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
18
19#ifndef CPPREALM_BRIDGE_OBJECT_ID_HPP
20#define CPPREALM_BRIDGE_OBJECT_ID_HPP
21
22#include <cpprealm/internal/bridge/utils.hpp>
23#include <array>
24
25namespace realm {
26 struct object_id;
27 class ObjectId;
28}
29
30namespace realm::internal::bridge {
31 struct object_id {
32 object_id();
33 object_id(const object_id& other) = default;
34 object_id& operator=(const object_id& other) = default;
35 object_id(object_id&& other) = default;
36 object_id& operator=(object_id&& other) = default;
37 ~object_id() = default;
38 object_id(const ObjectId&); //NOLINT(google-explicit-constructor);
39 explicit object_id(const std::string&);
40 object_id(const struct ::realm::object_id&); //NOLINT(google-explicit-constructor);
41 operator ObjectId() const; //NOLINT(google-explicit-constructor);
42 operator ::realm::object_id() const; //NOLINT(google-explicit-constructor);
43 [[nodiscard]] std::string to_string() const;
44 [[nodiscard]] static object_id generate();
45 private:
46 std::array<uint8_t, 12> m_object_id;
47
48 friend bool operator ==(const object_id&, const object_id&);
49 friend bool operator !=(const object_id&, const object_id&);
50 friend bool operator >(const object_id&, const object_id&);
51 friend bool operator <(const object_id&, const object_id&);
52 friend bool operator >=(const object_id&, const object_id&);
53 friend bool operator <=(const object_id&, const object_id&);
54 };
55
56 bool operator ==(const object_id&, const object_id&);
57 bool operator !=(const object_id&, const object_id&);
58 bool operator >(const object_id&, const object_id&);
59 bool operator <(const object_id&, const object_id&);
60 bool operator >=(const object_id&, const object_id&);
61 bool operator <=(const object_id&, const object_id&);
62}
63
64#endif //CPPREALM_BRIDGE_OBJECT_ID_HPP
65
Definition: object_id.hpp:31