Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / plugins / plugin_list_parser.cc
index aa3490b..9bf9af5 100644 (file)
@@ -4,20 +4,17 @@
 
 #include "common/plugins/plugin_list_parser.h"
 
-#include <boost/algorithm/string/classification.hpp>
-#include <boost/algorithm/string/split.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
+#include <manifest_parser/utils/string_util.h>
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+#include <filesystem>
+
+namespace fs = std::filesystem;
 
 namespace common_installer {
 
 PluginInfo::PluginInfo(std::string type,
                        std::string name,
-                       boost::filesystem::path path,
+                       std::filesystem::path path,
                        bool vitalness)
     : type_(std::move(type)),
       name_(std::move(name)),
@@ -28,7 +25,7 @@ const std::string& PluginInfo::type() const { return type_; }
 
 const std::string& PluginInfo::name() const { return name_; }
 
-const boost::filesystem::path& PluginInfo::path() const { return path_; }
+const std::filesystem::path& PluginInfo::path() const { return path_; }
 
 bool PluginInfo::vitalness() const {
   return vitalness_;
@@ -129,10 +126,10 @@ const PluginsListParser::PluginList& PluginsListParser::PluginInfoList() const {
 }
 
 bool PluginsListParser::ReadLinesFromFile(std::vector<std::string>* lines) {
-  for (bf::directory_iterator file(path_); file != bf::directory_iterator();
+  for (fs::directory_iterator file(path_); file != fs::directory_iterator();
       ++file) {
-    bs::error_code error;
-    bool is_file = bf::is_regular_file(file->path(), error);
+    std::error_code error;
+    bool is_file = fs::is_regular_file(file->path(), error);
     if (!is_file || error)
       continue;
 
@@ -193,7 +190,7 @@ bool PluginsListParser::ParsePluginsRawData(
     }
 
     plugin_info_list_.push_back(std::make_shared<PluginInfo>(std::move(type),
-        std::move(name), boost::filesystem::path(std::move(path)),
+        std::move(name), std::filesystem::path(std::move(path)),
         (vitalness.compare("true") == 0 ? true : false)));
   }
 
@@ -205,7 +202,7 @@ bool PluginsListParser::SplitPluginLine(const std::string& line,
   static const char kPartsInLine = 3;
 
   std::vector<std::string> _parts;
-  boost::algorithm::split(_parts, line, boost::algorithm::is_any_of(";"));
+  parser::utils::Split(_parts, line, ';');
 
   if (_parts.size() != kPartsInLine && _parts.size() != kPartsInLine + 1) {
     LOG(ERROR) << "Invalid number of parts";