Adjust coding rules
[platform/core/api/application.git] / include / app_resource_manager.h
1 /*
2  * Copyright (c) 2011 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef __TIZEN_APPFW_RESOURCE_MANAGER_H__
18 #define __TIZEN_APPFW_RESOURCE_MANAGER_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @file app_resource_manager.h
28  */
29
30 /**
31  * @addtogroup CAPI_RESOURCE_MANAGER_MODULE
32  * @{
33  */
34
35 /**
36  * @brief Enumeration for Resource Types
37  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
38  */
39 typedef enum {
40         APP_RESOURCE_TYPE_IMAGE = 0, /**<Image*/
41         APP_RESOURCE_TYPE_LAYOUT, /**<Edje*/
42         APP_RESOURCE_TYPE_SOUND, /**<Sound*/
43         APP_RESOURCE_TYPE_BIN, /**<Bin*/
44         APP_RESOURCE_TYPE_MIN = APP_RESOURCE_TYPE_IMAGE,
45         APP_RESOURCE_TYPE_MAX = APP_RESOURCE_TYPE_BIN,
46 /*add values between APP_RESOURCE_TYPE_MIN and APP_RESOURCE_TYPE_MAX*/
47 } app_resource_e;
48
49 /**
50  * @brief Enumeration for App Resource Manager Error.
51  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
52  */
53 typedef enum {
54         APP_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
55         APP_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
56         APP_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
57         APP_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
58 } app_resource_error_e;
59
60 /**
61  * @brief Creates resource manager and get from db.
62  *
63  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
64  * @remarks If resource manager is already exist,
65  *                      It will just return APP_RESOURCE_ERROR_NONE
66  * @return @c 0 on success,
67  *         otherwise a negative error value
68  * @retval #APP_RESOURCE_ERROR_NONE Successful
69  * @retval #APP_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
70  * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
71  * @see app_resource_manager_release()
72  */
73 int app_resource_manager_init(void);
74
75 /**
76  * @brief Convert resource ID to path name
77  *
78  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
79  * @remarks If resource manager is not created yet,
80  *                      app_resource_manager_init() will be invoked automatically.
81  *                      Caller should free the returned pointer.
82  * @param[in] type Resource type @see app_resource_e
83  * @param[in] id Resource ID
84  * @param[out] path The name of requested resource on success, otherwise NULL
85  * @return @c 0 on success,
86  *         otherwise a negative error value
87  * @retval #APP_RESOURCE_ERROR_NONE Successful
88  * @retval #APP_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
89  * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
90  * @retval #APP_RESOURCE_ERROR_IO_ERROR Internal I/O Error or failed to find valid resource
91  * @see app_resource_manager_init()
92  */
93 int app_resource_manager_get(app_resource_e type, const char *id, char **path);
94
95 /**
96  * @brief Destroys resource manager.
97  *
98  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
99  * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
100  *          It is highly recommended way to improve run-time performance.
101  * @return @c 0 on success,
102  *         otherwise a negative error value
103  * @retval #APP_RESOURCE_ERROR_NONE Successful
104  * @see app_resource_manager_init()
105  */
106 int app_resource_manager_release(void);
107
108 /**
109  * @}
110  */
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* __TIZEN_APPFW_RESOURCE_MANAGER_H__ */
117