Corrade::Utility::JsonView class new in Git master

JSON token subtree.

Returned from Json::tokens() and JsonToken::children(). Note that, unlike with JsonObjectView and JsonArrayView, the iteration is performed on the whole subtree in a depth-first order, it doesn't iterate just the immediate children.

Public functions

auto size() -> std::size_t
Token count.
auto isEmpty() const -> bool
Whether the view is empty.
auto begin() const -> JsonIterator
Iterator to the first element.
auto cbegin() const -> JsonIterator
auto end() const -> JsonIterator
Iterator to (one item after) the last element.
auto cend() const -> JsonIterator
auto front() const -> JsonToken
First token.
auto back() const -> JsonToken
Last token.
auto operator[](std::size_t i) const -> JsonToken
Token access.

Function documentation

std::size_t Corrade::Utility::JsonView::size()

Token count.

Note that the returned value includes all nested children as well, it isn't just the count of immediate children.

bool Corrade::Utility::JsonView::isEmpty() const

Whether the view is empty.

JsonIterator Corrade::Utility::JsonView::begin() const

Iterator to the first element.

If the view is empty, the iterator reports itself as valid but may point outside of the actual token data.

JsonIterator Corrade::Utility::JsonView::cbegin() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

JsonIterator Corrade::Utility::JsonView::end() const

Iterator to (one item after) the last element.

The returned iterator reports itself as valid but may point outside of the actual token data.

JsonIterator Corrade::Utility::JsonView::cend() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

JsonToken Corrade::Utility::JsonView::front() const

First token.

Expects there is at least one token.

JsonToken Corrade::Utility::JsonView::back() const

Last token.

Expects there is at least one token.

JsonToken Corrade::Utility::JsonView::operator[](std::size_t i) const

Token access.

Expects that i is less than size().