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 "Wrappers/BsScriptResource.h"
  6. #include "BsScriptObject.h"
  7. #include "Resources/BsScriptCode.h"
  8. namespace bs
  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. friend class BuiltinResourceTypes;
  23. typedef std::pair<WString, WString> FullTypeName;
  24. ScriptScriptCode(MonoObject* instance, const HScriptCode& scriptCode);
  25. /** Parses the provided C# code and finds a list of all classes and their namespaces. Nested classes are ignored. */
  26. static Vector<FullTypeName> parseTypes(const WString& code);
  27. /************************************************************************/
  28. /* CLR HOOKS */
  29. /************************************************************************/
  30. static void internal_createInstance(MonoObject* instance, MonoString* text);
  31. static MonoString* internal_getText(ScriptScriptCode* thisPtr);
  32. static void internal_setText(ScriptScriptCode* thisPtr, MonoString* text);
  33. static bool internal_isEditorScript(ScriptScriptCode* thisPtr);
  34. static void internal_setEditorScript(ScriptScriptCode* thisPtr, bool value);
  35. static MonoArray* internal_getTypes(ScriptScriptCode* thisPtr);
  36. };
  37. /** @} */
  38. }