Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Sample / Tizen C++ / XmlParserApp / XmlParserApp / project / src / XmlParserAppEntry.cpp
1 //\r
2 // Open Service Platform\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  * This file contains the Tizen C++ application entry point.\r
19  */\r
20 #include "XmlParserApp.h"\r
21 \r
22 using namespace Osp::Base;\r
23 using namespace Osp::Base::Collection;\r
24 \r
25 #ifdef __cplusplus\r
26 extern "C"\r
27 {\r
28 #endif // __cplusplus\r
29 \r
30 _EXPORT_ int OspMain(int argc, char *pArgv[]);\r
31 #ifdef _PROFILE\r
32 extern void start_profile (void);\r
33 extern void end_profile (void);\r
34 #else\r
35 #define start_profile()\r
36 #define end_profile()\r
37 #endif\r
38 \r
39 \r
40 /**\r
41  * The entry function of Tizen C++ application called by the operating system.\r
42  */\r
43 int\r
44 OspMain(int argc, char *pArgv[])\r
45 {\r
46         result r = E_SUCCESS;\r
47 \r
48         AppLog("Application started.");\r
49         ArrayList* pArgs = new ArrayList();\r
50         pArgs->Construct();\r
51         for (int i = 0; i < argc; i++)\r
52                 pArgs->Add(*(new String(pArgv[i])));\r
53 \r
54         start_profile();\r
55         r = Osp::App::Application::Execute(XmlParserApp::CreateInstance, pArgs);\r
56         if (IsFailed(r))\r
57         {\r
58                 AppLogException("Application execution failed-[%s].", GetErrorMessage(r));\r
59                 r &= 0x0000FFFF;\r
60         }\r
61         end_profile();\r
62 \r
63         pArgs->RemoveAll(true);\r
64         delete pArgs;\r
65         AppLog("Application finished.");\r
66 \r
67         return static_cast<int>(r);\r
68 }\r
69 #ifdef __cplusplus\r
70 }\r
71 #endif // __cplusplus\r