2 * Copyright (c) 2011 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
17 #ifndef __TIZEN_APPFW_RESOURCE_MANAGER_H__
18 #define __TIZEN_APPFW_RESOURCE_MANAGER_H__
27 * @file app_resource_manager.h
31 * @addtogroup CAPI_RESOURCE_MANAGER_MODULE
36 * @brief Enumeration for Resource Types
37 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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*/
51 * @brief Enumeration for App Resource Manager Error.
52 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
55 APP_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
56 APP_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
57 APP_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
58 APP_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
59 } app_resource_error_e;
63 * @brief Creates resource manager and get from db.
65 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
66 * @remarks If resource manager already exists,
67 * It will just return APP_RESOURCE_ERROR_NONE
68 * @return @c 0 on success,
69 * otherwise a negative error value
70 * @retval #APP_RESOURCE_ERROR_NONE Successful
71 * @retval #APP_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
72 * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
73 * @see app_resource_manager_release()
75 int app_resource_manager_init(void);
79 * @brief Converts resource ID to path name
81 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
82 * @remarks If resource manager is not created yet,
83 * app_resource_manager_init() will be invoked automatically.
84 * Caller should free the returned pointer.
85 * @param[in] type Resource type @see app_resource_e
86 * @param[in] id Resource ID
87 * @param[out] path The name of requested resource on success, otherwise NULL
88 * @return @c 0 on success,
89 * otherwise a negative error value
90 * @retval #APP_RESOURCE_ERROR_NONE Successful
91 * @retval #APP_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
92 * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
93 * @retval #APP_RESOURCE_ERROR_IO_ERROR Internal I/O Error or failed to find valid resource
94 * @see app_resource_manager_init()
96 int app_resource_manager_get(app_resource_e type, const char *id, char **path);
100 * @brief Destroys resource manager.
102 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
103 * @remarks Please note that the instance of resource manager should only be released when the application is closing.
104 * It is a highly recommended way to improve run-time performance.
105 * @return @c 0 on success,
106 * otherwise a negative error value
107 * @retval #APP_RESOURCE_ERROR_NONE Successful
108 * @see app_resource_manager_init()
110 int app_resource_manager_release(void);
122 #endif /* __TIZEN_APPFW_RESOURCE_MANAGER_H__ */