Collect/use multicorejit app profile
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / utils.h
index 77daa24..983eca8 100644 (file)
@@ -21,6 +21,7 @@
 #include <vector>
 #include <functional>
 #include <boost/filesystem.hpp>
+#include <pkgmgr-info.h>
 
 #include <launcher_env.h>
 
 #define PATH_SEPARATOR '/'
 #endif
 
+#ifndef PROFILE_BASENAME
+#define PROFILE_BASENAME ".__tizen_specific_profile_data"
+#endif
+
 namespace bf = boost::filesystem;
 namespace bs = boost::system;
 
@@ -43,21 +48,21 @@ enum FSFlag : int {
  * @brief concat path with PATH_SEPARATOR
  * @param[in] destination path
  * @param[in] source path
- * return std::string result path
+ * @return std::string result path
  */
 std::string concatPath(const std::string& path1, const std::string& path2);
 
 /**
  * @brief get canonicalized absolute Path
  * @param[in] source path
- * return std::string result path
+ * @return std::string result path
  */
 std::string getAbsolutePath(const std::string& path);
 
 /**
  * @brief get the directory of file
  * @param[in] source path
- * return std::string result path
+ * @return std::string result path
  */
 std::string getBaseName(const std::string& path);
 
@@ -66,28 +71,28 @@ std::string getBaseName(const std::string& path);
  * @param[in] original string
  * @param[in] pattern to match
  * @param[in] replacement string
- * return std::string the modified string
+ * @return std::string the modified string
  */
 std::string replaceAll(const std::string& str, const std::string& pattern, const std::string& replace);
 
 /**
  * @brief get root path
  * @param[in] package id
- * return std::string root path
+ * @return std::string root path
  */
 std::string getRootPath(const std::string& pkgId);
 
 /**
  * @brief get exec name
  * @param[in] package id
- * return std::string exec name
+ * @return std::string exec name
  */
 std::string getExecName(const std::string& pkgId);
 
 /**
  * @brief get app type
  * @param[in] package id
- * return std::string app type
+ * @return std::string app type
  */
 std::string getAppType(const std::string& pkgId);
 
@@ -95,11 +100,27 @@ std::string getAppType(const std::string& pkgId);
  * @brief get metadata value
  * @param[in] package id
  * @param[in] metadata key
- * return std::string metadata value
+ * @return std::string metadata value
  */
 std::string getMetadataValue(const std::string& pkgId, const std::string& key);
 
 /**
+ * @brief change the extension of a path or file
+ * @param[in] source path or file
+ * @param[in] from extension
+ * @param[in] to extension
+ * @return std::string path or file with changed extension
+ */
+std::string changeExtension(const std::string& path, const std::string& from, const std::string& to);
+
+/**
+ * @brief check the package is 'readonly' or not
+ * @param[in] package id
+ * @return bool package readonly value
+ */
+bool isReadOnlyApp(const std::string& pkgId);
+
+/**
  * @brief split path with ":" delimiter and put that in the vector
  * @param[in] source path
  * @param[out] string vector
@@ -242,4 +263,34 @@ std::string getFileName(const std::string& path);
  */
 std::string SHA256(const std::string& path);
 
+/**
+ * @brief Creates the package information handle from db which is not disabled.
+ *        This function is a wrapper of pkgmgrinfo_pkginfo_get_pkginfo() to handle multi-user case
+ * @param[in] pkg id
+ * @param[out] pkginfo handle
+ * @return 0 if success, otherwise -1
+ */
+int pkgmgrGetPkgInfo(const std::string& pkgId, pkgmgrinfo_pkginfo_h* handle);
+
+/**
+ * @brief Creates the application information handle from db.
+ *        This function is a wrapper of pkgmgrinfo_appinfo_get_appinfo() to handle multi-user case
+ * @param[in] app id
+ * @param[out] appinfo handle
+ * @return 0 if success, otherwise -1
+ */
+int pkgmgrGetAppInfo(const std::string& appId, pkgmgrinfo_appinfo_h* handle);
+
+/**
+ * @brief Executes the metadata filter query for all the installed packages.
+ *        This function is a wrapper of pkgmgrinfo_appinfo_metadata_filter_foreach() to handle multi-user case
+ * @param[in] metadata filter handle
+ * @param[in] callback function
+ * @param[in] user data
+ * @return 0 if success, otherwise -1
+ */
+int pkgmgrMDFilterForeach(pkgmgrinfo_appinfo_metadata_filter_h handle,
+                                        pkgmgrinfo_app_list_cb app_cb,
+                                        void *user_data);
+
 #endif /* __UTILS_H__ */