KD SOAP API Documentation: KDSoapFaultException.cpp Source File

| KD SOAP API Documentation 2.2

Loading...
Searching...
No Matches
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 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
13class KDSoapFaultException::Private : public QSharedData
14{
15public:
16 Private();
17
18public:
19 QString m_faultCode;
20 QString m_faultString;
21 QString m_faultActor;
22 KDSoapValue m_detailValue;
23};
24
25KDSoapFaultException::Private::Private()
26{
27}
28
29KDSoapFaultException::KDSoapFaultException()
30 : d(new Private())
31{
32}
33
34 KDSoapFaultException::KDSoapFaultException(const KDSoapFaultException &cpy)
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
47 KDSoapFaultException &KDSoapFaultException::operator=(const KDSoapFaultException &other)
48{
49 if (this == &other) {
50 return *this;
51 }
52
53 d = other.d;
54 return *this;
55}
56
57KDSoapFaultException::~KDSoapFaultException()
58{
59}
60
61 void KDSoapFaultException::deserialize(const KDSoapValue &mainValue)
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
78 QString KDSoapFaultException::faultCode() const
79{
80 return d->m_faultCode;
81}
82
83 const KDSoapValue &KDSoapFaultException::faultDetails(const KDSoapValue &faultValue)
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}
103 QString KDSoapFaultException::faultString() const
104{
105 return d->m_faultString;
106}
107
108 void KDSoapFaultException::setFaultString(const QString &faultString)
109{
110 d->m_faultString = faultString;
111}
112
113 QString KDSoapFaultException::faultActor() const
114{
115 return d->m_faultActor;
116}
117
118 void KDSoapFaultException::setFaultActor(const QString &faultActor)
119{
120 d->m_faultActor = faultActor;
121}
122
123 KDSoapValue KDSoapFaultException::detailValue() const
124{
125 return d->m_detailValue;
126}
127
128 void KDSoapFaultException::setDetailValue(const KDSoapValue &detailValue)
129{
130 d->m_detailValue = detailValue;
131}
KDSoapFaultException.h
KDSoapFaultException
Definition KDSoapFaultException.h:26
KDSoapFaultException::setFaultCode
void setFaultCode(const QString &faultCode)
Definition KDSoapFaultException.cpp:99
KDSoapFaultException::setFaultString
void setFaultString(const QString &faultString)
Definition KDSoapFaultException.cpp:108
KDSoapFaultException::~KDSoapFaultException
~KDSoapFaultException()
Definition KDSoapFaultException.cpp:57
KDSoapFaultException::deserialize
void deserialize(const KDSoapValue &mainValue)
Definition KDSoapFaultException.cpp:61
KDSoapFaultException::setDetailValue
void setDetailValue(const KDSoapValue &detailValue)
Definition KDSoapFaultException.cpp:128
KDSoapFaultException::detailValue
KDSoapValue detailValue() const
Definition KDSoapFaultException.cpp:123
KDSoapFaultException::operator=
KDSoapFaultException & operator=(const KDSoapFaultException &other)
Definition KDSoapFaultException.cpp:47
KDSoapFaultException::setFaultActor
void setFaultActor(const QString &faultActor)
Definition KDSoapFaultException.cpp:118
KDSoapFaultException::KDSoapFaultException
KDSoapFaultException()
Definition KDSoapFaultException.cpp:29
KDSoapFaultException::faultCode
QString faultCode() const
Definition KDSoapFaultException.cpp:78
KDSoapFaultException::faultDetails
static const KDSoapValue & faultDetails(const KDSoapValue &faultValue)
Definition KDSoapFaultException.cpp:83
KDSoapFaultException::faultString
QString faultString() const
Definition KDSoapFaultException.cpp:103
KDSoapFaultException::faultActor
QString faultActor() const
Definition KDSoapFaultException.cpp:113
KDSoapValueList
Definition KDSoapValue.h:321
KDSoapValue
Definition KDSoapValue.h:60
KDSoapValue::childValues
KDSoapValueList & childValues() const
Definition KDSoapValue.cpp:149
KDSoapValue::value
QVariant value() const
Definition KDSoapValue.cpp:104
KDSoapValue::name
QString name() const
Definition KDSoapValue.cpp:94
QLatin1String
QList::at
const T & at(int i) const const
QList::count
int count(const T &value) const const
QSharedData
QString
QVariant::value
T value() const const

© 2010-2024 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 Sun Jan 7 2024 11:47:36 for KD SOAP API Documentation by doxygen 1.9.8