GCC Code Coverage Report


Directory: ./
File: QtPdCom1/Message.h
Date: 2024-01-26 10:40:55
Exec Total Coverage
Lines: 1 3 33.3%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2009-2023 Florian Pose <fp@igh.de>
4 *
5 * This file is part of the QtPdCom library.
6 *
7 * The QtPdCom 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 by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The QtPdCom 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 QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ****************************************************************************/
21
22 #ifndef QTPDCOM_MESSAGE_H
23 #define QTPDCOM_MESSAGE_H
24
25 #include "Export.h"
26
27 #include <QObject>
28
29 #include <memory>
30
31 namespace QtPdCom {
32
33 /****************************************************************************/
34
35 /** Process message.
36 */
37 class QTPDCOM_PUBLIC Message:
38 public QObject
39 {
40 Q_OBJECT
41
42 friend class MessageModel;
43
44 public:
45 /** Message type.
46 */
47 enum Type {
48 Information, /**< Non-critical information. */
49 Warning, /**< Warning, that does not influence
50 the process flow. */
51 Error, /**< Error, that influences the process flow. */
52 Critical /**< Critical error, that makes the process
53 unable to run. */
54 };
55 Q_ENUM(Type);
56
57 Message(QObject *parent = nullptr);
58 ~Message();
59
60 bool isActive() const;
61 double getTime() const;
62 Type getType() const;
63 const QString &getPath() const;
64 int getIndex() const;
65 QString getText(const QString & = QString()) const;
66 QString getDescription(const QString & = QString()) const;
67 QString getTimeString() const;
68
69 /** Exception type.
70 */
71 struct Exception {
72 /** Constructor.
73 */
74 Exception(const QString &msg): msg(msg) {}
75 QString msg; /**< Exception message. */
76 };
77
78 signals:
79 void stateChanged();
80
81 private:
82 class Q_DECL_HIDDEN Impl;
83 std::unique_ptr<Impl> impl;
84 };
85
86 /****************************************************************************/
87
88 } // namespace
89
90
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 1 times.
8 Q_DECLARE_METATYPE(const QtPdCom::Message*)
91
92 #endif
93