1 #ifndef SG_PACKAGE_CATALOG_HXX
2 #define SG_PACKAGE_CATALOG_HXX
7 #include <simgear/misc/sg_path.hxx>
8 #include <simgear/props/props.hxx>
13 namespace HTTP { class Client; }
23 typedef std::vector<Package*> PackageList;
24 typedef std::vector<Catalog*> CatalogList;
31 static Catalog* createFromUrl(Root* aRoot, const std::string& aUrl);
33 static Catalog* createFromPath(Root* aRoot, const SGPath& aPath);
35 static CatalogList allCatalogs();
41 * perform a refresh of the catalog contents
45 * retrieve packages in this catalog matching a filter.
46 * filter consists of required / minimum values, AND-ed together.
48 PackageList packagesMatching(const SGPropertyNode* aFilter) const;
51 * retrieve all the packages in the catalog which are installed
52 * and have a pendig update
54 PackageList packagesNeedingUpdate() const;
56 SGPath installRoot() const
57 { return m_installRoot; }
59 std::string id() const;
61 std::string url() const;
63 std::string description() const;
65 Package* getPackageById(const std::string& aId) const;
67 int ageInSeconds() const;
72 friend class Downloader;
74 void parseProps(const SGPropertyNode* aProps);
76 void refreshComplete(bool aSuccess);
78 void parseTimestamp();
79 void writeTimestamp();
81 std::string getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const;
84 SGPropertyNode_ptr m_props;
87 PackageList m_packages;
88 time_t m_retrievedTime;
93 } // of namespace simgear
95 #endif // of SG_PACKAGE_CATALOG_HXX