|  | Home

# QtSoapArray Class Reference

The QtSoapArray class is an implementation of the SOAP array type. More...

     #include <QtSoapArray>

Inherits QtSoapType.

- List of all members, including inherited members

### Public Functions

- QtSoapArray ( const QtSoapQName & name, QtSoapType::Type type = Other, int size0 = -1, int size1 = -1, int size2 = -1, int size3 = -1, int size4 = -1 )
- QtSoapArray ( const QtSoapArray & copy )
- QtSoapArray ()
- ~QtSoapArray ()
- void append ( QtSoapType * item )
- QtSoapType & at ( int pos )
- QtSoapType & at ( int pos0, int pos1 )
- QtSoapType & at ( int pos0, int pos1, int pos2 )
- QtSoapType & at ( int pos0, int pos1, int pos2, int pos3 )
- QtSoapType & at ( int pos0, int pos1, int pos2, int pos3, int pos4 )
- const QtSoapType & at ( int pos ) const
- const QtSoapType & at ( int pos0, int pos1 ) const
- const QtSoapType & at ( int pos0, int pos1, int pos2 ) const
- const QtSoapType & at ( int pos0, int pos1, int pos2, int pos3 ) const
- const QtSoapType & at ( int pos0, int pos1, int pos2, int pos3, int pos4 ) const
- virtual void clear ()
- virtual int count () const
- void insert ( int pos, QtSoapType * item )
- void insert ( int pos0, int pos1, QtSoapType * item )
- void insert ( int pos0, int pos1, int pos2, QtSoapType * item )
- void insert ( int pos0, int pos1, int pos2, int pos3, QtSoapType * item )
- void insert ( int pos0, int pos1, int pos2, int pos3, int pos4, QtSoapType * item )
- virtual bool parse ( QDomNode node )
- virtual QDomElement toDomElement ( QDomDocument doc ) const
- QtSoapArray & operator= ( const QtSoapArray & copy )
- virtual QtSoapType & operator[] ( int pos )
- virtual QtSoapType & operator[] ( const QString & s )
- virtual QtSoapType & operator[] ( const QtSoapQName & s )
- virtual const QtSoapType & operator[] ( int pos ) const
- virtual const QtSoapType & operator[] ( const QString & s ) const
- virtual const QtSoapType & operator[] ( const QtSoapQName & s ) const

- 25 public functions inherited from QtSoapType

### Additional Inherited Members

- 2 static public members inherited from QtSoapType

## Detailed Description

The QtSoapArray class is an implementation of the SOAP array type.

A SOAP array is a sequence of QtSoapType objects such as QtSoapArrays, QtSoapStructs or QtSoapSimpleTypes, and they are accessible through their ordinal position. An array can be consecutive (0, 1, 2, 3, ...) or sparse (1, 5, 6, 10, ...) and they can be multidimensional ((0, 0), (0, 1), ...). QtSoapArray supports arrays of up to 5 dimensions. The size and dimensions of the array are set in the constructor. The default constructor produces a one dimensional array, with an unset size, meaning that the array can grow as required.

All elements in a SOAP array must be of the same type. Inserting different types will result in a run time error.

The parse() function builds the array by analyzing a QDomNode from a SOAP document. count() returns the number of items in the array.

Retrieve items in the array with at() or operator[](). Note that operator[]() only works with one dimensional arrays, but there are at() functions for arrays of up to 5 dimensions. QtSoapArrayIterator lets you iterate through all items in an array.

Use insert() or append() to insert items into an array manually. append() only works with one dimensional arrays.

toDomElement() returns a QDomElement representation of the SOAP array.

     QtSoapArray array;

     array.insert(0, new QtSoapSimpleType(QtSoapQName("Peter"), "peter"));
     array.insert(1, new QtSoapSimpleType(QtSoapQName("Lisa"), "lisa"));
     array.insert(2, new QtSoapSimpleType(QtSoapQName("Paul"), "paul"));
     array.insert(3, new QtSoapSimpleType(QtSoapQName("Heather"), "heather"));

See also QtSoapType, QtSoapStruct, and QtSoapSimpleType.

## Member Function Documentation

### QtSoapArray::QtSoapArray ( const QtSoapQName & name, QtSoapType::Type type = Other, int size0 = -1, int size1 = -1, int size2 = -1, int size3 = -1, int size4 = -1 )

Constructs an empty QtSoapArray whose QName (qualified name) is name, that contains elements of type type, and whose dimensions are given by size0, size1, size2, size3 and size4.

To construct a one dimensional array of size 5, set size0 = 5. To create a two dimensional array of size 5x10, set size0 = 5 and size1 = 10. The maximum dimension of a QtSoapArray is 5.

### QtSoapArray::QtSoapArray ( const QtSoapArray & copy )

Create a QtSoapArray that is a copy of copy.

### QtSoapArray::QtSoapArray ()

This is an overloaded function.

Constructs an empty one dimensional QtSoapArray whose element type is undefined. The first insert will decide what type of elements the array can contain.

### QtSoapArray::~QtSoapArray ()

Destructs the QtSoapArray.

### void QtSoapArray::append ( QtSoapType * item )

Appends the QtSoapType item to the end of this array, which must be one dimensional.

See also insert().

### QtSoapType & QtSoapArray::at ( int pos )

Returns a reference to the item at ordinal position pos. If there is no item at position pos, returns an empty QtSoapType.

