• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-core / github_pull_request_312964

19 Feb 2025 07:31PM UTC coverage: 90.814% (-0.3%) from 91.119%
github_pull_request_312964

Pull #8071

Evergreen

web-flow
Bump serialize-javascript and mocha

Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) to 6.0.2 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `serialize-javascript` from 6.0.0 to 6.0.2
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](https://github.com/yahoo/serialize-javascript/compare/v6.0.0...v6.0.2)

Updates `mocha` from 10.2.0 to 10.8.2
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.2.0...v10.8.2)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #8071: Bump serialize-javascript and mocha

96552 of 179126 branches covered (53.9%)

212672 of 234185 relevant lines covered (90.81%)

3115802.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/realm/array_typed_link.hpp
1
/*************************************************************************
2
 *
3
 * Copyright 2019 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
 *
17
 **************************************************************************/
18

19
#ifndef REALM_ARRAY_TYPED_LINK_HPP
20
#define REALM_ARRAY_TYPED_LINK_HPP
21

22
#include <realm/array.hpp>
23
#include <realm/data_type.hpp>
24
#include <realm/keys.hpp>
25
#include <realm/mixed.hpp>
26

27
namespace realm {
28

29
class ArrayTypedLink : public ArrayPayload, private Array {
30
public:
31
    using value_type = ObjLink;
32

33
    using Array::detach;
34
    using Array::get_ref;
35
    using Array::init_from_mem;
36
    using Array::set_parent;
37
    using Array::update_parent;
38
    using Array::verify;
39

40
    explicit ArrayTypedLink(Allocator& alloc)
41
        : Array(alloc)
×
42
    {
×
43
    }
×
44

45
    static ObjLink default_value(bool)
46
    {
×
47
        return ObjLink{};
×
48
    }
×
49

50
    void create()
51
    {
×
52
        MemRef mem = Array::create_empty_array(type_Normal, false, m_alloc);
×
53
        init_from_mem(mem);
×
54
    }
×
55
    void destroy()
56
    {
×
57
        Array::destroy_deep();
×
58
    }
×
59
    void init_from_ref(ref_type ref) noexcept override
60
    {
×
61
        Array::init_from_mem(MemRef(m_alloc.translate(ref), ref, m_alloc));
×
62
    }
×
63
    void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept override
64
    {
×
65
        Array::set_parent(parent, ndx_in_parent);
×
66
    }
×
67
    void init_from_parent()
68
    {
×
69
        ref_type ref = get_ref_from_parent();
×
70
        init_from_ref(ref);
×
71
    }
×
72

73
    size_t size() const
74
    {
×
75
        return Array::size() >> 1;
×
76
    }
×
77

78
    bool is_null(size_t ndx)
79
    {
×
80
        ndx <<= 1;
×
81
        return Array::get(ndx) == 0;
×
82
    }
×
83

84
    void add(ObjLink value)
85
    {
×
86
        int64_t tk = (value.get_table_key().value + 1) & 0x7FFFFFFF;
×
87
        Array::add(tk);
×
88
        Array::add(value.get_obj_key().value + 1);
×
89
    }
×
90
    void set(size_t ndx, ObjLink value)
91
    {
×
92
        ndx <<= 1;
×
93
        int64_t tk = (value.get_table_key().value + 1) & 0x7FFFFFFF;
×
94
        Array::set(ndx, tk);
×
95
        Array::set(ndx + 1, value.get_obj_key().value + 1);
×
96
    }
×
97
    void set_null(size_t ndx)
98
    {
×
99
        ndx <<= 1;
×
100
        Array::set(ndx, 0);
×
101
        Array::set(ndx + 1, 0);
×
102
    }
×
103
    void insert(size_t ndx, ObjLink value)
104
    {
×
105
        ndx <<= 1;
×
106
        int64_t tk = (value.get_table_key().value + 1) & 0x7FFFFFFF;
×
107
        Array::insert(ndx, tk);
×
108
        Array::insert(ndx + 1, value.get_obj_key().value + 1);
×
109
    }
×
110
    ObjLink get(size_t ndx) const
111
    {
×
112
        ndx <<= 1;
×
113
        uint32_t tk = uint32_t(Array::get(ndx) - 1) & 0x7FFFFFFF;
×
114
        return {TableKey(tk), ObjKey(Array::get(ndx + 1) - 1)};
×
115
    }
×
116
    Mixed get_any(size_t ndx) const override
117
    {
×
118
        return Mixed(get(ndx));
×
119
    }
×
120
    bool is_null(size_t ndx) const
121
    {
×
122
        return Array::get(ndx << 1) == 0;
×
123
    }
×
124

125
    void erase(size_t ndx)
126
    {
×
127
        ndx <<= 1;
×
128
        Array::erase(ndx, ndx + 2);
×
129
    }
×
130
    void move(ArrayTypedLink& dst, size_t ndx)
131
    {
×
132
        Array::move(dst, ndx << 1);
×
133
    }
×
134
    void clear()
135
    {
×
136
        Array::clear();
×
137
    }
×
138

139
    size_t find_first(ObjLink value, size_t begin, size_t end) const noexcept
140
    {
×
141
        int64_t tk = (value.get_table_key().value + 1) & 0x7FFFFFFF;
×
142
        size_t element_ndx = begin * 2;
×
143
        size_t element_end = end * 2;
×
144
        for (;;) {
×
145
            element_ndx = Array::find_first(tk, element_ndx, element_end);
×
146
            if (element_ndx == realm::npos)
×
147
                return realm::npos;
×
148
            if (!(element_ndx & 1) && (Array::get(element_ndx + 1) - 1) == value.get_obj_key().value) {
×
149
                return element_ndx / 2;
×
150
            }
×
151
            ++element_ndx;
×
152
        }
×
153
        return realm::npos;
×
154
    }
×
155
};
156
} // namespace realm
157

158
#endif /* REALM_ARRAY_TYPED_LINK_HPP */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc