JsonToken.cpp 515 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #include "JsonToken.h"
  6. using namespace ArduinoJson::Parser;
  7. JsonToken JsonToken::nextSibling() const
  8. {
  9. // start with current token
  10. jsmntok_t* t = token;
  11. // count the number of token to skip
  12. int yetToVisit = 1;
  13. // skip all nested tokens
  14. while (yetToVisit)
  15. {
  16. yetToVisit += t->size - 1;
  17. t++;
  18. }
  19. // build a JsonToken at the new location
  20. return JsonToken(json, t);
  21. }