Merge "Convert the Underline and Shadow deprecated APIs to the new ones." into devel...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / scripting / script-impl.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "script-impl.h"
20
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23 #include "script-plugin-proxy.h"
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal
32 {
33
34 namespace
35 {
36 const char* PLUGIN_FILE = "libdali-script-plugin-v8.so";
37 }
38
39 Script::Script()
40 : mPlugin( NULL )
41 {
42   ScriptPluginProxy *plugin = new ScriptPluginProxy( PLUGIN_FILE );
43
44   if( plugin->IsInitialized() )
45   {
46     mPlugin = plugin;
47   }
48   else
49   {
50     delete plugin;
51   }
52 }
53
54 bool Script::ExecuteFile( const std::string& filename )
55 {
56   if( mPlugin )
57   {
58     return mPlugin->ExecuteFile(filename);
59   }
60   return false;
61 }
62
63 Script::~Script()
64 {
65   if( mPlugin )
66   {
67     delete mPlugin;
68   }
69 }
70
71 } // namespace Internal
72
73 } // namespace Toolkit
74
75 } // namespace Dali