N_SE-44648 : fix window raise on submode
[platform/framework/native/appfw.git] / src / app / inc / FApp_AppArg.h
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_AppArg.h
19  * @brief       This is the header file of the _AppArg class.
20  *
21  * This header file contains the declarations of the _AppArg class.
22  */
23
24 #ifndef _FAPP_INTERNAL_APP_ARG_H_
25 #define _FAPP_INTERNAL_APP_ARG_H_
26
27 #include <FBaseObject.h>
28 #include <FAppTypes.h>
29
30 #include "FApp_Types.h"
31
32 typedef struct _bundle_t bundle;
33
34 namespace Tizen { namespace Base { namespace Collection {
35 class ArrayList;
36 class IList;
37 class HashMap;
38 }}}
39
40 namespace Tizen { namespace App
41 {
42
43 class _AppControlImpl;
44 class _AppMessageImpl;
45 class _SqlDataControlImpl;
46 class _MapDataControlImpl;
47
48 enum _DataControlRequestType
49 {
50         _DATACONTROL_REQUEST_TYPE_UNDEFINED = 0,
51         _DATACONTROL_REQUEST_TYPE_SQL_QUERY,
52         _DATACONTROL_REQUEST_TYPE_SQL_INSERT,
53         _DATACONTROL_REQUEST_TYPE_SQL_UPDATE,
54         _DATACONTROL_REQUEST_TYPE_SQL_DELETE,
55         _DATACONTROL_REQUEST_TYPE_MAP_QUERY,
56         _DATACONTROL_REQUEST_TYPE_MAP_INSERT,
57         _DATACONTROL_REQUEST_TYPE_MAP_UPDATE,
58         _DATACONTROL_REQUEST_TYPE_MAP_DELETE
59 };
60
61 #define OSP_K_LAUNCH_TYPE   "__OSP_LAUNCH_TYPE__"
62 #define OSP_K_ARG           "__OSP_ARGS__"
63 #define OSP_K_COND          "__OSP_COND_NAME__"
64 #define OSP_K_APPID         "__OSP_APPID__"
65 #define OSP_K_REQUEST_ID    "__OSP_REQUEST_ID__"
66 #define OSP_K_SUBMODE_CALLEE    "__OSP_SUB_CALLEE__"
67 #define OSP_K_APPCONTROL_INTERNAL_OPERATION "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__"
68 #define OSP_K_DATACONTROL_PROVIDER              "__OSP_DATACONTROL_PROVIDER__"
69 #define OSP_K_DATACONTROL_DATA                  "__OSP_DATACONTROL_DATA__"
70 #define OSP_K_DATACONTROL_REQUEST_TYPE  "__OSP_DATACONTROL_REQUEST_TYPE__"
71 #define OSP_K_DATACONTROL_PROTOCOL_VERSION      "__OSP_DATACONTROL_PROTOCOL_VERSION__"
72
73 /**
74  * @class        _AppArg
75  * @brief
76  */
77 class _OSP_EXPORT_ _AppArg
78 {
79 public:
80         _AppArg(void);
81
82         ~_AppArg(void);
83
84         result Construct(const Tizen::Base::String& argText);
85
86         result Construct(const Tizen::Base::Collection::IList* pList);
87
88         result Construct(const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
89
90         result Construct(const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
91
92         result Construct(const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
93
94         result Construct(const _AppMessageImpl& msg, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime);
95
96         result Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
97
98         result Construct(const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
99
100         result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IList* pList);
101
102         result ConstructResult(const _AppArg& arg, const Tizen::Base::Collection::IMap* pMap);
103
104         result Construct(bundle* b);
105
106         result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
107         result ConstructForAppLaunchCondition(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList, const Tizen::Base::Collection::IMap* pMap);
108
109         Tizen::Base::Collection::ArrayList* GetArgListN(int num) const;
110
111         Tizen::Base::Collection::ArrayList* GetArgListN(void) const;
112
113         Tizen::Base::Collection::HashMap* GetArgMapN(void) const;
114
115         Tizen::Base::String GetValue(const char* key) const;
116
117         bundle* GetBundle(void) const
118         {
119                 return __pBundle;
120         }
121
122         _AppHandler GetHandler(void) const
123         {
124                 return GetHandler(__pBundle);
125         }
126
127         AppId GetCallerAppId(void) const;
128
129         int GetCallerPid(void) const
130         {
131                 return GetCallerPid(__pBundle);
132         }
133
134         AppId GetCalleeAppId(void) const;
135
136         void Print() const
137         {
138                 Print(__pBundle);
139         }
140
141         void UpdateAppId(const AppId& appId)
142         {
143                 UpdateAppId(__pBundle, appId);
144         }
145
146         void UpdateRequestId(int reqId)
147         {
148                 UpdateRequestId(__pBundle, reqId);
149         }
150
151         void UpdateKeyValue(const char* pKey, const Tizen::Base::String& value)
152         {
153                 UpdateKeyValue(__pBundle, pKey, value);
154         }
155
156         result UpdateWindowHandle(long handle)
157         {
158                 return UpdateWindowHandle(__pBundle, handle);
159         }
160
161         static int GetCallerPid(bundle* b);
162
163         static void Print(bundle* b);
164
165         static void PrintSvcHandle(void* svc);
166
167         static _AppHandler GetHandler(bundle* b);
168
169         static bundle* GetBundleFromSvc(void* svc);
170
171         static Tizen::Base::String GetRequestId(int num);
172
173         static int GetRequestId(const Tizen::Base::String& id);
174
175         static void UpdateAppId(bundle* b, const AppId& appid);
176
177         static int GetRequestIdFromBundle(bundle* p);
178
179         static void UpdateRequestId(bundle* b, int reqId);
180
181         static void UpdateKeyValue(bundle* b, const char* pKey, const Tizen::Base::String& value);
182
183         static void UpdateSubMode(bundle* b);
184
185         static bool IsSubMode(bundle* b);
186
187         static result UpdateWindowHandle(bundle* b, long handle);
188
189         static Tizen::Base::Collection::ArrayList* GetListN(bundle* b, const char* key);
190
191         static result AddStrMap(bundle* b, const Tizen::Base::Collection::IMap* pMap);
192
193         static result FillMapFromList(Tizen::Base::Collection::IMap* pMap, const Tizen::Base::Collection::IList* pList);
194
195         static result FillLegacyAppControlResult(Tizen::Base::Collection::IList& list, int res, const Tizen::Base::Collection::IMap* pMap, const Tizen::Base::String& aId);
196
197         static result SetArgMap(bundle* pBundle, Tizen::Base::Collection::HashMap* pMap);
198
199 private:
200         _AppArg(const _AppArg& value);
201
202         _AppArg& operator =(const _AppArg& source);
203
204         static result CreateLaunchArg(bundle* b, const Tizen::Base::String& arg);
205
206         static result CreateLaunchArg(bundle* b, const Tizen::Base::Collection::IList* pList);
207
208         static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::Collection::IList* pList);
209
210         static result CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pList);
211
212         static result CreateAppControlArg(bundle* b, const Tizen::Base::String& oId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, const Tizen::Base::Collection::IMap* pMap);
213
214         static result CreateSqlDataControlArg(bundle* b, const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
215
216         static result CreateMapDataControlArg(bundle* b, const _MapDataControlImpl& dc, _DataControlRequestType requestType, const Tizen::Base::Collection::IList* pList);
217
218         static result CreateAppLaunchConditionArg(bundle* b, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pList);
219
220         static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IList* pList);
221
222         static result CreateResultArg(bundle* b, const Tizen::Base::Collection::IMap* pList);
223
224         static result AddStrArray(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
225
226         static result AddStrArray(bundle* b, const Tizen::Base::String& key, const Tizen::Base::Collection::IList* pList);
227
228         static bundle* CreateBundleFromSvc(void* svc);
229
230         static inline void AddListFromBundle(Tizen::Base::Collection::ArrayList* pList, bundle* b, const char* key);
231
232         static result SetArgList(bundle* pBundle, Tizen::Base::Collection::ArrayList* pList);
233
234 private:
235         bundle* __pBundle;
236 }; // _AppArg
237
238 } } // Tizen::App
239
240 #endif //_FAPP_INTERNAL_APP_ARG_H_