GCC Code Coverage Report


Directory: ./
File: pdserv/src/Event.cpp
Date: 2025-08-17 04:10:43
Exec Total Coverage
Lines: 11 13 84.6%
Branches: 6 12 50.0%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright 2010 Richard Hacker (lerichi at gmx dot net)
4 *
5 * This file is part of the pdserv library.
6 *
7 * The pdserv library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation, either version 3 of the License, or (at
10 * your option) any later version.
11 *
12 * The pdserv library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the pdserv library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ****************************************************************************/
21
22 #include "Event.h"
23 #include "Config.h"
24
25 using namespace PdServ;
26
27 //////////////////////////////////////////////////////////////////////////////
28 314 Event::Event(const char *path, size_t nelem):
29 path(path),
30
2/4
✓ Branch 4 taken 314 times.
✗ Branch 5 not taken.
✓ Branch 12 taken 314 times.
✗ Branch 13 not taken.
314 messages(nelem)
31 {
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
314 if (nelem <= 0) {
33 throw std::invalid_argument(
34 "Event element count must be greater zero");
35 }
36 314 }
37
38 //////////////////////////////////////////////////////////////////////////////
39 314 Event::~Event()
40 {
41 314 }
42
43 //////////////////////////////////////////////////////////////////////////////
44 314 void Event::setTexts(const char * const *msg)
45 {
46
2/2
✓ Branch 2 taken 628 times.
✓ Branch 3 taken 314 times.
942 for (size_t i = 0; i < messages.size(); i++) {
47
1/2
✓ Branch 1 taken 628 times.
✗ Branch 2 not taken.
628 if (msg[i]) {
48 628 messages[i] = msg[i];
49 }
50 else {
51 messages[i].clear();
52 }
53 }
54 314 }
55