Include "sys/types.h" at pkgmgr-info.h
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
index 901015b..a82ab8b 100644 (file)
@@ -48,6 +48,8 @@
 
 #include <errno.h>
 #include <stdbool.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -3866,6 +3868,44 @@ static int get_app_submode(const char *appid)
 int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+ * @brief      This API checks if the application has the given category
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle  pointer to the application info handle
+ * @param[in]  category        category
+ * @param[out] exist           value Gets whether the application has the given category
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @code
+static int is_category_exist(const char *appid, const char *category)
+{
+       int ret = 0;
+       pkgmgrinfo_appinfo_h handle;
+       bool exist = false;
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_appinfo_is_category_exist(handle, category, &exist);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist);
+
+/**
  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
  * @brief      This API destroys the application information handle freeing up all the resources
  *