support resource manager API.
[platform/core/appfw/pkgmgr-info.git] / parser / pkgmgr_parser_resource.h
1 #ifndef __PKGMGR_PARSER_RESOURCE_H_
2 #define __PKGMGR_PARSER_RESOURCE_H_
3
4 #include <bundle.h>
5 #include <glib.h>
6 #include "pkgmgr_parser.h"
7 #include "pkgmgrinfo_resource.h"
8
9 #define PKGMGR_RSC_GROUP_TYPE_IMAGE "image"
10 #define PKGMGR_RSC_GROUP_TYPE_LAYOUT "layout"
11 #define PKGMGR_RSC_GROUP_TYPE_SOUND "sound"
12 #define PKGMGR_RSC_GROUP_TYPE_BIN "bin"
13
14 #define RSC_NODE_ATTR_SCREEN_DPI "screen-dpi"
15 #define RSC_NODE_ATTR_SCREEN_DPI_RANGE "screen-dpi-range"
16 #define RSC_NODE_ATTR_SCREEN_WIDTH_RANGE "screen-width-range"
17 #define RSC_NODE_ATTR_SCREEN_LARGE "screen-large"
18 #define RSC_NODE_ATTR_SCREEN_BPP "screen-bpp"
19 #define RSC_NODE_ATTR_PLATFORM_VER "platform-version"
20 #define RSC_NODE_ATTR_LANGUAGE "language"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @fn int *pkgmgr_resource_parser_open(const char *fname, const char *package, resource_data_t **data)
28  * @brief       This API initialize parses res.xml which identified by fname and package and put it into data.
29  *
30  * @par         This API is for package-manager installer backends.
31  * @par Sync (or) Async : Synchronous API
32  *
33  * @param[in]   fname           pointer to xml filename
34  * @param[in]   pacakage        pointer to packageID
35  * @param[out]data              pointer of      pointer to resource_data type structure.
36  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
37  */
38 API int pkgmgr_resource_parser_open(const char *fname, const char *package, resource_data_t **data);
39
40 /**
41  * @fn int pkgmgr_resource_parser_close(resource_data_t data)
42  * @brief       This API frees given data and its own variables
43  *
44  * @par         This API is for package-manager installer backends.
45  * @par Sync (or) Async : Synchronous API
46  *
47  * @param[in]   data    structure of resource_data_t
48  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
49  */
50 API int pkgmgr_resource_parser_close(resource_data_t *data);
51
52 /**
53  * @fn int pkgmgr_resource_parser_insert_into_db(resource_data_t *data)
54  * @brief       This API will put given data into db
55  *
56  * @par         This API is for package-manager installer backends.
57  * @par Sync (or) Async : Synchronous API
58  *
59  * @param[in]   data    structure to be inserted into db
60  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
61  */
62 API int pkgmgr_resource_parser_insert_into_db(resource_data_t *data);
63
64 /**
65  * @fn int pkgmgr_resource_parser_open_from_db(const char *package, resource_data_t **data)
66  * @brief       This API will get resource data of specific package from db
67  *
68  * @par         This API is for applications.
69  * @par Sync (or) Async : Synchronous API
70  *
71  * @param[in]   package packageID
72  * @param[out]data      resource_data type structure. it will filled with resource data
73  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
74  */
75 API int pkgmgr_resource_parser_open_from_db(const char *package, resource_data_t **data);
76
77 /**
78  * @fn int pkgmgr_resource_parser_check_xml_validation(const char *xmlfile)
79  * @brief       This API will validates given resource manifest file
80  *
81  * @par         This API is for package-manager installer backends.
82  * @par Sync (or) Async : Synchronous API
83  *
84  * @param[in]   manifest        manifest filepath to be validated
85  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
86  */
87 API int pkgmgr_resource_parser_check_xml_validation(const char *xmlfile);
88
89 /**
90  * @fn int pkgmgr_resource_parser_delete_from_db(const char *package)
91  * @brief       This API will remove resource data from package_resource_info, package_resource_data
92  *
93  * @par         This API is for package-manager installer backends.
94  * @par Sync (or) Async : Synchronous API
95  *
96  * @param[in]   package packageID
97  * @return      0 on succeed and -1 on failure, -2 on invalid parameter
98  */
99 API int pkgmgr_resource_parser_delete_from_db(const char *package);
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif
106