BsScriptScriptCode.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptResource.h"
  6. #include "BsScriptObject.h"
  7. #include "BsScriptCode.h"
  8. namespace BansheeEngine
  9. {
  10. /**
  11. * @brief Interop class between C++ & CLR for ScriptCode.
  12. */
  13. class BS_SCR_BE_EXPORT ScriptScriptCode : public TScriptResource<ScriptScriptCode, ScriptCode>
  14. {
  15. public:
  16. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptCode")
  17. private:
  18. friend class ScriptResourceManager;
  19. typedef std::pair<WString, WString> FullTypeName;
  20. ScriptScriptCode(MonoObject* instance, const HScriptCode& scriptCode);
  21. /**
  22. * @brief Parses the provided C# code and finds a list of all classes
  23. * and their namespaces. Nested classes are ignored.
  24. */
  25. static Vector<FullTypeName> parseTypes(const WString& code);
  26. /**
  27. * @brief Creates an empty, uninitialized managed instance of the resource interop object.
  28. */
  29. static MonoObject* createInstance();
  30. /************************************************************************/
  31. /* CLR HOOKS */
  32. /************************************************************************/
  33. static void internal_createInstance(MonoObject* instance, MonoString* text);
  34. static MonoString* internal_getText(ScriptScriptCode* thisPtr);
  35. static void internal_setText(ScriptScriptCode* thisPtr, MonoString* text);
  36. static bool internal_isEditorScript(ScriptScriptCode* thisPtr);
  37. static void internal_setEditorScript(ScriptScriptCode* thisPtr, bool value);
  38. static MonoArray* internal_getTypes(ScriptScriptCode* thisPtr);
  39. };
  40. }