]> git.mxchange.org Git - simgear.git/blob - simgear/package/Package.hxx
416384d84e41a0cb1dbd1ec919f3fa7a26a1ce58
[simgear.git] / simgear / package / Package.hxx
1 #ifndef SG_PACKAGE_PACKAGE_HXX
2 #define SG_PACKAGE_PACKAGE_HXX
3
4 #include <set>
5 #include <vector>
6
7 #include <simgear/props/props.hxx>
8 #include <simgear/misc/strutils.hxx>
9
10 typedef std::set<std::string> string_set;
11
12 namespace simgear
13 {
14     
15 namespace pkg
16 {
17
18 // forward decls
19 class Install;
20 class Catalog;
21
22 class Package
23 {
24 public:
25     /**
26      * get or create an install for the package
27      */
28     Install* install();
29     
30     bool isInstalled() const;
31     
32     std::string id() const;
33     
34     std::string md5() const;
35     
36     std::string getLocalisedProp(const std::string& aName) const;
37
38     unsigned int revision() const;
39     
40     Catalog* catalog() const
41         { return m_catalog; }
42     
43     bool matches(const SGPropertyNode* aFilter) const;
44     
45     string_list downloadUrls() const;
46 private:
47     friend class Catalog;
48     
49     Package(const SGPropertyNode* aProps, Catalog* aCatalog);
50     
51     void initWithProps(const SGPropertyNode* aProps);
52     
53     std::string getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const;
54     
55     SGPropertyNode_ptr m_props;
56     string_set m_tags;
57     Catalog* m_catalog;
58 };
59
60 typedef std::vector<Package*> PackageList;
61
62
63 } // of namespace pkg
64
65 } // of namespace simgear
66
67 #endif // of SG_PACKAGE_PACKAGE_HXX
68