1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsPrerequisites.h"
6#include "Resources/BsResource.h"
7
8namespace bs
9{
10 /** @addtogroup Resources-Engine
11 * @{
12 */
13
14 /** Resource containing script source code. */
15 class BS_EXPORT ScriptCode : public Resource
16 {
17 public:
18 /** Gets the source code contained in the resource. */
19 const WString& getString() const { return mString; }
20
21 /** Sets the source code contained in the resource. */
22 void setString(const WString& data) { mString = data; }
23
24 /** Gets a value that determines should the script code be compiled with editor assemblies. */
25 bool getIsEditorScript() const { return mEditorScript; }
26
27 /** Sets a value that determines should the script code be compiled with editor assemblies. */
28 void setIsEditorScript(bool editorScript) { mEditorScript = editorScript; }
29
30 /** Creates a new script code resource with the specified source code. */
31 static HScriptCode create(const WString& data, bool editorScript = false);
32
33 /** @name Internal
34 * @{
35 */
36
37 /**
38 * Creates a new scriptcode resource with the specified source string.
39 *
40 * @note Internal method. Use create() for normal use.
41 */
42 static SPtr<ScriptCode> _createPtr(const WString& data, bool editorScript = false);
43
44 /** @} */
45 private:
46 ScriptCode(const WString& data, bool editorScript);
47
48 WString mString;
49 bool mEditorScript;
50
51 /************************************************************************/
52 /* SERIALIZATION */
53 /************************************************************************/
54 public:
55 friend class ScriptCodeRTTI;
56 static RTTITypeBase* getRTTIStatic();
57 virtual RTTITypeBase* getRTTI() const override;
58 };
59
60 /** @} */
61}