Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / app_query_interface.h
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2
3 #ifndef COMMON_APP_QUERY_INTERFACE_H_
4 #define COMMON_APP_QUERY_INTERFACE_H_
5
6 #include <sys/types.h>
7
8 #include <filesystem>
9 #include <string>
10
11 namespace common_installer {
12
13
14 /**
15  * \brief Base interface for some helper functionalities used before
16  *        configuring app-installer steps.
17  *        Eg. it is used to check, if package is to be installed or updated
18  */
19 class AppQueryInterface {
20  public:
21   /** virtual destructor (for inheritance) */
22   virtual ~AppQueryInterface() { }
23
24   /**
25    * \brief method for checking if package is installed based
26    *        on argv
27    *
28    * \return true if package is installed
29    */
30   bool IsPkgInstalled(const std::string& arg, uid_t uid) const;
31
32   /**
33    * \brief method for getting package id from package file
34    *
35    * \return package id
36    */
37   std::string GetPkgId(const std::string& arg) const;
38
39  protected:
40   virtual std::filesystem::path ExtractManifest(
41       const std::string& from) const;
42   virtual bool ClearTemporaryFile(const std::filesystem::path& path) const;
43
44  private:
45   virtual std::string GetPkgIdFromPath(const std::string& path) const = 0;
46   virtual std::string GetManifestFileName() const = 0;
47 };
48
49 }  // namespace common_installer
50
51 #endif  // COMMON_APP_QUERY_INTERFACE_H_