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

realm / realm-core / 1863

24 Nov 2023 10:28AM UTC coverage: 91.688% (-0.02%) from 91.708%
1863

push

Evergreen

web-flow
Add missing install headers (#7165)

* add missing install headers

* validate installed headers on PR triggers

92392 of 169288 branches covered (0.0%)

231720 of 252727 relevant lines covered (91.69%)

6390825.2 hits per line

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

80.33
/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)
29
    , m_origin_col_key(origin_col_key)
30
{
214,482✔
31
}
214,482✔
32

33
void LinkTranslator::run()
34
{
214,482✔
35
    ColumnAttrMask attr = m_origin_col_key.get_attrs();
214,482✔
36
    if (attr.test(col_attr_List)) {
214,482✔
37
        if (m_origin_col_key.get_type() == col_type_LinkList) {
60,096✔
38
            LnkLst link_list = m_origin_obj.get_linklist(m_origin_col_key);
59,508✔
39
            on_list_of_links(link_list);
59,508✔
40
        }
59,508✔
41
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
588✔
42
            Lst<Mixed> list = m_origin_obj.get_list<Mixed>(m_origin_col_key);
582✔
43
            on_list_of_mixed(list);
582✔
44
        }
582✔
45
        else if (m_origin_col_key.get_type() == col_type_TypedLink) {
6✔
46
            Lst<ObjLink> list = m_origin_obj.get_list<ObjLink>(m_origin_col_key);
6✔
47
            on_list_of_typedlink(list);
6✔
48
        }
6✔
49
        else {
×
50
            throw std::runtime_error(
×
51
                util::format("LinkTranslator unhandled list type: %1", m_origin_col_key.get_type()));
×
52
        }
×
53
    }
154,386✔
54
    else if (attr.test(col_attr_Set)) {
154,386✔
55
        if (m_origin_col_key.get_type() == col_type_Link) {
2,862✔
56
            LnkSet set = m_origin_obj.get_linkset(m_origin_col_key);
2,400✔
57
            on_set_of_links(set);
2,400✔
58
        }
2,400✔
59
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
462✔
60
            Set<Mixed> set = m_origin_obj.get_set<Mixed>(m_origin_col_key);
450✔
61
            on_set_of_mixed(set);
450✔
62
        }
450✔
63
        else if (m_origin_col_key.get_type() == col_type_TypedLink) {
12✔
64
            Set<ObjLink> set = m_origin_obj.get_set<ObjLink>(m_origin_col_key);
12✔
65
            on_set_of_typedlink(set);
12✔
66
        }
12✔
67
        else {
×
68
            throw std::runtime_error(
×
69
                util::format("LinkTranslator unhandled set type: %1", m_origin_col_key.get_type()));
×
70
        }
×
71
    }
151,524✔
72
    else if (attr.test(col_attr_Dictionary)) {
151,524✔
73
        auto dict = m_origin_obj.get_dictionary(m_origin_col_key);
38,088✔
74
        on_dictionary(dict);
38,088✔
75
    }
38,088✔
76
    else {
113,436✔
77
        REALM_ASSERT_EX(!m_origin_col_key.is_collection(), m_origin_col_key);
113,436✔
78
        if (m_origin_col_key.get_type() == col_type_Link) {
113,436✔
79
            on_link_property(m_origin_col_key);
113,388✔
80
        }
113,388✔
81
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
48✔
82
            on_mixed_property(m_origin_col_key);
42✔
83
        }
42✔
84
        else if (m_origin_col_key.get_type() == col_type_TypedLink) {
6✔
85
            on_typedlink_property(m_origin_col_key);
6✔
86
        }
6✔
87
        else {
×
88
            throw std::runtime_error(
×
89
                util::format("LinkTranslator unhandled property type: %1", m_origin_col_key.get_type()));
×
90
        }
×
91
    }
113,436✔
92
}
214,482✔
93

94
} // 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