2
0

BsScriptScriptCode.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /** @addtogroup ScriptInteropEngine
  11. * @{
  12. */
  13. /** Interop class between C++ & CLR for ScriptCode. */
  14. class BS_SCR_BE_EXPORT ScriptScriptCode : public TScriptResource<ScriptScriptCode, ScriptCode>
  15. {
  16. public:
  17. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptCode")
  18. /** Creates an empty, uninitialized managed instance of the resource interop object. */
  19. static MonoObject* createInstance();
  20. private:
  21. friend class ScriptResourceManager;
  22. typedef std::pair<WString, WString> FullTypeName;
  23. ScriptScriptCode(MonoObject* instance, const HScriptCode& scriptCode);
  24. /** Parses the provided C# code and finds a list of all classes and their namespaces. Nested classes are ignored. */
  25. static Vector<FullTypeName> parseTypes(const WString& code);
  26. /************************************************************************/
  27. /* CLR HOOKS */
  28. /************************************************************************/
  29. static void internal_createInstance(MonoObject* instance, MonoString* text);
  30. static MonoString* internal_getText(ScriptScriptCode* thisPtr);
  31. static void internal_setText(ScriptScriptCode* thisPtr, MonoString* text);
  32. static bool internal_isEditorScript(ScriptScriptCode* thisPtr);
  33. static void internal_setEditorScript(ScriptScriptCode* thisPtr, bool value);
  34. static MonoArray* internal_getTypes(ScriptScriptCode* thisPtr);
  35. };
  36. /** @} */
  37. }