KD SOAP API Documentation  2.1
KDSoapFaultException.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Soap project.
4 **
5 ** SPDX-FileCopyrightText: 2010-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #include "KDSoapFaultException.h"
12 
13 class KDSoapFaultException::Private : public QSharedData
14 {
15 public:
16  Private();
17 
18 public:
19  QString m_faultCode;
20  QString m_faultString;
21  QString m_faultActor;
22  KDSoapValue m_detailValue;
23 };
24 
25 KDSoapFaultException::Private::Private()
26 {
27 }
28 
30  : d(new Private())
31 {
32 }
33 
35  : d(cpy.d)
36 {
37 }
38 
39 KDSoapFaultException::KDSoapFaultException(const QString &faultCode, const QString &faultString, const QString &faultActor)
40  : d(new Private())
41 {
42  d->m_faultCode = faultCode;
43  d->m_faultString = faultString;
44  d->m_faultActor = faultActor;
45 }
46 
48 {
49  if (this == &other) {
50  return *this;
51  }
52 
53  d = other.d;
54  return *this;
55 }
56 
58 {
59 }
60 
62 {
63  Q_ASSERT(mainValue.name() == QLatin1String("Fault"));
64  const KDSoapValueList &args = mainValue.childValues();
65  for (int argNr = 0; argNr < args.count(); ++argNr) {
66  const KDSoapValue &val = args.at(argNr);
67  const QString name = val.name();
68  if (name == QLatin1String("faultcode")) {
69  d->m_faultCode = val.value().value<QString>();
70  } else if (name == QLatin1String("faultstring")) {
71  d->m_faultString = val.value().value<QString>();
72  } else if (name == QLatin1String("faultactor")) {
73  d->m_faultActor = val.value().value<QString>();
74  }
75  }
76 }
77 
79 {
80  return d->m_faultCode;
81 }
82 
84 {
85  static KDSoapValue emptyValue;
86 
87  // Find and return the <detail> element under faultElement
88  const KDSoapValueList &args = faultValue.childValues();
89  for (int argNr = 0; argNr < args.count(); ++argNr) {
90  const KDSoapValue &val = args.at(argNr);
91  const QString name = val.name();
92  if (name == QLatin1String("detail")) {
93  return val;
94  }
95  }
96  return emptyValue;
97 }
98 
99 void KDSoapFaultException::setFaultCode(const QString &faultCode)
100 {
101  d->m_faultCode = faultCode;
102 }
104 {
105  return d->m_faultString;
106 }
107 
108 void KDSoapFaultException::setFaultString(const QString &faultString)
109 {
110  d->m_faultString = faultString;
111 }
112 
114 {
115  return d->m_faultActor;
116 }
117 
118 void KDSoapFaultException::setFaultActor(const QString &faultActor)
119 {
120  d->m_faultActor = faultActor;
121 }
122 
124 {
125  return d->m_detailValue;
126 }
127 
129 {
130  d->m_detailValue = detailValue;
131 }
void setFaultCode(const QString &faultCode)
void setFaultString(const QString &faultString)
void deserialize(const KDSoapValue &mainValue)
void setDetailValue(const KDSoapValue &detailValue)
KDSoapValue detailValue() const
KDSoapFaultException & operator=(const KDSoapFaultException &other)
void setFaultActor(const QString &faultActor)
static const KDSoapValue & faultDetails(const KDSoapValue &faultValue)
KDSoapValueList & childValues() const
QVariant value() const
QString name() const
Definition: KDSoapValue.cpp:94

© 2010-2022 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-soap/
Generated on Tue Jun 13 2023 12:18:34 for KD SOAP API Documentation by doxygen 1.9.1