1 #ifndef __DALI_SCRIPT_PLUGIN_H__
2 #define __DALI_SCRIPT_PLUGIN_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali-toolkit/public-api/dali-toolkit-common.h>
31 * @brief Abstract interface to provide scripting support.
33 * A plugin must export the following functions to create / destroy the object
34 * CreateScriptPlugin() // returns a pointer to a ScriptPlugin object
35 * DestroyScriptPlugin() // destroys the plugin
37 class DALI_TOOLKIT_API ScriptPlugin
43 * Function pointer called in toolkit to create a ScriptPlugin plugin instance.
44 * @return Pointer to the newly created plugin object
46 typedef ScriptPlugin* Create();
49 * Function pointer called in toolkit to Unload the plugin.
50 * @param plugin The plugin object created and returned by CreateScriptPluginPlugin().
52 typedef void Destroy(ScriptPlugin* plugin);
57 virtual ~ScriptPlugin() {};
60 * Set engine configuration flags
61 * @param [in] flags string. Format dependent on the scripting engine.
63 virtual void SetFlags(const std::string& flags) = 0;
66 * Exec buffer contents as a script
67 * @param buffer script file contents
68 * @param filename a nominal name for the buffer contents.
69 * filename extension may be used to disambiguate script language
70 * @return true on success, false on failure
73 virtual bool ExecuteBuffer(const std::string& buffer, const std::string& filename) = 0;
76 * Exec file as a script
77 * @param filename the filename to read and execute
78 * @return true on success, false on failure
80 virtual bool ExecuteFile(const std::string& filename) = 0;
82 }; // class ScriptPlugin
84 } // namespace Toolkit
88 #endif // __DALI_SCRIPT_PLUGIN_H__