Picked some defaults for dali-demo on Ubuntu
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / scripting / script-plugin-proxy.h
1 #ifndef __DALI_INTERNAL_SCRIPT_PLUGIN_PROXY_H__
2 #define __DALI_INTERNAL_SCRIPT_PLUGIN_PROXY_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 #include <dali-toolkit/public-api/scripting/script-plugin.h>
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal
30 {
31
32 /**
33  * @brief Proxy class to dynamically load, use and unload script plugin.
34  *
35  *
36  */
37 class ScriptPluginProxy : public ScriptPlugin
38 {
39 public:
40
41   /**
42    * @brief Constructor
43    * @param sharedObjectName so file to load
44    */
45   ScriptPluginProxy( const std::string& sharedObjectName);
46
47   /**
48    *  @brief destructor
49    */
50   virtual ~ScriptPluginProxy();
51
52   /**
53    * Set engine configuration flags
54    * @param [in] flags string. Format dependent on the scripting engine.
55    */
56   virtual void SetFlags( const std::string& flags );
57
58   /**
59    *  @brief Exececute the buffer contents as a script
60    * @param [in] buffer script file contents
61    * @param [in] filename a nominal name for the buffer contents.
62    * (NB filename extension may be used to disambiguate script language)
63    */
64   virtual void ExecuteBuffer( const std::string& buffer, const std::string& filename );
65
66   /**
67    * @brief  execture the file as a script
68    * @param [in] filename the filename to read and execute
69    */
70   virtual void ExecuteFile( const std::string& fileName );
71
72   /**
73    * @brief check if the plugin is initialized
74    * @return true if it's initialized
75    */
76   bool IsInitialized() const;
77
78 private:
79   /**
80    * @brief Dynamically loads the script plugin.
81    */
82   void Initialize();
83
84   /**
85    * @brief Unloads the script plugin.
86    */
87   void UnInitialize();
88
89 private:
90
91   void* mLibHandle;
92   ScriptPlugin::Create* mCreatePluginFunctionPtr;
93   ScriptPlugin::Destroy* mDestroyPluginFunctionPtr;
94   ScriptPlugin* mScriptingPlugin;
95   std::string mSharedObjectName;
96   bool mIsInitialized;
97
98 };
99
100 } // namespace Adaptor
101
102 } // namespace Internal
103
104 } // namespace Dali
105
106 #endif // __DALI_INTERNAL_SCRIPT_PLUGIN_PROXY_H__