Fixed JsonArrayIterator unit test

This commit is contained in:
Benoit Blanchon
2014-07-18 16:10:19 +02:00
parent 714a37bd59
commit 5d2ffc49fd
2 changed files with 26 additions and 35 deletions

View File

@ -16,43 +16,34 @@ namespace ArduinoJson
class JsonArrayIterator
{
friend class JsonArray;
public:
JsonArrayIterator operator++()
{
JsonArrayIterator prev = *this;
token = token.nextSibling();
return prev;
}
JsonValue operator*()
{
return JsonValue(json, token);
}
bool operator !=(const JsonArrayIterator& other)
{
return token != other.token || json != other.json;
}
private:
char* json;
Internal::JsonToken token;
JsonArrayIterator()
: json(0), token(0)
{
}
JsonArrayIterator(char* json, Internal::JsonToken& token)
: json(json), token(token)
{
}
const JsonArrayIterator& operator++()
{
token = token.nextSibling();
return *this;
}
JsonValue operator*() const
{
return JsonValue(json, token);
}
bool operator !=(const JsonArrayIterator& other)
{
return token != other.token;
}
private:
char* json;
Internal::JsonToken token;
};
}
}