KD SOAP API Documentation: KDSoapValue Class Reference

| KD SOAP API Documentation 2.2

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDSoapValue Class Reference

`#include <KDSoapValue.h>`

Inheritance diagram for KDSoapValue:
[legend]

## Public Types
enum | Use { LiteralUse , EncodedUse }

## Public Member Functions
| KDSoapValue ()
| KDSoapValue (const KDSoapValue &other)
| KDSoapValue (const QString &name, const KDSoapValueList &childValues, const QString &typeNameSpace=QString(), const QString &typeName=QString())
| KDSoapValue (const QString &name, const QVariant &valueVariant, const QString &typeNameSpace=QString(), const QString &typeName=QString())
| ~KDSoapValue ()
void | addNamespaceDeclaration (const QXmlStreamNamespaceDeclaration &namespaceDeclaration)
KDSoapValueList & | childValues () const
QXmlStreamNamespaceDeclarations | environmentNamespaceDeclarations () const
bool | isNil () const
bool | isNull () const
bool | isQualified () const
QString | name () const
QXmlStreamNamespaceDeclarations | namespaceDeclarations () const
QString | namespaceUri () const
bool | operator!= (const KDSoapValue &other) const
KDSoapValue & | operator= (const KDSoapValue &other)
bool | operator== (const KDSoapValue &other) const
void | setEnvironmentNamespaceDeclarations (const QXmlStreamNamespaceDeclarations &environmentNamespaceDeclarations)
void | setNamespaceDeclarations (const QXmlStreamNamespaceDeclarations &namespaceDeclarations)
void | setNamespaceUri (const QString &ns)
void | setNillable (bool nillable)
void | setQualified (bool qualified)
void | setType (const QString &nameSpace, const QString &type)
void | setValue (const QVariant &value)
KDSoapValueList | split () const
void | swap (KDSoapValue &other)
QByteArray | toXml (Use use=LiteralUse, const QString &messageNamespace=QString()) const
QString | type () const
QString | typeNs () const
QVariant | value () const

## Protected Member Functions
void | setName (const QString &name)

## Detailed Description

KDSoapValue represents a value in a SOAP argument list. It is composed of the argument name, and actual value as a QVariant.

Optionally, the type name can be set (will become the `xsi:type` attribute, which gives type information at runtime).

In terms of the actual XML being sent or received, this represents one XML element or one XML attribute. childValues() contains the child XML elements of this XML element.

Definition at line 59 of file KDSoapValue.h.

## Member Enumeration Documentation

## ◆ Use

enum KDSoapValue::Use

Defines the way the message should be serialized. See the "use" attribute for soap:body, in the WSDL file.

Enumerator
LiteralUse | data is serialized according to a given schema, no `xsi:type` attributes are written out
EncodedUse | each message part references an abstract type using the `xsi:type` attribute

Definition at line 265 of file KDSoapValue.h.

## Constructor & Destructor Documentation

## ◆ KDSoapValue() [1/4]

KDSoapValue::KDSoapValue | ( |  | ) |

Constructs an empty KDSoapValue. This usually indicates an error, e.g. when KDSoapValueList::child() doesn't find the child.

Definition at line 54 of file KDSoapValue.cpp.

## ◆ ~KDSoapValue()

KDSoapValue::~KDSoapValue | ( |  | ) |

Destructor.

Definition at line 70 of file KDSoapValue.cpp.

## ◆ KDSoapValue() [2/4]

KDSoapValue::KDSoapValue | ( | const QString & | name,
|  | const QVariant & | valueVariant,
|  | const QString & | typeNameSpace = `QString()`,
|  | const QString & | typeName = `QString()`
| ) |  |

Constructs a value from a QVariant.

Parameters

  name | the argument name (which corresponds to the element or attribute name in the XML)
  valueVariant | the value of the argument
  typeNameSpace | namespace of the type of this value; this is only useful if using KDSoapMessage::EncodedUse
  typeName | localname of the type of this value; this is only useful if using KDSoapMessage::EncodedUse

Definition at line 59 of file KDSoapValue.cpp.

## ◆ KDSoapValue() [3/4]

KDSoapValue::KDSoapValue | ( | const QString & | name,
|  | const KDSoapValueList & | childValues,
|  | const QString & | typeNameSpace = `QString()`,
|  | const QString & | typeName = `QString()`
| ) |  |

Constructs a "complex" value with child values

Parameters

  name | the argument name (which corresponds to the element or attribute name in the XML)
  childValues | the child elements and the attributes of this value.
  typeNameSpace | namespace of the type of this value; this is only useful if using KDSoapMessage::EncodedUse
  typeName | localname of the type of this value; this is only useful if using KDSoapMessage::EncodedUse

Definition at line 64 of file KDSoapValue.cpp.

## ◆ KDSoapValue() [4/4]

