JsonVariantAs.hpp 804 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright Benoit Blanchon 2014-2017
  2. // MIT License
  3. //
  4. // Arduino JSON library
  5. // https://github.com/bblanchon/ArduinoJson
  6. // If you like this project, please add a star!
  7. #pragma once
  8. namespace ArduinoJson {
  9. namespace Internals {
  10. // A metafunction that returns the type of the value returned by
  11. // JsonVariant::as<T>()
  12. template <typename T>
  13. struct JsonVariantAs {
  14. typedef T type;
  15. };
  16. template <>
  17. struct JsonVariantAs<char*> {
  18. typedef const char* type;
  19. };
  20. template <>
  21. struct JsonVariantAs<JsonArray> {
  22. typedef JsonArray& type;
  23. };
  24. template <>
  25. struct JsonVariantAs<const JsonArray> {
  26. typedef const JsonArray& type;
  27. };
  28. template <>
  29. struct JsonVariantAs<JsonObject> {
  30. typedef JsonObject& type;
  31. };
  32. template <>
  33. struct JsonVariantAs<const JsonObject> {
  34. typedef const JsonObject& type;
  35. };
  36. }
  37. }