Qt-based BB10 API Examples Documentation

Contents

QtSoapArrayIterator Class Reference

The QtSoapArrayIterator class provides an iterator for traversing the items in a QtSoapArray. More...

    #include <QtSoapArrayIterator>

Public Functions

QtSoapArrayIterator ( QtSoapArray & array )
QtSoapArrayIterator ( const QtSoapArrayIterator & copy )
~QtSoapArrayIterator ()
bool atEnd () const
const QtSoapType * current () const
QtSoapType * data ()
void pos ( int * pos0, int * pos1 = 0, int * pos2 = 0, int * pos3 = 0, int * pos4 = 0 ) const
int pos () const
bool operator!= ( const QtSoapArrayIterator & j ) const
void operator++ ()
QtSoapArrayIterator & operator= ( const QtSoapArrayIterator & copy )
bool operator== ( const QtSoapArrayIterator & j ) const

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(0, 0, new QtSoapSimpleType(Q4SoapQName("top left"), "top left");
    array.insert(0, 1, new QtSoapSimpleType(Q4SoapQName("top right"), "top right");
    array.insert(1, 0, new QtSoapSimpleType(Q4SoapQName("bottom left"), "bottom left");
    array.insert(1, 1, 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);

      qDebug() << "Position (" << pos1 << ", " << pos2 << ") is "
               << "the " << it.current()->toString() << " 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.

bool QtSoapArrayIterator::atEnd () const

Returns false if this iterator points to an item in the array, otherwise true.

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.

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 function.

Returns the ordinal position of the iterator. Works for arrays of any dimension, but is only useful for one dimensional arrays.

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.

QtSoapArrayIterator & QtSoapArrayIterator::operator= ( const QtSoapArrayIterator & copy )

Assignment operator of QtSoapArrayIterator. Makes this iterator 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.