Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / installer / app_installer.h
index 32b0b78..6cb0627 100644 (file)
@@ -8,8 +8,7 @@
 
 #include <manifest_parser/utils/logging.h>
 
-#include <boost/bind/bind.hpp>
-
+#include <algorithm>
 #include <list>
 #include <memory>
 #include <string>
@@ -30,7 +29,7 @@ namespace common_installer {
  *        the lists of steps and runs each of the step in the configured
  *        order.
  */
-class AppInstaller {
+class AppInstaller : public Step::IStepErrorSignal {
  public:
   /** Enumeration of possible returned Results */
   enum class Result {
@@ -52,6 +51,9 @@ class AppInstaller {
   /** virtual desctructor */
   virtual ~AppInstaller();
 
+  /** error handler for sending error signal */
+  void on_error(Step::Status result, const std::string& error) override;
+
   /**
    * \brief Adds new step to installer by specified type
    *        Type of template parameter is used to create requested step
@@ -68,9 +70,7 @@ class AppInstaller {
   void AddStep(Args&&... args) {
     std::unique_ptr<Step> step(
         new StepT(context_.get(), std::forward<Args>(args)...));
-    step->on_error.connect(
-        boost::bind(&AppInstaller::HandleStepError, this,
-            boost::placeholders::_1, boost::placeholders::_2));
+    step->connect(this);
     steps_.emplace_back(std::move(step));
   }
 
@@ -108,9 +108,7 @@ class AppInstaller {
   void AddStepAtIndex(unsigned int index, Args&&... args) {
     std::unique_ptr<Step> step(
         new StepT(context_.get(), std::forward<Args>(args)...));
-    step->on_error.connect(
-        boost::bind(&AppInstaller::HandleStepError, this,
-            boost::placeholders::_1, boost::placeholders::_2));
+    step->connect(this);
     std::list<std::unique_ptr<Step>> tmpList;
     tmpList.emplace_back(std::move(step));
     auto it = steps_.begin();
@@ -144,9 +142,7 @@ class AppInstaller {
 
     std::unique_ptr<Step> step(
         new StepT(context_.get(), std::forward<Args>(args)...));
-    step->on_error.connect(
-        boost::bind(&AppInstaller::HandleStepError, this,
-            boost::placeholders::_1, boost::placeholders::_2));
+    step->connect(this);
     *it = std::move(step);
   }
 
@@ -176,9 +172,7 @@ class AppInstaller {
 
     std::unique_ptr<Step> step(
         new StepT(context_.get(), std::forward<Args>(args)...));
-    step->on_error.connect(
-        boost::bind(&AppInstaller::HandleStepError, this,
-            boost::placeholders::_1, boost::placeholders::_2));
+    step->connect(this);
     steps_.insert(it, std::move(step));
   }
 
@@ -208,9 +202,7 @@ class AppInstaller {
 
     std::unique_ptr<Step> step(
         new StepT(context_.get(), std::forward<Args>(args)...));
-    step->on_error.connect(
-        boost::bind(&AppInstaller::HandleStepError, this,
-            boost::placeholders::_1, boost::placeholders::_2));
+    step->connect(this);
     steps_.insert(++it, std::move(step));
   }