KD Reports API Documentation  2.1
KDReportsErrorDetails.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Reports library.
4 **
5 ** SPDX-FileCopyrightText: 2007-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDAB-KDReports OR LicenseRef-KDAB-KDReports-US
8 **
9 ** Licensees holding valid commercial KD Reports licenses may use this file in
10 ** accordance with the KD Reports Commercial License Agreement provided with
11 ** the Software.
12 **
13 ** Contact info@kdab.com if any conditions of this licensing are not clear to you.
14 **
15 ****************************************************************************/
16 
17 #include "KDReportsErrorDetails.h"
19 #include <QObject>
20 
22  : d(new ErrorDetailsPrivate)
23 {
24 }
25 
27  : d(new ErrorDetailsPrivate)
28 {
30 }
31 
33 {
34  if (!hasError()) {
35  return QString();
36  }
37 
38  if (d->m_line != -1) {
39  return QObject::tr("Error on line %1, column %2: %3").arg(line()).arg(column()).arg(driverMessage());
40  } else {
41  return driverMessage();
42  }
43 }
44 
46 {
47  return d->m_line;
48 }
49 
51 {
52  return d->m_column;
53 }
54 
56 {
57  return d->m_hasError;
58 }
59 
61 {
62  return d->m_message;
63 }
64 
66 {
67  d->m_hasError = true;
68  d->m_line = line;
69 }
70 
72 {
73  d->m_hasError = true;
74  d->m_column = column;
75 }
76 
78 {
79  d->m_hasError = true;
80  d->m_message = message;
81 }
82 
84 {
85 }
86 
88  : d(new ErrorDetailsPrivate(*other.d))
89 {
90 }
91 
93 {
94  ErrorDetails copy(other);
95  swap(copy);
96  return *this;
97 }
98 
100 {
101  qSwap(d, other.d);
102 }
KDReports::ErrorDetails::setLine
void setLine(int line)
Definition: KDReportsErrorDetails.cpp:65
KDReports::ErrorDetails::swap
void swap(ErrorDetails &other)
Definition: KDReportsErrorDetails.cpp:99
KDReportsErrorDetails_p.h
KDReports::ErrorDetails::ErrorDetails
ErrorDetails()
Definition: KDReportsErrorDetails.cpp:21
KDReportsErrorDetails.h
KDReports::ErrorDetails::operator=
ErrorDetails & operator=(const ErrorDetails &other)
Definition: KDReportsErrorDetails.cpp:92
KDReports::ErrorDetails::setColumn
void setColumn(int column)
Definition: KDReportsErrorDetails.cpp:71
QString
KDReports::ErrorDetails::column
int column() const
Definition: KDReportsErrorDetails.cpp:50
KDReports::ErrorDetails::~ErrorDetails
~ErrorDetails()
Definition: KDReportsErrorDetails.cpp:83
KDReports::ErrorDetails::line
int line() const
Definition: KDReportsErrorDetails.cpp:45
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
KDReports::ErrorDetailsPrivate
Definition: KDReportsErrorDetails_p.h:37
KDReports::ErrorDetails::driverMessage
QString driverMessage() const
Definition: KDReportsErrorDetails.cpp:60
qSwap
QT_BEGIN_NAMESPACE void qSwap(KDReports::ErrorDetails &lhs, KDReports::ErrorDetails &rhs)
Definition: KDReportsErrorDetails.h:74
KDReports::ErrorDetails
Definition: KDReportsErrorDetails.h:32
KDReports::ErrorDetails::message
QString message() const
Definition: KDReportsErrorDetails.cpp:32
KDReports::ErrorDetails::setDriverMessage
void setDriverMessage(const QString &message)
Definition: KDReportsErrorDetails.cpp:77
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
KDReports::ErrorDetails::hasError
bool hasError() const
Definition: KDReportsErrorDetails.cpp:55

© 2007-2021 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated on Fri Jul 15 2022 13:09:06 for KD Reports API Documentation by doxygen 1.8.20