KD SOAP: /home/allen/projects/kdsoap/src/KDSoapClient/KDSoapValue.h Source File

| KD SOAP 2.0.0

KDSoapValue.h
1 /****************************************************************************
2 **
3 ** This file is part of the KD Soap library.
4 **
5 ** SPDX-FileCopyrightText: 2010-2021 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-KDSoap OR LicenseRef-KDAB-KDSoap-US
8 **
9 ** Licensees holding valid commercial KD Soap licenses may use this file in
10 ** accordance with the KD Soap 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 #ifndef KDSOAPVALUE_H
17 #define KDSOAPVALUE_H
18
19 #include <QtCore/QString>
20 #include <QtCore/QVariant>
21 #include <QtCore/QList>
22 #include <QtCore/QPair>
23 #include <QtCore/QSet>
24 #include <QtCore/QVector>
25 #include <QtCore/QSharedDataPointer>
26 #include <QtCore/QXmlStreamNamespaceDeclarations>
27 #include "KDSoapGlobal.h"
28
29 #ifndef QT_NO_STL
30 #include <algorithm>
31 #endif
32
33 class KDSoapValueList;
34 class KDSoapNamespacePrefixes;
35 QT_BEGIN_NAMESPACE
36 class QXmlStreamWriter;
37 QT_END_NAMESPACE
38
39 namespace KDSoap {
45 enum SoapVersion
46 {
48 SOAP1_1 = 1,
50 SOAP1_2 = 2
51 };
52 }
53
65 class KDSOAP_EXPORT KDSoapValue
66 {
67 public:
72 KDSoapValue();
76 ~KDSoapValue();
77
86 KDSoapValue(const QString &name, const QVariant &valueVariant, const QString &typeNameSpace = QString(), const QString &typeName = QString());
95 KDSoapValue(const QString &name, const KDSoapValueList &childValues, const QString &typeNameSpace = QString(),
96 const QString &typeName = QString());
97
101 KDSoapValue(const KDSoapValue &other);
102
106 KDSoapValue &operator=(const KDSoapValue &other)
107 {
108 if (this != &other) {
109 KDSoapValue copy(other);
110 swap(copy);
111 }
112 return *this;
113 }
114
118 void swap(KDSoapValue &other)
119 {
120 d.swap(other.d);
121 }
122
127 bool isNull() const;
128
134 bool isNil() const;
135
140 void setNillable(bool nillable);
141
145 QString name() const;
146
150 QString namespaceUri() const;
151
155 void setNamespaceUri(const QString &ns);
156
160 QVariant value() const;
161
165 void setValue(const QVariant &value);
166
172 bool isQualified() const;
173
186 void setQualified(bool qualified);
187
192 KDSoapValueList &childValues() const;
193
197 bool operator==(const KDSoapValue &other) const;
198
202 bool operator!=(const KDSoapValue &other) const;
203
218 void setType(const QString &nameSpace, const QString &type);
223 QString typeNs() const;
228 QString type() const;
229
234 void setNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &namespaceDeclarations);
235
240 void addNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &namespaceDeclaration);
241
246 QXmlStreamNamespaceDeclarations namespaceDeclarations() const;
247
252 void setEnvironmentNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &environmentNamespaceDeclarations);
253
258 QXmlStreamNamespaceDeclarations environmentNamespaceDeclarations() const;
259
265 KDSoapValueList split() const;
266
271 enum Use
272 {
273 LiteralUse,
274 EncodedUse
275 };
276
277 QByteArray toXml(Use use = LiteralUse, const QString &messageNamespace = QString()) const;
278
279 protected: // for KDSoapMessage
280 void setName(const QString &name);
281
282 private:
283 // To catch mistakes
284 KDSoapValue(QString, QString, QString);
285
286 friend class KDSoapMessageWriter;
287 void writeElement(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace,
288 bool forceQualified) const;
289 void writeElementContents(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use,
290 const QString &messageNamespace) const;
291 void writeChildren(KDSoapNamespacePrefixes &namespacePrefixes, QXmlStreamWriter &writer, KDSoapValue::Use use, const QString &messageNamespace,
292 bool forceQualified) const;
293
294 class Private;
295 QSharedDataPointer<Private> d;
296 };
297
298 QT_BEGIN_NAMESPACE
299 Q_DECLARE_TYPEINFO(KDSoapValue, Q_MOVABLE_TYPE);
300 QT_END_NAMESPACE
301
302 KDSOAP_EXPORT QDebug operator<<(QDebug dbg, const KDSoapValue &value);
303
304 KDSOAP_EXPORT uint qHash(const KDSoapValue &value);
305 inline void qSwap(KDSoapValue &lhs, KDSoapValue &rhs)
306 {
307 lhs.swap(rhs);
308 }
309
310 #ifndef QT_NO_STL
311 namespace std {
312 template<>
313 inline void swap<KDSoapValue>(KDSoapValue &lhs, KDSoapValue &rhs)
314 {
315 lhs.swap(rhs);
316 }
317 }
318 #endif
319
326 class KDSOAP_EXPORT KDSoapValueList : public QList<KDSoapValue> // krazy:exclude=dpointer
327 {
328 public:
344 void addArgument(const QString &argumentName, const QVariant &argumentValue, const QString &typeNameSpace = QString(),
345 const QString &typeName = QString());
346
354 KDSoapValue child(const QString &name) const;
355
364 void setArrayType(const QString &nameSpace, const QString &type);
368 QString arrayTypeNs() const;
372 QString arrayType() const;
373
381 QList<KDSoapValue> &attributes()
382 {
383 return m_attributes;
384 }
388 const QList<KDSoapValue> &attributes() const
389 {
390 return m_attributes;
391 }
392
393 private:
394 QPair<QString, QString> m_arrayType;
395 QList<KDSoapValue> m_attributes;
396
397 QVariant d; // for extensions
398 };
399
400 typedef QListIterator<KDSoapValue> KDSoapValueListIterator;
401
402 // Q_DECLARE_METATYPE(KDSoapValueList)
403
404 #endif // KDSOAPVALUE_H
KDSoapValue::LiteralUse
@ LiteralUse
data is serialized according to a given schema, no xsi:type attributes are written out
Definition: KDSoapValue.h:273
QXmlStreamNamespaceDeclaration
KDSoapValue::swap
void swap(KDSoapValue &other)
Definition: KDSoapValue.h:118
KDSoapValue
Definition: KDSoapValue.h:66
QSharedDataPointer< Private >
QDebug
KDSoapValue::operator=
KDSoapValue & operator=(const KDSoapValue &other)
Definition: KDSoapValue.h:106
QList
KDSoapValue::Use
Use
Definition: KDSoapValue.h:272
QString
QXmlStreamWriter
KDSoapValueList
Definition: KDSoapValue.h:327
KDSoapValueList::attributes
const QList< KDSoapValue > & attributes() const
Definition: KDSoapValue.h:388
QVariant
KDSoapValueList::attributes
QList< KDSoapValue > & attributes()
Definition: KDSoapValue.h:381
QPair< QString, QString >
QByteArray
QListIterator

© 2010-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-soap/
Generated on Wed Jun 30 2021 18:19:27 for KD SOAP by doxygen 1.8.20