KDSoapValue::KDSoapValue | ( | const KDSoapValue & | other | ) |

Copy constructor

Definition at line 74 of file KDSoapValue.cpp.

## Member Function Documentation

## ◆ addNamespaceDeclaration()

void KDSoapValue::addNamespaceDeclaration | ( | const QXmlStreamNamespaceDeclaration & | namespaceDeclaration | ) |

Adds a `namespaceDeclaration` to the existing list of namespaceDeclarations.

Since
  1.8

Definition at line 129 of file KDSoapValue.cpp.

Referenced by KDQName::toSoapValue().

## ◆ childValues()

KDSoapValueList & KDSoapValue::childValues | ( |  | ) | const

Returns the list of child values (elements and attributes). The list is a reference, and can therefore be modified.

Definition at line 149 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::addArgument(), KDSoapMessage::addArgument(), KDSoapMessage::arguments(), KDSoapMessage::arguments(), KDSoapFaultException::deserialize(), KDSoapMessage::faultAsString(), KDSoapFaultException::faultDetails(), operator<<(), and parseElement().

## ◆ environmentNamespaceDeclarations()

QXmlStreamNamespaceDeclarations KDSoapValue::environmentNamespaceDeclarations | ( |  | ) | const

Returns the namespaceDeclarations of this value and its parents combined as it was during parsing of the message

Since
  1.8

Definition at line 144 of file KDSoapValue.cpp.

Referenced by KDQName::fromSoapValue(), and setEnvironmentNamespaceDeclarations().

## ◆ isNil()

bool KDSoapValue::isNil | ( |  | ) | const

Returns true if this KDSoapValue has a name, but no content. I.e. if the value is nillable, xsi:nil will be set to true.

Since
  1.4

Definition at line 84 of file KDSoapValue.cpp.

Referenced by isNull(), and KDSoapMessageWriter::messageToXml().

## ◆ isNull()

bool KDSoapValue::isNull | ( |  | ) | const

Returns true if this KDSoapValue was created with the default constructor (no name and is nil)

Definition at line 79 of file KDSoapValue.cpp.

References isNil().

Referenced by KDSoapMessageAddressingProperties::addReferenceParameter(), and KDSoapMessage::faultAsString().

## ◆ isQualified()

bool KDSoapValue::isQualified | ( |  | ) | const

Whether the element should be qualified in the XML. See setQualified()

Since
  1.2

Definition at line 114 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::addArgument(), and KDSoapMessage::addArgument().

## ◆ name()

QString KDSoapValue::name | ( |  | ) | const

Returns the name of the argument, as passed to the constructor.

Definition at line 94 of file KDSoapValue.cpp.

Referenced by KDSoapFaultException::deserialize(), KDSoapFaultException::faultDetails(), KDSoapHeaders::header(), KDSoapHeaders::header(), KDSoapMessageWriter::messageToXml(), operator<<(), KDSoapServerObjectInterface::processRequest(), KDSoapServerObjectInterface::processRequestWithPath(), qHash(), setName(), and KDSoapMessageReader::xmlToMessage().

## ◆ namespaceDeclarations()

QXmlStreamNamespaceDeclarations KDSoapValue::namespaceDeclarations | ( |  | ) | const

Returns the namespaceDeclarations of this value as it was during parsing of the message

Since
  1.8

Definition at line 134 of file KDSoapValue.cpp.

Referenced by setNamespaceDeclarations().

## ◆ namespaceUri()

QString KDSoapValue::namespaceUri | ( |  | ) | const

Returns the namespace of this argument, if it differs from the "message namespace".

Definition at line 457 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::faultAsString(), KDSoapHeaders::header(), KDSoapMessageWriter::messageToXml(), and KDSoapMessageReader::xmlToMessage().

## ◆ operator!=()

bool KDSoapValue::operator!= | ( | const KDSoapValue & | other | ) | const

Compares two KDSoapValues.

Definition at line 160 of file KDSoapValue.cpp.

## ◆ operator=()

KDSoapValue & KDSoapValue::operator= | ( | const KDSoapValue & | other | ) |
| inline

Assignment operator

Definition at line 100 of file KDSoapValue.h.

Referenced by KDSoapMessage::operator=(), and KDSoapMessage::operator=().

## ◆ operator==()

bool KDSoapValue::operator== | ( | const KDSoapValue & | other | ) | const

Compares two KDSoapValues.

Definition at line 155 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::operator==().

## ◆ setEnvironmentNamespaceDeclarations()

void KDSoapValue::setEnvironmentNamespaceDeclarations | ( | const QXmlStreamNamespaceDeclarations & | environmentNamespaceDeclarations | ) |

Sets the `environmentNamespaceDeclarations` of this value.

Since
  1.8

Definition at line 139 of file KDSoapValue.cpp.

