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

realm / realm-core / github_pull_request_281750

30 Oct 2023 03:37PM UTC coverage: 90.528% (-1.0%) from 91.571%
github_pull_request_281750

Pull #6073

Evergreen

jedelbo
Log free space and history sizes when opening file
Pull Request #6073: Merge next-major

95488 of 175952 branches covered (0.0%)

8973 of 12277 new or added lines in 149 files covered. (73.09%)

622 existing lines in 51 files now uncovered.

233503 of 257934 relevant lines covered (90.53%)

6533720.56 hits per line

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

76.0
/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
{
75,495✔
31
}
75,495✔
32

33
void LinkTranslator::run()
34
{
75,495✔
35
    ColumnAttrMask attr = m_origin_col_key.get_attrs();
75,495✔
36
    if (attr.test(col_attr_List)) {
75,495✔
37
        if (m_origin_col_key.get_type() == col_type_LinkList) {
11,550✔
38
            LnkLst link_list = m_origin_obj.get_linklist(m_origin_col_key);
11,430✔
39
            on_list_of_links(link_list);
11,430✔
40
        }
11,430✔
41
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
120✔
42
            Lst<Mixed> list = m_origin_obj.get_list<Mixed>(m_origin_col_key);
120✔
43
            on_list_of_mixed(list);
120✔
44
        }
120✔
UNCOV
45
        else {
×
UNCOV
46
            throw std::runtime_error(
×
47
                util::format("LinkTranslator unhandled list type: %1", m_origin_col_key.get_type()));
×
48
        }
×
49
    }
63,945✔
50
    else if (attr.test(col_attr_Set)) {
63,945✔
51
        if (m_origin_col_key.get_type() == col_type_Link) {
2,238✔
52
            LnkSet set = m_origin_obj.get_linkset(m_origin_col_key);
2,094✔
53
            on_set_of_links(set);
2,094✔
54
        }
2,094✔
55
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
144✔
56
            Set<Mixed> set = m_origin_obj.get_set<Mixed>(m_origin_col_key);
144✔
57
            on_set_of_mixed(set);
144✔
58
        }
144✔
UNCOV
59
        else {
×
UNCOV
60
            throw std::runtime_error(
×
61
                util::format("LinkTranslator unhandled set type: %1", m_origin_col_key.get_type()));
×
62
        }
×
63
    }
61,707✔
64
    else if (attr.test(col_attr_Dictionary)) {
61,707✔
65
        auto dict = m_origin_obj.get_dictionary(m_origin_col_key);
462✔
66
        on_dictionary(dict);
462✔
67
    }
462✔
68
    else {
61,245✔
69
        REALM_ASSERT_EX(!m_origin_col_key.is_collection(), m_origin_col_key);
61,245✔
70
        if (m_origin_col_key.get_type() == col_type_Link) {
61,245✔
71
            on_link_property(m_origin_col_key);
61,173✔
72
        }
61,173✔
73
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
72✔
74
            on_mixed_property(m_origin_col_key);
72✔
75
        }
72✔
UNCOV
76
        else {
×
UNCOV
77
            throw std::runtime_error(
×
78
                util::format("LinkTranslator unhandled property type: %1", m_origin_col_key.get_type()));
×
79
        }
×
80
    }
61,245✔
81
}
75,495✔
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

© 2025 Coveralls, Inc