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

realm / realm-core / 2659

07 Mar 2025 10:46AM UTC coverage: 91.112% (-0.01%) from 91.122%
2659

push

Evergreen

jedelbo
Prepare for release 14.14.0

102736 of 181548 branches covered (56.59%)

217428 of 238639 relevant lines covered (91.11%)

5887897.29 hits per line

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

76.92
/src/realm/link_translator.cpp
1
/*************************************************************************
2
 *
3
 * Copyright 2022 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
#include "realm/link_translator.hpp"
20

21
#include <realm/dictionary.hpp>
22
#include <realm/list.hpp>
23
#include <realm/set.hpp>
24

25
namespace realm {
26

27
LinkTranslator::LinkTranslator(Obj origin, ColKey origin_col_key)
28
    : m_origin_obj(origin)
50,844✔
29
    , m_origin_col_key(origin_col_key)
50,844✔
30
{
101,691✔
31
}
101,691✔
32

33
void LinkTranslator::run()
34
{
101,691✔
35
    ColumnAttrMask attr = m_origin_col_key.get_attrs();
101,691✔
36
    if (attr.test(col_attr_List)) {
101,691✔
37
        if (m_origin_col_key.get_type() == col_type_Link) {
30,522✔
38
            LnkLst link_list = m_origin_obj.get_linklist(m_origin_col_key);
29,922✔
39
            on_list_of_links(link_list);
29,922✔
40
        }
29,922✔
41
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
600✔
42
            Lst<Mixed> list = m_origin_obj.get_list<Mixed>(m_origin_col_key);
600✔
43
            on_list_of_mixed(list);
600✔
44
        }
600✔
45
        else {
×
46
            throw std::runtime_error(
×
47
                util::format("LinkTranslator unhandled list type: %1", m_origin_col_key.get_type()));
×
48
        }
×
49
    }
30,522✔
50
    else if (attr.test(col_attr_Set)) {
71,169✔
51
        if (m_origin_col_key.get_type() == col_type_Link) {
2,850✔
52
            LnkSet set = m_origin_obj.get_linkset(m_origin_col_key);
2,400✔
53
            on_set_of_links(set);
2,400✔
54
        }
2,400✔
55
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
450✔
56
            Set<Mixed> set = m_origin_obj.get_set<Mixed>(m_origin_col_key);
450✔
57
            on_set_of_mixed(set);
450✔
58
        }
450✔
59
        else {
×
60
            throw std::runtime_error(
×
61
                util::format("LinkTranslator unhandled set type: %1", m_origin_col_key.get_type()));
×
62
        }
×
63
    }
2,850✔
64
    else if (attr.test(col_attr_Dictionary)) {
68,319✔
65
        auto dict = m_origin_obj.get_dictionary(m_origin_col_key);
1,038✔
66
        on_dictionary(dict);
1,038✔
67
    }
1,038✔
68
    else {
67,281✔
69
        REALM_ASSERT_EX(!m_origin_col_key.is_collection(), m_origin_col_key);
67,281✔
70
        if (m_origin_col_key.get_type() == col_type_Link) {
67,281✔
71
            on_link_property(m_origin_col_key);
67,185✔
72
        }
67,185✔
73
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
96✔
74
            on_mixed_property(m_origin_col_key);
96✔
75
        }
96✔
76
        else {
×
77
            throw std::runtime_error(
×
78
                util::format("LinkTranslator unhandled property type: %1", m_origin_col_key.get_type()));
×
79
        }
×
80
    }
67,281✔
81
}
101,691✔
82

83
} // namespace realm
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

© 2026 Coveralls, Inc