References environmentNamespaceDeclarations().

Referenced by parseElement().

## ◆ setName()

void KDSoapValue::setName | ( | const QString & | name | ) |
| protected

Definition at line 99 of file KDSoapValue.cpp.

References name().

Referenced by KDSoapMessage::createFaultMessage().

## ◆ setNamespaceDeclarations()

void KDSoapValue::setNamespaceDeclarations | ( | const QXmlStreamNamespaceDeclarations & | namespaceDeclarations | ) |

Sets the `namespaceDeclarations` of this value.

Since
  1.8

Definition at line 124 of file KDSoapValue.cpp.

References namespaceDeclarations().

Referenced by parseElement().

## ◆ setNamespaceUri()

void KDSoapValue::setNamespaceUri | ( | const QString & | ns | ) |

Sets the namespace of this argument, if it differs from the "message namespace".

Definition at line 462 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::createFaultMessage(), and parseElement().

## ◆ setNillable()

void KDSoapValue::setNillable | ( | bool | nillable | ) |

Write out xsi:nil if the KDSoapValue has no content. See https://www.w3.org/TR/xmlschema-1/#xsi_nil

Definition at line 89 of file KDSoapValue.cpp.

## ◆ setQualified()

void KDSoapValue::setQualified | ( | bool | qualified | ) |

Set whether the element should be qualified. Qualified means, that locally declared elements and attributes are qualified by a namespace, using an explicit prefix. Default is unqualified.

Note that this property does not propagate to child values. It needs to be set for each child value (they could come from another schema which doesn't specify the same value for qualified).

Parameters

  qualified | Whether to qualify the element, or not.

Since
  1.2

Definition at line 119 of file KDSoapValue.cpp.

Referenced by KDSoapMessage::addArgument(), and KDSoapMessage::addArgument().

## ◆ setType()

void KDSoapValue::setType | ( | const QString & | nameSpace,
|  | const QString & | type
| ) |  |

Sets the type information for this KDSoapValue, so that it can be sent in the `xsi:type` attribute. This is only useful if using KDSoapMessage::EncodedUse.

For instance

setType("http://www.w3.org/2001/XMLSchema-instance", "string")
KDSoapValue::setType
void setType(const QString &nameSpace, const QString &type)
Definition KDSoapValue.cpp:394

will send `xsi:type="xsd:string"` in the message XML.

Parameters

  nameSpace | namespace of the type of this value
  type | localname of the type of this value

Definition at line 394 of file KDSoapValue.cpp.

References type().

Referenced by parseElement().

## ◆ setValue()

void KDSoapValue::setValue | ( | const QVariant & | value | ) |

Sets the `value` of the argument.

Definition at line 109 of file KDSoapValue.cpp.

References value().

Referenced by parseElement().

## ◆ split()

KDSoapValueList KDSoapValue::split | ( |  | ) | const

Returns the list of split values. The data is split on spaces and the properties are copied.

Since
  1.8

Definition at line 410 of file KDSoapValue.cpp.

References QList::count(), QList::reserve(), QVariant::setValue(), QString::SkipEmptyParts, Qt::SkipEmptyParts, QString::split(), QVariant::toString(), and value().

## ◆ swap()

void KDSoapValue::swap | ( | KDSoapValue & | other | ) |
| inline

Swaps the contents of other with the contents of `this`. Never throws.

Definition at line 112 of file KDSoapValue.h.

Referenced by qSwap(), and std::swap< KDSoapValue >().

## ◆ toXml()

QByteArray KDSoapValue::toXml | ( | KDSoapValue::Use | use = `LiteralUse`,
|  | const QString & | messageNamespace = `QString()`
| ) |  | const

Definition at line 467 of file KDSoapValue.cpp.

References QXmlStreamWriter::writeEndDocument(), KDSoapNamespacePrefixes::writeStandardNamespaces(), and QXmlStreamWriter::writeStartDocument().

## ◆ type()

QString KDSoapValue::type | ( |  | ) | const

Returns the localname of the type. Example: "string".

Definition at line 405 of file KDSoapValue.cpp.

Referenced by setType().

## ◆ typeNs()

QString KDSoapValue::typeNs | ( |  | ) | const

Returns the namespace of the type. Example: "http://www.w3.org/2001/XMLSchema-instance".

Definition at line 400 of file KDSoapValue.cpp.

## ◆ value()

QVariant KDSoapValue::value | ( |  | ) | const

Returns the value of the argument.

Definition at line 104 of file KDSoapValue.cpp.

Referenced by KDSoapFaultException::deserialize(), KDSoapMessage::faultAsString(), KDQName::fromSoapValue(), operator<<(), setValue(), split(), and writeKDSoapValueVariant().

The documentation for this class was generated from the following files:

- KDSoapValue.h
- KDSoapValue.cpp

© 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