Fix static analyzer issues
[platform/core/appfw/wgt-backend.git] / src / hybrid / step / pkgmgr / step_generate_xml.h
1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef HYBRID_STEP_PKGMGR_STEP_GENERATE_XML_H_
6 #define HYBRID_STEP_PKGMGR_STEP_GENERATE_XML_H_
7
8 #include <boost/filesystem.hpp>
9
10 #include <common/step/step.h>
11 #include <manifest_parser/utils/logging.h>
12 #include <libxml/tree.h>
13
14 #include <string>
15
16 namespace hybrid {
17 namespace pkgmgr {
18
19 class StepGenerateXml : public common_installer::Step {
20  public:
21   using Step::Step;
22   explicit StepGenerateXml(common_installer::InstallerContext* context)
23       : Step(context), wgt_doc_(nullptr), tpk_doc_(nullptr) {}
24   Status process() override;
25   Status clean() override { return Status::OK; }
26   Status undo() override { return Status::OK; }
27   Status precheck() override;
28
29  private:
30   bool LoadXmlDocument(const boost::filesystem::path& wgt_xml_path,
31       const boost::filesystem::path& tpk_xml_path);
32   xmlNodePtr GetXmlNode(const xmlDocPtr doc, const std::string& name,
33       const std::string& attr = {}, const std::string& attr_val = {});
34   void MergeXmlNode(xmlNodePtr node1, xmlNodePtr node2);
35   void SetXmlNodeAttribute(xmlNodePtr node, const std::string& attr,
36       const std::string& attr_val);
37
38   xmlDocPtr wgt_doc_;
39   xmlDocPtr tpk_doc_;
40
41   STEP_NAME(GenerateXml2);
42 };
43
44 }  // namespace pkgmgr
45 }  // namespace hybrid
46
47 #endif  // HYBRID_STEP_PKGMGR_STEP_GENERATE_XML_H_