JsonArray.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #pragma once
  6. #include "JsonValue.h"
  7. namespace ArduinoJson
  8. {
  9. namespace Parser
  10. {
  11. class JsonHashTable;
  12. class JsonArray
  13. {
  14. public:
  15. JsonArray() {}
  16. JsonArray(JsonValue& value)
  17. : value(value)
  18. {
  19. }
  20. bool success()
  21. {
  22. return value.success();
  23. }
  24. int size()
  25. {
  26. return value.size();
  27. }
  28. JsonValue operator[](int index)
  29. {
  30. return value[index];
  31. }
  32. DEPRECATED int getLength()
  33. {
  34. return size();
  35. }
  36. DEPRECATED JsonArray getArray(int index)
  37. {
  38. return (JsonArray) (*this)[index];
  39. }
  40. DEPRECATED bool getBool(int index)
  41. {
  42. return (bool) (*this)[index];
  43. }
  44. DEPRECATED double getDouble(int index)
  45. {
  46. return (double) (*this)[index];
  47. }
  48. DEPRECATED JsonHashTable getHashTable(int index);
  49. DEPRECATED long getLong(int index)
  50. {
  51. return (long) (*this)[index];
  52. }
  53. DEPRECATED char* getString(int index)
  54. {
  55. return (char*) (*this)[index];
  56. }
  57. private:
  58. JsonValue value;
  59. };
  60. }
  61. }