JsonUpdater.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * JsonUpdater.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 "ILICReader.h"
  12. #include "JsonTreeSerializer.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CBonusSystemNode;
  15. class DLL_LINKAGE JsonUpdater: public JsonTreeSerializer<const JsonNode *>, public ILICReader
  16. {
  17. public:
  18. JsonUpdater(const IInstanceResolver * instanceResolver_, const JsonNode & root_);
  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 serializeLIC(const std::string & fieldName, LICSet & value) override;
  22. void serializeString(const std::string & fieldName, std::string & value) override;
  23. void serializeRaw(const std::string & fieldName, JsonNode & value, const boost::optional<const JsonNode &> defaultValue) override;
  24. void serializeBonuses(const std::string & fieldName, CBonusSystemNode * value);
  25. protected:
  26. void serializeInternal(const std::string & fieldName, boost::logic::tribool & value) override;
  27. void serializeInternal(const std::string & fieldName, si32 & value, const boost::optional<si32> & defaultValue, const TDecoder & decoder, const TEncoder & encoder) override;
  28. void serializeInternal(const std::string & fieldName, std::vector<si32> & value, const TDecoder & decoder, const TEncoder & encoder) override;
  29. void serializeInternal(const std::string & fieldName, double & value, const boost::optional<double> & defaultValue) override;
  30. void serializeInternal(const std::string & fieldName, si64 & value, const boost::optional<si64> & defaultValue) override;
  31. void serializeInternal(const std::string & fieldName, si32 & value, const boost::optional<si32> & defaultValue, const std::vector<std::string> & enumMap) override;
  32. void serializeInternal(std::string & value) override;
  33. void serializeInternal(int64_t & value) override;
  34. };
  35. VCMI_LIB_NAMESPACE_END