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