JsonDeserializer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * JsonDeserializer.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "JsonSerializeFormat.h"
  12. class JsonNode;
  13. class JsonDeserializer: public JsonSerializeFormat
  14. {
  15. public:
  16. JsonDeserializer(JsonNode & root_);
  17. void serializeBool(const std::string & fieldName, bool & value) override;
  18. void serializeEnum(const std::string & fieldName, const std::string & trueValue, const std::string & falseValue, bool & value) override;
  19. void serializeLIC(const std::string & fieldName, const TDecoder & decoder, const TEncoder & encoder, const std::vector<bool> & standard, std::vector<bool> & value) override;
  20. void serializeLIC(const std::string & fieldName, LIC & value) override;
  21. void serializeString(const std::string & fieldName, std::string & value) override;
  22. protected:
  23. void serializeFloat(const std::string & fieldName, double & value) override;
  24. void serializeIntEnum(const std::string & fieldName, const std::vector<std::string> & enumMap, const si32 defaultValue, si32 & value) override;
  25. void serializeIntId(const std::string & fieldName, const TDecoder & decoder, const TEncoder & encoder, const si32 defaultValue, si32 & value) override;
  26. private:
  27. void readLICPart(const JsonNode & part, const TDecoder & decoder, const bool val, std::vector<bool> & value);
  28. };