Initialize Tizen 2.3
[framework/web/wrt-installer.git] / tests / general / ManifestFile.h
1 /*
2  * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        ManifestFile.h
18  * @author      Tomasz Iwanek (t.iwanek@samsung.com)
19  * @brief       Manifest file reading
20  */
21
22 #ifndef WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
23 #define WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
24
25 #include <string>
26
27 #include <libxml/xpath.h>
28 #include <libxml/xpathInternals.h>
29
30 #include <dpl/exception.h>
31
32 /**
33  * @brief The ManifestFile class which serialize xml file to tree
34  */
35 class ManifestFile
36 {
37 public:
38     DECLARE_EXCEPTION_TYPE(DPL::Exception,Base)
39     DECLARE_EXCEPTION_TYPE(Base,ManifestParseError)
40
41     ManifestFile(const std::string & file);
42     ~ManifestFile();
43
44     std::string getValueByXpath(const std::string & path) const;
45 private:
46     void parse();
47
48     std::string filename;
49     xmlDocPtr doc;
50     xmlXPathContextPtr xpathCtx;
51 };
52
53
54 #endif //WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H