2
0

CScriptingModule.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * CScriptingModule.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. #if SCRIPTING_ENABLED
  12. #include <vcmi/scripting/Service.h>
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. namespace spells
  15. {
  16. namespace effects
  17. {
  18. class Registry;
  19. }
  20. }
  21. namespace scripting
  22. {
  23. class DLL_LINKAGE ContextBase : public Context
  24. {
  25. public:
  26. ContextBase(vstd::CLoggerBase * logger_);
  27. virtual ~ContextBase() = default;
  28. protected:
  29. vstd::CLoggerBase * logger;
  30. };
  31. class DLL_LINKAGE Module
  32. {
  33. public:
  34. Module() = default;
  35. virtual ~Module() = default;
  36. virtual std::string compile(const std::string & name, const std::string & source, vstd::CLoggerBase * logger) const = 0;
  37. virtual std::shared_ptr<ContextBase> createContextFor(const Script * source, const Environment * env) const = 0;
  38. virtual void registerSpellEffect(spells::effects::Registry * registry, const Script * source) const = 0;
  39. };
  40. }
  41. VCMI_LIB_NAMESPACE_END
  42. #endif