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 unsigned int ageInSeconds() const;
70 * access the raw property data in the catalog
72 SGPropertyNode* properties() const;
77 friend class Downloader;
79 void parseProps(const SGPropertyNode* aProps);
81 void refreshComplete(bool aSuccess);
83 void parseTimestamp();
84 void writeTimestamp();
86 std::string getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const;
89 SGPropertyNode_ptr m_props;
92 PackageList m_packages;
93 time_t m_retrievedTime;
98 } // of namespace simgear
100 #endif // of SG_PACKAGE_CATALOG_HXX