GCC Code Coverage Report


Directory: ./
File: pdserv/src/Event.cpp
Date: 2024-11-17 04:08:36
Exec Total Coverage
Lines: 5 5 100.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright 2010 Richard Hacker (lerichi at gmx dot net)
6 *
7 * This file is part of the pdserv library.
8 *
9 * The pdserv library is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation, either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * The pdserv library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the pdserv library. If not, see <http://www.gnu.org/licenses/>.
21 *
22 *****************************************************************************/
23
24 #include "Event.h"
25 #include "Config.h"
26
27 using namespace PdServ;
28
29 ////////////////////////////////////////////////////////////////////////////
30 ////////////////////////////////////////////////////////////////////////////
31 314 Event::Event(const char *path, size_t nelem, const char * const *messages):
32 path(path),
33 nelem(nelem),
34
1/2
✓ Branch 4 taken 314 times.
✗ Branch 5 not taken.
314 message(messages)
35 {
36 314 }
37
38 ////////////////////////////////////////////////////////////////////////////
39 314 Event::~Event()
40 {
41 314 }
42
43 // ////////////////////////////////////////////////////////////////////////////
44 // std::string Event::formatMessage(size_t index) const
45 // {
46 // std::string message = this->message;
47 //
48 // // Replace occurrances of %m with messages from 'indexmapping'
49 // size_t i = message.find("%m");
50 // if (i != message.npos) {
51 // IndexMap::const_iterator it = indexMap.find(index);
52 //
53 // if (it != indexMap.end())
54 // message.replace(i, 2, it->second);
55 // }
56 //
57 // // Replace occurrances of %i with index, possibly offset by 'indexoffset'
58 // i = message.find("%i");
59 // if (i != message.npos) {
60 // std::ostringstream os;
61 // os << (int)index + indexOffset;
62 // message.replace(i, 2, os.str());
63 // }
64 //
65 // return message;
66 // }
67
68 // ////////////////////////////////////////////////////////////////////////////
69 // std::string Event::formatMessage(const Config& config, size_t index) const
70 // {
71 // std::string message = config["message"].toString();
72 //
73 // // Replace occurrances of %m with messages from 'indexmapping'
74 // size_t i = message.find("%m");
75 // if (i != message.npos) {
76 // std::ostringstream os;
77 // os << index;
78 // std::string mapping = config["indexmapping"][os.str()].toString();
79 //
80 // if (!message.empty())
81 // message.replace(i, 2, mapping);
82 // }
83 //
84 // // Replace occurrances of %i with index, possibly offset by 'indexoffset'
85 // i = message.find("%i");
86 // if (i != message.npos) {
87 // std::ostringstream os;
88 // os << index + config["indexoffset"].toInt();
89 // message.replace(i, 2, os.str());
90 // }
91 //
92 // return message;
93 // }
94