JsonCpp project page | Classes | Namespace | JsonCpp home page

Public Types | Public Member Functions | Protected Member Functions | List of all members
Json::ValueIteratorBase Class Reference

base class for Value iterators. More...

`#include <json/value.h>`

Inheritance diagram for Json::ValueIteratorBase:
Collaboration diagram for Json::ValueIteratorBase:

## Public Types
using | iterator_category = std::bidirectional_iterator_tag
using | size_t = unsigned int
using | difference_type = int
using | SelfType = ValueIteratorBase

## Public Member Functions
bool | operator== (const SelfType &other) const
bool | operator!= (const SelfType &other) const
difference_type | operator- (const SelfType &other) const
Value | key () const
| Return either the index or the member name of the referenced value as a Value.
UInt | index () const
| Return the index of the referenced Value, or -1 if it is not an arrayValue.
String | name () const
| Return the member name of the referenced Value, or "" if it is not an objectValue.
| __declspec (deprecated("Use `key = name();` instead.")) char const *memberName() const
| Return the member name of the referenced Value.
char const * | memberName (char const **end) const
| Return the member name of the referenced Value, or NULL if it is not an objectValue.
| ValueIteratorBase ()
| ValueIteratorBase (const Value::ObjectValues::iterator &current)

## Protected Member Functions
const Value & | deref () const
Value & | deref ()
void | increment ()
void | decrement ()
difference_type | computeDistance (const SelfType &other) const
bool | isEqual (const SelfType &other) const
void | copy (const SelfType &other)

## Detailed Description

base class for Value iterators.

Definition at line 770 of file value.h.

## Member Typedef Documentation

## ◆ difference_type

using Json::ValueIteratorBase::difference_type = int

Definition at line 774 of file value.h.

## ◆ iterator_category

using Json::ValueIteratorBase::iterator_category = std::bidirectional_iterator_tag

Definition at line 772 of file value.h.

## ◆ SelfType

using Json::ValueIteratorBase::SelfType = ValueIteratorBase

Definition at line 775 of file value.h.

## ◆ size_t

using Json::ValueIteratorBase::size_t = unsigned int

Definition at line 773 of file value.h.

## Constructor & Destructor Documentation

## ◆ ValueIteratorBase() [1/2]

Json::ValueIteratorBase::ValueIteratorBase | ( |  | ) |

Definition at line 18 of file json_valueiterator.inl.

## ◆ ValueIteratorBase() [2/2]

Json::ValueIteratorBase::ValueIteratorBase | ( | const Value::ObjectValues::iterator & | current | ) |
| explicit

Definition at line 20 of file json_valueiterator.inl.

## Member Function Documentation

## ◆ __declspec()

Json::ValueIteratorBase::__declspec | ( | deprecated("Use `key = name();` instead.") |  | ) | const

Return the member name of the referenced Value.

"" if it is not an objectValue.

Deprecated
  This cannot be used for UTF-8 strings, since there can be embedded nulls.

## ◆ computeDistance()

ValueIteratorBase::difference_type Json::ValueIteratorBase::computeDistance | ( | const SelfType & | other | ) | const
| protected

Definition at line 32 of file json_valueiterator.inl.

Referenced by operator-().

Here is the caller graph for this function:

## ◆ copy()

void Json::ValueIteratorBase::copy | ( | const SelfType & | other | ) |
| protected

Definition at line 62 of file json_valueiterator.inl.

Referenced by Json::ValueConstIterator::operator=(), and Json::ValueIterator::operator=().

Here is the caller graph for this function:

## ◆ decrement()

void Json::ValueIteratorBase::decrement | ( |  | ) |
| protected

Definition at line 29 of file json_valueiterator.inl.

## ◆ deref() [1/2]

Value & Json::ValueIteratorBase::deref | ( |  | ) |
| protected

Definition at line 24 of file json_valueiterator.inl.

## ◆ deref() [2/2]

const Value & Json::ValueIteratorBase::deref | ( |  | ) | const
| protected

Internal utility functions to assist with implementing other iterator functions. The const and non-const versions of the "deref" protected methods expose the protected current_ member variable in a way that can often be optimized away by the compiler.

Definition at line 25 of file json_valueiterator.inl.

## ◆ increment()

void Json::ValueIteratorBase::increment | ( |  | ) |
| protected

Definition at line 27 of file json_valueiterator.inl.

## ◆ index()

UInt Json::ValueIteratorBase::index | ( |  | ) | const

Return the index of the referenced Value, or -1 if it is not an arrayValue.

Definition at line 77 of file json_valueiterator.inl.

## ◆ isEqual()

bool Json::ValueIteratorBase::isEqual | ( | const SelfType & | other | ) | const
| protected

Definition at line 55 of file json_valueiterator.inl.

## ◆ key()

Value Json::ValueIteratorBase::key | ( |  | ) | const

Return either the index or the member name of the referenced value as a Value.

Definition at line 67 of file json_valueiterator.inl.

## ◆ memberName()

char const * Json::ValueIteratorBase::memberName | ( | char const ** | end | ) | const

Return the member name of the referenced Value, or NULL if it is not an objectValue.

Note
  Better version than memberName(). Allows embedded nulls.

Definition at line 93 of file json_valueiterator.inl.

Referenced by name().

Here is the caller graph for this function:

## ◆ name()

String Json::ValueIteratorBase::name | ( |  | ) | const

Return the member name of the referenced Value, or "" if it is not an objectValue.

Note
  Avoid `c_str()` on result, as embedded zeroes are possible.

Definition at line 84 of file json_valueiterator.inl.

References memberName().

## ◆ operator!=()

bool Json::ValueIteratorBase::operator!= | ( | const SelfType & | other | ) | const
| inline

Definition at line 779 of file value.h.

## ◆ operator-()

difference_type Json::ValueIteratorBase::operator- | ( | const SelfType & | other | ) | const
| inline

Definition at line 781 of file value.h.

References computeDistance().

## ◆ operator==()

bool Json::ValueIteratorBase::operator== | ( | const SelfType & | other | ) | const
| inline

Definition at line 777 of file value.h.

The documentation for this class was generated from the following files:

- include/json/value.h
- src/lib_json/json_valueiterator.inl