#include <simgear/props/props.hxx>
#include <simgear/misc/strutils.hxx>
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
+
typedef std::set<std::string> string_set;
namespace simgear
class Install;
class Catalog;
class Package;
+
+typedef SGSharedPtr<Package> PackageRef;
+typedef SGSharedPtr<Catalog> CatalogRef;
+typedef SGSharedPtr<Install> InstallRef;
-typedef std::vector<Package*> PackageList;
+typedef std::vector<PackageRef> PackageList;
-class Package
+ class Package : public SGReferenced
{
public:
/**
* get or create an install for the package
*/
- Install* install();
-
+ InstallRef install();
+
+ InstallRef existingInstall() const;
+
bool isInstalled() const;
std::string id() const;
+ /**
+ * human-readable name - note this is probably not localised,
+ * although this is not ruled out for the future.
+ */
+ std::string name() const;
+
+ /**
+ * syntactic sugar to get the localised description
+ */
+ std::string description() const;
+
/**
* access the raw property data in the package
*/
unsigned int revision() const;
- Catalog* catalog() const
+ CatalogRef catalog() const
{ return m_catalog; }
bool matches(const SGPropertyNode* aFilter) const;
*/
PackageList dependencies() const;
private:
+ SGPath pathOnDisk() const;
+
friend class Catalog;
- Package(const SGPropertyNode* aProps, Catalog* aCatalog);
+ Package(const SGPropertyNode* aProps, CatalogRef aCatalog);
void initWithProps(const SGPropertyNode* aProps);
SGPropertyNode_ptr m_props;
string_set m_tags;
- Catalog* m_catalog;
+ CatalogRef m_catalog;
};