KD SOAP API Documentation: KDSoapValue.h Source File

| KD SOAP API Documentation 2.2

Loading...
Searching...
No Matches
KDSoapValue.h
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#ifndef KDSOAPVALUE_H
11#define KDSOAPVALUE_H
12
13#include "KDSoapGlobal.h"
14#include <QtCore/QList>
15#include <QtCore/QPair>
16#include <QtCore/QSet>
17#include <QtCore/QSharedDataPointer>
18#include <QtCore/QString>
19#include <QtCore/QVariant>
20#include <QtCore/QVector>
21#include <QtCore/QXmlStreamNamespaceDeclarations>
22
23#ifndef QT_NO_STL
24#include <algorithm>
25#endif
26
27class KDSoapValueList;
28class KDSoapNamespacePrefixes;
29QT_BEGIN_NAMESPACE
30class QXmlStreamWriter;
31QT_END_NAMESPACE
32
33 namespace KDSoap {
39 enum SoapVersion
40{
42 SOAP1_1 = 1,
44 SOAP1_2 = 2
45};
46}
47
59 class KDSOAP_EXPORT KDSoapValue
60{
61public:
66 KDSoapValue();
70 ~KDSoapValue();
71
80 KDSoapValue(const QString &name, const QVariant &valueVariant, const QString &typeNameSpace = QString(), const QString &typeName = QString());
89 KDSoapValue(const QString &name, const KDSoapValueList &childValues, const QString &typeNameSpace = QString(),
90 const QString &typeName = QString());
91
95 KDSoapValue(const KDSoapValue &other);
96
100 KDSoapValue &operator=(const KDSoapValue &other)
101 {
102 if (this != &other) {
103 KDSoapValue copy(other);
104 swap(copy);
105 }
106 return *this;
107 }
108
112 void swap(KDSoapValue &other)
113 {
114 d.swap(other.d);
115 }
116
121 bool isNull() const;
122
128 bool isNil() const;
129
134 void setNillable(bool nillable);
135
139 QString name() const;
140
144 QString namespaceUri() const;
145
149 void setNamespaceUri(const QString &ns);
150
154 QVariant value() const;
155
159 void setValue(const QVariant &value);
160
166 bool isQualified() const;
167
180 void setQualified(bool qualified);
181
186 KDSoapValueList &childValues() const;
187
191 bool operator==(const KDSoapValue &other) const;
192
196 bool operator!=(const KDSoapValue &other) const;
197
212 void setType(const QString &nameSpace, const QString &type);
217 QString typeNs() const;
222 QString type() const;
223
228 void setNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &namespaceDeclarations);
229
234 void addNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &namespaceDeclaration);
235
240 QXmlStreamNamespaceDeclarations namespaceDeclarations() const;
241
246 void setEnvironmentNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &environmentNamespaceDeclarations);
247
252 QXmlStreamNamespaceDeclarations environmentNamespaceDeclarations() const;
253
259 KDSoapValueList split() const;
260
265 enum Use
266 {
267 LiteralUse,
268 EncodedUse
269 };
270
271 QByteArray toXml(Use use = LiteralUse, const QString &messageNamespace = QString()) const;
272
273protected: // for KDSoapMessage
274 void setName(const QString &name);
275
276private:
277 // To catch mistakes
278 KDSoapValue(QString, QString, QString);
279
280 friend class KDSoapMessageWriter;
281 void writeElement(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace,
282 bool forceQualified) const;
283 void writeElementContents(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use,
284 const QString &messageNamespace) const;
285 void writeChildren(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace,
286 bool forceQualified) const;
287
288 class Private;
289 QSharedDataPointer<Private> d;
290};
291
292QT_BEGIN_NAMESPACE
293Q_DECLARE_TYPEINFO(KDSoapValue, Q_MOVABLE_TYPE);
294QT_END_NAMESPACE
295
296 KDSOAP_EXPORT QDebug operator<<(QDebug dbg, const KDSoapValue &value);
297
298 KDSOAP_EXPORT uint qHash(const KDSoapValue &value);
299 inline void qSwap(KDSoapValue &lhs, KDSoapValue &rhs)
300{
301 lhs.swap(rhs);
302}
303
304#ifndef QT_NO_STL
305 namespace std {
306template<>
307 inline void swap<KDSoapValue>(KDSoapValue &lhs, KDSoapValue &rhs)
308{
309 lhs.swap(rhs);
310}
311}
312#endif
313
320 class KDSOAP_EXPORT KDSoapValueList : public QList<KDSoapValue> // krazy:exclude=dpointer
321{
322public:
338 void addArgument(const QString &argumentName, const QVariant &argumentValue, const QString &typeNameSpace = QString(),
339 const QString &typeName = QString());
340
348 KDSoapValue child(const QString &name) const;
349
358 void setArrayType(const QString &nameSpace, const QString &type);
362 QString arrayTypeNs() const;
366 QString arrayType() const;
367
375 QList<KDSoapValue> &attributes()
376 {
377 return m_attributes;
378 }
382 const QList<KDSoapValue> &attributes() const
383 {
384 return m_attributes;
385 }
386
387private:
388 QPair<QString, QString> m_arrayType;
389 QList<KDSoapValue> m_attributes;
390
391 QVariant d; // for extensions
392};
393
394 typedef QListIterator<KDSoapValue> KDSoapValueListIterator;
395
396// Q_DECLARE_METATYPE(KDSoapValueList)
397
398#endif // KDSOAPVALUE_H
KDSoapGlobal.h
KDSOAP_EXPORT
#define KDSOAP_EXPORT
Definition KDSoapGlobal.h:22
KDSoapValueListIterator
QListIterator< KDSoapValue > KDSoapValueListIterator
Definition KDSoapValue.h:394
qSwap
void qSwap(KDSoapValue &lhs, KDSoapValue &rhs)
Definition KDSoapValue.h:299
operator<<
QT_END_NAMESPACE KDSOAP_EXPORT QDebug operator<<(QDebug dbg, const KDSoapValue &value)
Definition KDSoapValue.cpp:370
qHash
KDSOAP_EXPORT uint qHash(const KDSoapValue &value)
Definition KDSoapValue.cpp:49
Q_DECLARE_TYPEINFO
QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(KDSoapValue, Q_MOVABLE_TYPE)
KDSoapMessageWriter
Definition KDSoapMessageWriter_p.h:31
KDSoapNamespacePrefixes
Definition KDSoapNamespacePrefixes_p.h:20
KDSoapValueList
Definition KDSoapValue.h:321
KDSoapValueList::attributes
const QList< KDSoapValue > & attributes() const
Definition KDSoapValue.h:382
KDSoapValueList::attributes
QList< KDSoapValue > & attributes()
Definition KDSoapValue.h:375
KDSoapValue
Definition KDSoapValue.h:60
KDSoapValue::Use
Use
Definition KDSoapValue.h:266
KDSoapValue::LiteralUse
@ LiteralUse
data is serialized according to a given schema, no xsi:type attributes are written out
Definition KDSoapValue.h:267
KDSoapValue::swap
void swap(KDSoapValue &other)
Definition KDSoapValue.h:112
KDSoapValue::operator=
KDSoapValue & operator=(const KDSoapValue &other)
Definition KDSoapValue.h:100
KDSoap
Definition KDSoapValue.h:33
KDSoap::SoapVersion
SoapVersion
Definition KDSoapValue.h:40
KDSoap::SOAP1_1
@ SOAP1_1
Definition KDSoapValue.h:42
KDSoap::SOAP1_2
@ SOAP1_2
Definition KDSoapValue.h:44
std
Definition KDSoapValue.h:305
std::swap< KDSoapValue >
void swap< KDSoapValue >(KDSoapValue &lhs, KDSoapValue &rhs)
Definition KDSoapValue.h:307
QByteArray
QDebug
QList
QListIterator
QPair
QSharedDataPointer
QString
QVariant
QXmlStreamNamespaceDeclaration
QXmlStreamWriter

© 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