Stellarium 0.11.2
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
Public Member Functions
JsonListIterator Class Reference

Qt-style iterator over a JSON array. More...

#include <StelJsonParser.hpp>

List of all members.

Public Member Functions

 JsonListIterator (QIODevice *input)
QVariant next ()
bool hasNext () const

Detailed Description

Qt-style iterator over a JSON array.

An actual list is not kept in memory, so only forward iteration is supported and all methods, including the constructor, involve read() calls on the QIODevice. Because of this, do not modify the QIODevice between calls to JsonListIterator methods. Also, the toFront() method has a special function and reset() is provided for convenience. Only peekNext() is guaranteed not to modify the QIODevice.


Constructor & Destructor Documentation

JsonListIterator::JsonListIterator ( QIODevice *  input)

Sets up JsonListIterator to read an array.

Swallows all whitespace up to a beginning '[' character. If '[' is not the first non-whitespace character encountered, reset() is called and an exception is thrown.


Member Function Documentation

QVariant JsonListIterator::next ( )

Reads and parses the next object from input.

Advances QIODevice to just after the object.

Returns:
the next object from the array