2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FApp_AppInfo.h
19 * @brief This is the header file of the _AppInfo class.
22 #ifndef _FAPP_INTERNAL_APP_INFO_H_
23 #define _FAPP_INTERNAL_APP_INFO_H_
25 #include <FBaseObject.h>
26 #include <FOspConfig.h>
27 #include <FAppTypes.h>
29 #include <FBaseInternalTypes.h>
31 #include "FApp_Types.h"
33 namespace Tizen { namespace Base { class String; } }
35 namespace Tizen { namespace App
41 class _OSP_EXPORT_ _AppInfo
45 * Retrieves class instance.
47 * @return A pointer to the %_AppInfo instance, @n
48 * else @c null if it fails
50 _OSP_LOCAL_ static _AppInfo* GetAppInfo(void);
53 * Gets the Api version of current application.
55 * @return The Api version
57 static Tizen::Base::_ApiVersion GetApiVersion(void);
60 * Checkes whether the compatibility mode is on or not.
62 * @return @true if the compatibility mode is on else false
64 static bool IsOspCompat(void);
67 * Sets the Api version of current application.
69 * @return An error code
70 * @param[in] apiVersion Api version
71 * @exception E_SUCCESS The method is successful.
72 * @exception E_SYSTEM A system error has occurred.
74 static result SetApiVersion(Tizen::Base::_ApiVersion apiVersion);
77 * Gets the current process Id.
79 * @return The process Id
81 static int GetProcessId(void);
84 * Gets the directory file descriptor of application's root directory where the application is installed.
86 * @return The file descriptor of the application's root directory
87 * @remarks This file descriptor is read only.
89 static int GetAppRootDirFd(void);
92 * Gets the application's Id.
94 * @return The application Id
96 static AppId GetApplicationId(void);
99 * Gets the application's Id.
101 * @return The application Id
103 static AppId GetPackageId(void);
106 * Gets the application executable name.
109 static Tizen::Base::String GetAppExecutableName(void);
112 * Checkes whether the application is submode or not.
114 * @return @true if the compatibility mode is on else false
116 static bool IsSubMode(void);
119 // This method is for internal use only.
120 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
122 // Gets the path of application's root directory where the application is installed.
124 // @return The path of the application's root directory
126 static Tizen::Base::String GetAppRootPath(void);
129 * Gets the application's name.
131 * @return The application name
133 static Tizen::Base::String GetAppName(void);
136 * Gets the application's version.
138 * @return The application version
140 static Tizen::Base::String GetAppVersion(void);
143 * Gets the current state of the application.
145 * @return The current state of the application
147 static AppState GetAppState(void);
150 * Sets the current state of the application.
152 * @param appState The current state of the application
154 static void SetAppState(AppState appState);
157 * Gets the current type of the application.
159 * @return The current type of the application
161 static int GetAppType(void);
164 * Sets the current type of the application.
166 * @param appType The current type of the application
168 static void SetAppType(_AppType appType);
171 * Gets the argument count.
175 _OSP_LOCAL_ static int GetArgc(void);
182 _OSP_LOCAL_ static char** GetArgv(void);
185 * Gets the application handler type.
187 * @return appHandlerType
189 _OSP_LOCAL_ static int GetAppHandlerType(void);
192 * Sets the application handler type.
194 * @param appHandlerType
196 _OSP_LOCAL_ static void SetAppHandlerType(int appHandlerType);
199 * Gets the parent window handle.
201 * @return window handle
203 static unsigned int GetParentWindowHandle(void);
206 * Sets the parent window handle.
208 static void SetParentWindowHandle(unsigned int handle);
211 * Update package info
213 static void UpdatePackageInfo(bool update);
215 _OSP_LOCAL_ result Construct(const char* appId, const char* exeName, int argc, char* pArgv[]);
217 _OSP_LOCAL_ result Construct(const char* appId, const char* appRoot, _AppType type = _APP_TYPE_UI_APP);
220 _OSP_LOCAL_ _AppInfo(void);
222 _OSP_LOCAL_ ~_AppInfo(void);
224 _AppInfo(const _AppInfo& value);
226 _AppInfo& operator =(const _AppInfo& source);
228 _OSP_LOCAL_ static Tizen::Base::_ApiVersion GetApiVersionFromStr(const char* pVer);
230 _OSP_LOCAL_ result UpdateAppInfoFromPackageInfo(const PackageId& packageId);
236 int __appHandlerType;
237 int __parentWindowHandle;
238 Tizen::Base::_ApiVersion __apiVersion;
240 PackageId __packageId;
241 Tizen::Base::String __appExecutableName;
242 Tizen::Base::String __appRootPath;
243 Tizen::Base::String* __pAppName;
244 Tizen::Base::String* __pAppVersion;
247 bool __isPackageInfoInitialized;
254 #endif //_FAPP_INTERNAL_APP_INFO_H_