Fix GetPackageVersion()
[platform/core/appfw/wgt-backend.git] / src / wgt / step / step_parse.h
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef WGT_STEP_STEP_PARSE_H_
6 #define WGT_STEP_STEP_PARSE_H_
7
8 #include <boost/filesystem.hpp>
9
10 #include <common/app_installer.h>
11 #include <common/installer_context.h>
12 #include <common/step/step.h>
13
14 #include <manifest_parser/utils/logging.h>
15 #include <wgt_manifest_handlers/permissions_handler.h>
16 #include <wgt_manifest_handlers/widget_config_parser.h>
17
18 #include <memory>
19 #include <set>
20 #include <string>
21
22 namespace wgt {
23 namespace parse {
24
25 /**
26  * \brief This step parse config.xml configuration file of widget
27  */
28 class StepParse : public common_installer::Step {
29  public:
30   explicit StepParse(common_installer::InstallerContext* context,
31       bool check_start_file);
32
33   Status process() override;
34   Status clean() override { return Status::OK; }
35   Status undo() override { return Status::OK; }
36   Status precheck() override { return Status::OK; }
37
38  protected:
39   virtual bool LocateConfigFile();
40   bool Check(const boost::filesystem::path& widget_path);
41
42   boost::filesystem::path config_;
43
44  private:
45   std::set<std::string> ExtractPrivileges(
46       std::shared_ptr<const PermissionsInfo> perm_info) const;
47
48   std::string GetPackageVersion(const std::string& manifest_version);
49
50   bool FillInstallationInfo(manifest_x* manifest);
51   bool FillIconPaths(manifest_x* manifest);
52   bool FillWidgetInfo(manifest_x* manifest);
53   bool FillUIApplicationInfo(manifest_x* manifest);
54   bool FillServiceApplicationInfo(manifest_x* manifest);
55   bool FillAppControl(manifest_x* manifest);
56   bool FillPrivileges(manifest_x* manifest);
57   bool FillCategories(manifest_x* manifest);
58   bool FillMetadata(manifest_x* manifest);
59   bool FillExtraManifestInfo(manifest_x* manifest);
60   bool FillAccounts(manifest_x* manifest);
61   bool FillBackgroundCategoryInfo(manifest_x* manifest);
62   bool FillManifestX(manifest_x* manifest);
63
64   std::unique_ptr<wgt::parse::WidgetConfigParser> parser_;
65   bool check_start_file_;
66
67   SCOPE_LOG_TAG(Parse)
68 };
69
70 }  // namespace parse
71 }  // namespace wgt
72
73 #endif  // WGT_STEP_STEP_PARSE_H_