QtSoapArrayIterator Class Reference
The QtSoapArrayIterator class provides an iterator for
traversing the items in a QtSoapArray.
More...
#include <qtsoap.h>
List of all member functions.
Public Members
Detailed Description
The QtSoapArrayIterator class provides an iterator for
traversing the items in a QtSoapArray.
The items are traversed in ascending order of index position,
depth first.
// Construct a 2x2 array of Strings.
QtSoapArray array("Array of strings", String, 2, 2);
array.insert(1, 1, new QtSoapSimpleType(Q4SoapQName("top left"), "top left");
array.insert(1, 2, new QtSoapSimpleType(Q4SoapQName("top right"), "top right");
array.insert(2, 1, new QtSoapSimpleType(Q4SoapQName("bottom left"), "bottom left");
array.insert(2, 2, new QtSoapSimpleType(Q4SoapQName("bottom right"), "bottom right");
// Traverse all items.
QtSoapArrayIterator it(array);
while (it.current()) {
// Find the position of the current element.
int pos1, pos2;
it.pos(&pos1, &pos2);
cout << "Position (" << pos1 << ", " << pos2 << ") is "
<< "the " << it.current() << " coordinate of the grid." << endl;
++it;
}
Member Function Documentation
QtSoapArrayIterator::QtSoapArrayIterator ( QtSoapArray & array )
Constructs a QtSoapArrayIterator on array, initializing
the iterator to point to the first element.
QtSoapArrayIterator::QtSoapArrayIterator ( const QtSoapArrayIterator & copy )
Constructs a QtSoapArrayIterator that is a copy of copy.
QtSoapArrayIterator::~QtSoapArrayIterator ()
Destructs the QtSoapArrayIterator.
const QtSoapType * QtSoapArrayIterator::current () const
Returns a reference to the item that the iterator is currently
pointing to.
QtSoapType * QtSoapArrayIterator::data ()
Returns a reference to the item that the iterator is currently
pointing to.
bool QtSoapArrayIterator::operator!= ( const QtSoapArrayIterator & j ) const
Returns true if this Iterator's position is not equal to
the position of j; otherwise returns false.
void QtSoapArrayIterator::operator++ ()
Moves the iterator position to the next item in the array.
Assignment operator of QtSoapArrayIterator. Makes this array a
copy of copy.
bool QtSoapArrayIterator::operator== ( const QtSoapArrayIterator & j ) const
Returns true if this Iterator's position is equal to the position
of j; otherwise returns false.
void QtSoapArrayIterator::pos ( int * pos0, int * pos1 = 0, int * pos2 = 0, int * pos3 = 0, int * pos4 = 0 ) const
Populates the arguments pos0, pos1, pos2, pos3 and pos4 with the coordinate of the current position of the iterator.
For a one dimensional array, only pos0 is populated. For a two
dimensional array, pos0 and pos1 are populated, and so on.
Any of the arguments that are 0-pointers are ignored.
int QtSoapArrayIterator::pos () const
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the ordinal position of the iterator. Works for arrays of
any dimension, but is only useful for one dimensional arrays.
See also pos(int*,int*,int*,int*,int*).
This file is part of the Qt Solutions.
Copyright © 2003-2006
Trolltech. All Rights Reserved.