2
0

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