### QtSoapType & QtSoapArray::at ( int pos0, int pos1 )

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 in a two dimensional array. If there is no such item, returns an empty QtSoapType.

### QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2 )

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 in a three dimensional array. If there is no such item, returns an empty QtSoapType.

### QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2, int pos3 )

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 x pos3 in a four dimensional array. If there is no such item, returns an empty QtSoapType.

### QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2, int pos3, int pos4 )

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 x pos3 x pos4 in a five dimensional array. If there is no such item, returns an empty QtSoapType.

### const QtSoapType & QtSoapArray::at ( int pos ) const

This is an overloaded function.

Returns a reference to the item at ordinal position pos. If there is no item at position pos, returns an empty QtSoapType.

### const QtSoapType & QtSoapArray::at ( int pos0, int pos1 ) const

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 in a two dimensional array. If there is no such item, returns an empty QtSoapType.

### const QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2 ) const

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 in a three dimensional array. If there is no such item, returns an empty QtSoapType.

### const QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2, int pos3 ) const

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 x pos3 in a four dimensional array. If there is no such item, returns an empty QtSoapType.

### const QtSoapType & QtSoapArray::at ( int pos0, int pos1, int pos2, int pos3, int pos4 ) const

This is an overloaded function.

Returns a reference to the item at ordinal position pos0 x pos1 x pos2 x pos3 x pos4 in a five dimensional array. If there is no such item, returns an empty QtSoapType.

### void QtSoapArray::clear () `[virtual]`

Clears the contents, and the dimensions of the QtSoapArray.

Reimplemented from QtSoapType.

### int QtSoapArray::count () const `[virtual]`

Returns the number of items in the array. Note that this is not the same as the size of the array, because the array may be sparse.

Reimplemented from QtSoapType.

### void QtSoapArray::insert ( int pos, QtSoapType * item )

Inserts the QtSoapType item at the absolute position pos in the array. Note that this function can be used to insert items into arrays with any number of dimensions.

If the array is one dimensional, then pos is simply the index position in the array. But if the array is multi-dimensional then pos is the absolute position. For example, if we have a two dimensional array [['a', 'b'], ['c', 'd'], ['e', 'f']], the element at position 0 is 'a', at position 1 is 'b', at position 2 is 'c', and so on. (There are other insert() overloads that allow for each dimension to be specified individually.)

### void QtSoapArray::insert ( int pos0, int pos1, QtSoapType * item )

This is an overloaded function.

Insert the QtoSoapType item at position pos0 x pos1 in a two dimensional array.

### void QtSoapArray::insert ( int pos0, int pos1, int pos2, QtSoapType * item )

This is an overloaded function.

Insert the QtoSoapType item at position pos0 x pos1 x pos2 in a three dimensional array.

### void QtSoapArray::insert ( int pos0, int pos1, int pos2, int pos3, QtSoapType * item )

This is an overloaded function.

Insert the QtoSoapType item at position pos0 x pos1 x pos2 x pos3 in a four dimensional array.

### void QtSoapArray::insert ( int pos0, int pos1, int pos2, int pos3, int pos4, QtSoapType * item )

This is an overloaded function.

Insert the QtoSoapType item at position pos0 x pos1 x pos2 x pos3 x pos4 in a five dimensional array.

### bool QtSoapArray::parse ( QDomNode node ) `[virtual]`

Inspects node and builds the content of the QtSoapArray if node qualifies as a SOAP array. Returns true if it does; otherwise returns false.

Reimplemented from QtSoapType.

### QDomElement QtSoapArray::toDomElement ( QDomDocument doc ) const `[virtual]`

Returns the QDomElement representation of this QtSoapArray. The returned QDomElement is created using doc.

Reimplemented from QtSoapType.

### QtSoapArray & QtSoapArray::operator= ( const QtSoapArray & copy )

Makes this QtSoapArray a copy of copy.

### QtSoapType & QtSoapArray::operator[] ( int pos ) `[virtual]`

Returns a reference to the item at ordinal position pos. If there is no item at position pos, returns an empty QtSoapType.

Reimplemented from QtSoapType.

### QtSoapType & QtSoapArray::operator[] ( const QString & s ) `[virtual]`

This is an overloaded function.

Returns a reference to the child item whose local name is s. If there is no item with this local name, returns an empty QtSoapType.

Reimplemented from QtSoapType.

### QtSoapType & QtSoapArray::operator[] ( const QtSoapQName & s ) `[virtual]`

This is an overloaded function.

Returns a reference to the child item whose QName (qualified name) is s. If there is no item with this name, returns an empty QtSoapType.

Reimplemented from QtSoapType.

### const QtSoapType & QtSoapArray::operator[] ( int pos ) const `[virtual]`

This is an overloaded function.

Returns a reference to the item at ordinal position pos. If there is no item at position pos, returns an empty QtSoapType.

Reimplemented from QtSoapType.

### const QtSoapType & QtSoapArray::operator[] ( const QString & s ) const `[virtual]`

This is an overloaded function.

Returns a reference to the child item whose local name is s. If there is no item with this local name, returns an empty QtSoapType.

Reimplemented from QtSoapType.

### const QtSoapType & QtSoapArray::operator[] ( const QtSoapQName & s ) const `[virtual]`

This is an overloaded function.

Returns a reference to the child item whose QName (qualified name) is s. If there is no item with this name, returns an empty QtSoapType.

Reimplemented from QtSoapType.