-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoutput_remarks.cc
67 lines (57 loc) · 1.53 KB
/
output_remarks.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright (C) 2019 SUSE Software Solutions Germany GmbH
*
* This file is part of klp-ccp.
*
* klp-ccp is free software: you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* klp-ccp is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with klp-ccp. If not, see <https://www.gnu.org/licenses/>.
*/
#include <ostream>
#include "output_remarks.hh"
using namespace klp::ccp;
void output_remarks::add(const output_remark &r)
{
_remarks.push_back(r);
}
void output_remarks::add(output_remark &&r)
{
_remarks.push_back(std::move(r));
}
void output_remarks::clear() noexcept
{
_remarks.clear();
}
bool output_remarks::empty() const noexcept
{
return _remarks.empty();
}
bool output_remarks::any_fatal() const noexcept
{
for(auto &&r : _remarks) {
if (r.get_severity() == output_remark::severity::fatal)
return true;
}
return false;
}
output_remarks& output_remarks::operator+=(const output_remarks &remarks)
{
_remarks.insert(_remarks.end(),
remarks._remarks.begin(), remarks._remarks.end());
return *this;
}
std::ostream& klp::ccp::operator<<(std::ostream &o, const output_remarks &rs)
{
for(auto &&r : rs._remarks) {
o << r;
}
return o;
}