Merge "[2.2.1] Remove error check code in CopyCtor of String" into tizen_2.2
[platform/framework/native/appfw.git] / src / server / inc / FApp_AppLaunchCondition.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_IConditionalOperation.h
19  * @brief       This is the header file of the _AppLaunchCondition class.
20  *
21  * This header file contains the declarations of the _AppLaunchCondition class
22  */
23
24 #ifndef _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_
25 #define _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_
26
27
28 #include <FOspConfig.h>
29 #include <FBaseObject.h>
30 #include <FBaseColIList.h>
31 #include <FBaseColArrayList.h>
32 #include <FAppTypes.h>
33 #include <FAppAppManager.h>
34
35 #include <FBaseSysLog.h>
36
37 namespace Tizen { namespace App {
38
39
40 /**
41  * @class       _AppLaunchCondition
42  * @brief       This class abstracts information for conditional app launch
43  * @since 2.1
44  */
45 class _OSP_EXPORT_ _AppLaunchCondition
46         : public Tizen::Base::Object
47 {
48 public:
49         /**
50          * Gets the application ID of the target application.
51          *
52          * @return              application ID
53          * @since 2.1
54          */
55         AppId GetAppId(void) const;
56
57         /**
58          * Gets registered condition string.
59          * @return              condition string
60          *
61          * @since 2.1
62          */
63         Tizen::Base::String GetConditionString(void) const;
64
65         /**
66          * Sets userdata
67          *
68          * @param[in]   pUserData       The pointer to userdata of this instance
69          *                                                      Userdata can be context or handle. (ex, Alarm instance, Timer handle, etc)
70          * @since 2.1
71          * @see         GetUserData
72          */
73         result SetUserData(const Object* pUserData);
74
75         /**
76          * Gets userdata
77          *
78          * @return      The pointer to userdata of this instance.
79          *                      You can cancel or delete plugin dependent information using this pointer in overridden function _AppLaunchConditionBase::Unregister.
80          * @since 2.1
81          * @see         SetUserData
82          */
83         Object* GetUserData(void) const;
84
85
86 private:
87         /**
88          * This is the constructor for this class.
89          *
90          * @since 2.1
91          */
92         _AppLaunchCondition(void);
93
94         /**
95          * This is the destructor for this class.
96          *
97          * @since 2.1
98          */
99         virtual ~_AppLaunchCondition(void);
100
101         /**
102          * Initializes this instance of _AppLaunchCondition with the specified parameter
103          *
104          * @since 2.1
105          * @return              An error code
106          * @param[in]   appId                           The application's ID to be executed conditionally
107          * @param[in]   condition                       The launch condition for the application
108          * @param[in]   pArguments                      A pointer to the list of string arguments that has a maximum size of @c 1024 bytes @n
109          *                                                                      The default value is @c null.
110          * @param[in]   option                          The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
111          * @param[in]   pRegSectionName         The section name in the registry.
112                                                                                 This value is used to find a registry section by condition string and remove it easily.
113          * @exception   E_SUCCESS                       The method is successful.
114          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
115
116          * @see Tizen::App::AppManager::RegisterAppLaunch()
117          */
118         result Construct(const AppId& appId, const Tizen::Base::String& conditionString, const Base::Collection::IList* pArgs, AppManager::LaunchOption option , const Tizen::Base::String* pRegSectionName = null);
119
120 private:
121         _AppLaunchCondition(const _AppLaunchCondition& operation);
122         _AppLaunchCondition& operator =(const _AppLaunchCondition& operation);
123
124 private:
125         // app launch info
126         AppId __appId;
127         Tizen::Base::Collection::ArrayList *__pArguments;
128         AppManager::LaunchOption __option;
129
130         // condition info
131         Tizen::Base::String __conditionString;
132         const Object* __pUserData;///<<  pointer to plugin's context or handle. (ex, Alarm instance, Timer handle, etc). You can cancel or delete registered operation using this value, when _AppLaunchConditionBase::Unregister implemented function is invoked.
133
134         result CopyArgumentsDeeply(const Tizen::Base::Collection::IList *pArgs);
135         Tizen::Base::String __regSectionName;
136
137         friend class _ConditionHandler;
138         friend class _ConditionManagerService;
139 };      //_AppLaunchCondition
140
141
142 }}
143
144 #endif // _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_