Merge "Add a _LocalizedNumParser class and 4 static functions" into tizen_2.1
[platform/framework/native/appfw.git] / src / app / FApp_AppControlEventArg.cpp
1 //
2 // Copyright (c) 2012 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  * @file         FApp_AppControlEventArg.cpp
19  * @brief       This is the implementation for the _AppControlEventArg.cpp class.
20  */
21
22 #include <unique_ptr.h>
23
24 #include <FBaseString.h>
25 #include <FBaseColIMap.h>
26 #include <FBaseColHashMap.h>
27 #include <FBaseSysLog.h>
28
29 #include "FApp_AppControlEventArg.h"
30 #include "FApp_AppArg.h"
31
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34
35 namespace Tizen { namespace App
36 {
37
38 _AppControlEventArg::~_AppControlEventArg(void)
39 {
40         SysLog(NID_APP, "Deleting launch argument...");
41         delete __pArg;
42 }
43
44 _NativeAppControlEventArg::_NativeAppControlEventArg(int reqId, int res, IMap* pArg)
45         : __reqId(reqId)
46         , __result(res)
47         , __pArgs(null)
48 {
49         if (pArg == null)
50         {
51                 return;
52         }
53
54 #if 0
55         HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
56         SysTryReturnVoidResult(NID_APP, pMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
57
58         pMap->Construct();
59
60         std::unique_ptr<IMapEnumerator> pMapEnum(pArg->GetMapEnumeratorN());
61
62         while(pMapEnum->MoveNext() == E_SUCCESS)
63         {
64                 String* pKey = dynamic_cast<String*>(pMapEnum->GetKey());
65                 String* pVal = dynamic_cast<String*>(pMapEnum->GetValue());
66
67                 if (pKey == null || pVal == null)
68                 {
69                         continue;
70                 }
71
72                 pMap->Add(new (std::nothrow) String(*pKey), new (std::nothrow) String(*pVal));
73         }
74
75         __pArgs = pMap;
76 #else
77         // ownership is transferred to event
78         __pArgs = pArg;
79 #endif
80
81         return;
82 }
83
84 _NativeAppControlEventArg::~_NativeAppControlEventArg(void)
85 {
86 /*
87         if (__pArgs)
88         {
89                 SysLog(NID_APP, "Deleting native AppControl argument.");
90                 delete __pArgs;
91         }
92 */
93 }
94
95 } } // Tizen::App