Update adapters to avoid inheriting from std::iterator

This commit is contained in:
Tristan Penman 2021-07-28 22:19:36 +10:00
parent 385d2d8306
commit 6a04040d4f
9 changed files with 113 additions and 60 deletions

View File

@ -493,12 +493,14 @@ public:
*
* @see Json11Array
*/
class Json11ArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
Json11Adapter> // value type
class Json11ArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = Json11Adapter;
using difference_type = Json11Adapter;
using pointer = Json11Adapter*;
using reference = Json11Adapter&;
/**
* @brief Construct a new Json11ArrayValueIterator using an existing
@ -583,12 +585,14 @@ private:
* @see Json11Object
* @see Json11ObjectMember
*/
class Json11ObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
Json11ObjectMember> // value type
class Json11ObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = Json11ObjectMember;
using difference_type = Json11ObjectMember;
using pointer = Json11ObjectMember*;
using reference = Json11ObjectMember&;
/**
* @brief Construct an iterator from a Json11 iterator.

View File

@ -490,13 +490,14 @@ public:
*
* @see JsonCppArray
*/
class JsonCppArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
JsonCppAdapter> // value type
class JsonCppArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = JsonCppAdapter;
using difference_type = JsonCppAdapter;
using pointer = JsonCppAdapter*;
using reference = JsonCppAdapter&;
/**
* @brief Construct a new JsonCppArrayValueIterator using an existing
@ -588,12 +589,14 @@ private:
* @see JsonCppObject
* @see JsonCppObjectMember
*/
class JsonCppObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
JsonCppObjectMember> // value type
class JsonCppObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = JsonCppObjectMember;
using difference_type = JsonCppObjectMember;
using pointer = JsonCppObjectMember*;
using reference = JsonCppObjectMember&;
/**
* @brief Construct an iterator from a JsonCpp iterator.

View File

@ -495,12 +495,14 @@ public:
*
* @see NlohmannJsonArray
*/
class NlohmannJsonArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
NlohmannJsonAdapter> // value type
class NlohmannJsonArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = NlohmannJsonAdapter;
using difference_type = NlohmannJsonAdapter;
using pointer = NlohmannJsonAdapter*;
using reference = NlohmannJsonAdapter&;
/**
* @brief Construct a new NlohmannJsonArrayValueIterator using an existing
@ -585,12 +587,14 @@ private:
* @see NlohmannJsonObject
* @see NlohmannJsonObjectMember
*/
class NlohmannJsonObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
NlohmannJsonObjectMember> // value type
class NlohmannJsonObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = NlohmannJsonObjectMember;
using difference_type = NlohmannJsonObjectMember;
using pointer = NlohmannJsonObjectMember*;
using reference = NlohmannJsonObjectMember&;
/**
* @brief Construct an iterator from a NlohmannJson iterator.

View File

@ -509,12 +509,14 @@ public:
*
* @see PicoJsonArray
*/
class PicoJsonArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
PicoJsonAdapter> // value type
class PicoJsonArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PicoJsonAdapter;
using difference_type = PicoJsonAdapter;
using pointer = PicoJsonAdapter*;
using reference = PicoJsonAdapter&;
/**
* @brief Construct a new PicoJsonArrayValueIterator using an existing
@ -599,12 +601,14 @@ private:
* @see PicoJsonObject
* @see PicoJsonObjectMember
*/
class PicoJsonObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
PicoJsonObjectMember> // value type
class PicoJsonObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PicoJsonObjectMember;
using difference_type = PicoJsonObjectMember;
using pointer = PicoJsonObjectMember*;
using reference = PicoJsonObjectMember&;
/**
* @brief Construct an iterator from a PicoJson iterator.

View File

@ -496,9 +496,14 @@ public:
*
* @see PocoJsonArray
*/
class PocoJsonArrayValueIterator : public std::iterator<std::bidirectional_iterator_tag, PocoJsonAdapter>
class PocoJsonArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PocoJsonAdapter;
using difference_type = PocoJsonAdapter;
using pointer = PocoJsonAdapter*;
using reference = PocoJsonAdapter&;
/**
* @brief Construct a new PocoJsonArrayValueIterator using an existing
@ -584,9 +589,14 @@ private:
* @see PocoJsonObject
* @see PocoJsonObjectMember
*/
class PocoJsonObjectMemberIterator : public std::iterator<std::bidirectional_iterator_tag, PocoJsonObjectMember>
class PocoJsonObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PocoJsonObjectMember;
using difference_type = PocoJsonObjectMember;
using pointer = PocoJsonObjectMember*;
using reference = PocoJsonObjectMember&;
/**
* @brief Construct an iterator from a PocoJson iterator.

View File

@ -520,9 +520,14 @@ public:
*
* @see PropertyTreeArray
*/
class PropertyTreeArrayValueIterator : public std::iterator<std::bidirectional_iterator_tag, PropertyTreeAdapter>
class PropertyTreeArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PropertyTreeAdapter;
using difference_type = PropertyTreeAdapter;
using pointer = PropertyTreeAdapter*;
using reference = PropertyTreeAdapter&;
/**
* @brief Construct a new PropertyTreeArrayValueIterator using an existing
@ -616,9 +621,14 @@ private:
* @see PropertyTreeObject
* @see PropertyTreeObjectMember
*/
class PropertyTreeObjectMemberIterator: public std::iterator<std::bidirectional_iterator_tag, PropertyTreeObjectMember>
class PropertyTreeObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PropertyTreeObjectMember;
using difference_type = PropertyTreeObjectMember;
using pointer = PropertyTreeObjectMember*;
using reference = PropertyTreeObjectMember&;
/**
* @brief Construct an iterator from a PropertyTree iterator.

View File

@ -500,17 +500,18 @@ public:
* @brief Class for iterating over values held in a JSON array.
*
* This class provides a JSON array iterator that dereferences as an instance of
* QtJsonAdapter representing a value stored in the array. It has been
* implemented using the std::iterator template.
* QtJsonAdapter representing a value stored in the array.
*
* @see QtJsonArray
*/
class QtJsonArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
QtJsonAdapter> // value type
class QtJsonArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = QtJsonAdapter;
using difference_type = QtJsonAdapter;
using pointer = QtJsonAdapter*;
using reference = QtJsonAdapter&;
/**
* @brief Construct a new QtJsonArrayValueIterator using an existing
@ -595,12 +596,14 @@ private:
* @see QtJsonObject
* @see QtJsonObjectMember
*/
class QtJsonObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
QtJsonObjectMember> // value type
class QtJsonObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = QtJsonObjectMember;
using difference_type = QtJsonObjectMember;
using pointer = QtJsonObjectMember*;
using reference = QtJsonObjectMember&;
/**
* @brief Construct an iterator from a QtJson iterator.

View File

@ -638,18 +638,19 @@ public:
* @brief Class for iterating over values held in a JSON array.
*
* This class provides a JSON array iterator that dereferences as an instance of
* RapidJsonAdapter representing a value stored in the array. It has been
* implemented using the std::iterator template.
* RapidJsonAdapter representing a value stored in the array.
*
* @see RapidJsonArray
*/
template<class ValueType>
class GenericRapidJsonArrayValueIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
GenericRapidJsonAdapter<ValueType>> // value type
class GenericRapidJsonArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = GenericRapidJsonAdapter<ValueType>;
using difference_type = GenericRapidJsonAdapter<ValueType>;
using pointer = GenericRapidJsonAdapter<ValueType>*;
using reference = GenericRapidJsonAdapter<ValueType>&;
/**
* @brief Construct a new GenericRapidJsonArrayValueIterator using an
@ -735,18 +736,20 @@ private:
*
* This class provides a JSON object iterator that dereferences as an instance
* of GenericRapidJsonObjectMember representing one of the members of the
* object. It has been implemented using the std::iterator template.
* object.
*
* @see GenericRapidJsonObject
* @see GenericRapidJsonObjectMember
*/
template<class ValueType>
class GenericRapidJsonObjectMemberIterator:
public std::iterator<
std::bidirectional_iterator_tag, // bi-directional iterator
GenericRapidJsonObjectMember<ValueType>> // value type
class GenericRapidJsonObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = GenericRapidJsonObjectMember<ValueType>;
using difference_type = GenericRapidJsonObjectMember<ValueType>;
using pointer = GenericRapidJsonObjectMember<ValueType>*;
using reference = GenericRapidJsonObjectMember<ValueType>&;
/**
* @brief Construct an iterator from a RapidJson iterator.

View File

@ -351,9 +351,15 @@ private:
const std::string &m_value;
};
class StdStringArrayValueIterator: public std::iterator<std::bidirectional_iterator_tag, StdStringAdapter>
class StdStringArrayValueIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = StdStringAdapter;
using difference_type = StdStringAdapter;
using pointer = StdStringAdapter*;
using reference = StdStringAdapter&;
StdStringAdapter operator*() const
{
throwNotSupported();
@ -405,9 +411,15 @@ inline StdStringArrayValueIterator StdStringArray::end() const
return {};
}
class StdStringObjectMemberIterator: public std::iterator<std::bidirectional_iterator_tag, StdStringObjectMember>
class StdStringObjectMemberIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = StdStringObjectMember;
using difference_type = StdStringObjectMember;
using pointer = StdStringObjectMember*;
using reference = StdStringObjectMember&;
StdStringObjectMember operator*() const
{
throwNotSupported();