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

xlnt-community / xlnt / aa719a12-330c-47b2-9460-5b2d61336ff6

03 Feb 2025 05:39PM UTC coverage: 81.978% (-1.5%) from 83.482%
aa719a12-330c-47b2-9460-5b2d61336ff6

push

circleci

web-flow
Use C++23 for generating coverage report. (#57)

Using C++23 for coverage reporting, prepares the library for coverage
testing of future post-C++11 features.

This PR makes as few changes as possible to ensure all coverage changes
are due to the changed C++/compiler version used for generating the
coverage report.

Temporarily disable warnings as errors for coverage reporting until
better C++20/23 support is added in PR #55.

11395 of 13900 relevant lines covered (81.98%)

1202684.1 hits per line

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

57.14
./source/styles/conditional_format.cpp
1
// Copyright (c) 2014-2022 Thomas Fussell
2
// Copyright (c) 2010-2015 openpyxl
3
// Copyright (c) 2024-2025 xlnt-community
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
// THE SOFTWARE
22
//
23
// @license: http://www.opensource.org/licenses/mit-license.php
24
// @author: see AUTHORS file
25

26
#include <xlnt/styles/border.hpp>
27
#include <xlnt/styles/conditional_format.hpp>
28
#include <xlnt/styles/fill.hpp>
29
#include <xlnt/styles/font.hpp>
30
#include <detail/implementations/conditional_format_impl.hpp>
31
#include <detail/implementations/stylesheet.hpp>
32

33
namespace xlnt {
34

35
condition condition::text_starts_with(const std::string &text)
×
36
{
37
    condition c;
×
38
    c.type_ = type::contains_text;
×
39
    c.operator_ = condition_operator::starts_with;
×
40
    c.text_comparand_ = text;
×
41
    return c;
×
42
}
×
43

44
condition condition::text_ends_with(const std::string &text)
×
45
{
46
    condition c;
×
47
    c.type_ = type::contains_text;
×
48
    c.operator_ = condition_operator::ends_with;
×
49
    c.text_comparand_ = text;
×
50
    return c;
×
51
}
×
52

53
condition condition::text_contains(const std::string &text)
1✔
54
{
55
    condition c;
1✔
56
    c.type_ = type::contains_text;
1✔
57
    c.operator_ = condition_operator::contains;
1✔
58
    c.text_comparand_ = text;
1✔
59
    return c;
1✔
60
}
×
61

62
condition condition::text_does_not_contain(const std::string &text)
×
63
{
64
    condition c;
×
65
    c.type_ = type::contains_text;
×
66
    c.operator_ = condition_operator::does_not_contain;
×
67
    c.text_comparand_ = text;
×
68
    return c;
×
69
}
×
70

71
conditional_format::conditional_format(detail::conditional_format_impl *d)
1✔
72
    : d_(d)
1✔
73
{
74
}
1✔
75

76
bool conditional_format::operator==(const conditional_format &other) const
1✔
77
{
78
    return d_ == other.d_;
1✔
79
}
80

81
bool conditional_format::operator!=(const conditional_format &other) const
×
82
{
83
    return !(*this == other);
×
84
}
85

86
bool conditional_format::has_border() const
2✔
87
{
88
    return d_->border_id.is_set();
2✔
89
}
90

91
xlnt::border conditional_format::border() const
1✔
92
{
93
    return d_->parent->borders.at(d_->border_id.get());
1✔
94
}
95

96
conditional_format conditional_format::border(const xlnt::border &new_border)
1✔
97
{
98
    d_->border_id = d_->parent->find_or_add(d_->parent->borders, new_border);
1✔
99
    return *this;
1✔
100
}
101

102
bool conditional_format::has_fill() const
2✔
103
{
104
    return d_->fill_id.is_set();
2✔
105
}
106

107
xlnt::fill conditional_format::fill() const
1✔
108
{
109
    return d_->parent->fills.at(d_->fill_id.get());
1✔
110
}
111

112
conditional_format conditional_format::fill(const xlnt::fill &new_fill)
1✔
113
{
114
    d_->fill_id = d_->parent->find_or_add(d_->parent->fills, new_fill);
1✔
115
    return *this;
1✔
116
}
117

118
bool conditional_format::has_font() const
2✔
119
{
120
    return d_->font_id.is_set();
2✔
121
}
122

123
xlnt::font conditional_format::font() const
1✔
124
{
125
    return d_->parent->fonts.at(d_->font_id.get());
1✔
126
}
127

128
conditional_format conditional_format::font(const xlnt::font &new_font)
1✔
129
{
130
    d_->font_id = d_->parent->find_or_add(d_->parent->fonts, new_font);
1✔
131
    return *this;
1✔
132
}
133

134
} // namespace xlnt
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