ad584401f98d7a6115ca1cf7e844e437d2c953e5
[apps/native/sample/BasicApp.git] / project / src / BasicAppEntry.cpp
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * This file contains the Tizen application entry point.
20  */
21
22 #include <new>
23
24 #include "BasicApp.h"
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif // __cplusplus
33
34 _EXPORT_ int OspMain(int argc, char* pArgv[]);
35
36 /**
37  * The entry function of Tizen application called by the operating system.
38  */
39 int
40 OspMain(int argc, char* pArgv[])
41 {
42         AppLog("Application started.");
43         ArrayList args;
44         args.Construct();
45         for (int i = 0; i < argc; i++)
46         {
47                 args.Add(*(new (std::nothrow) String(pArgv[i])));
48         }
49
50         result r = Tizen::App::Application::Execute(BasicApp::CreateInstance, &args);
51         
52         TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r));
53
54         args.RemoveAll(true);
55         AppLog("Application finished.");
56
57         return static_cast<int>(r);
58 }
59 #ifdef __cplusplus
60 }
61 #endif // __cplusplus