/* * Copyright (c) 2001, 2003 Robert Collins. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * A copy of the GNU General Public License can be found at * http://www.gnu.org/ * * Written by Robert Collins * */ #ifndef SETUP_PACKAGE_VERSION_H #define SETUP_PACKAGE_VERSION_H /* This is a package version abstrct class, that should be able to * arbitrate acceess to cygwin binary packages, cygwin source package, * and the rpm and deb equivalents of the same. */ /* standard binary package metadata: * Name (ie mutt * Vendor Version (ie 2.5.1) * Package Version (ie 16) * Stability * Files */ /* For non installed files, this class can be populated via information about * what is available on the net, or by parsing a specific package file. * for installed packages, this class should represent what is currently installed, * - updated by what net metadata has about it. * i.e. the stability of this version will change simply because the net mirrors * now consider it old. */ class CategoryList; /*Required for parsing */ #include "package_source.h" #include "String++.h" #include "PackageSpecification.h" #include "PackageTrust.h" #include "script.h" #include typedef enum { package_invalid, package_old, package_current, package_experimental } package_stability_t; typedef enum { package_notinstalled, package_installed } package_status_t; typedef enum { package_binary, package_source } package_type_t; /* A wrapper class to be copied by value that references the same package. Nothing is virtual, because the wrapper cannot be inherited. However, as all the methods are implemented in the referenced _packageversion, that class allows virtual overriding. */ class _packageversion; /* This class has pointer semantics Specifically: a=b does not alter the value of *a. */ class packageversion { public: packageversion (); /* creates an empty packageversion */ packageversion (_packageversion *); /* used when creating an instance */ packageversion (packageversion const &); ~packageversion (); packageversion &operator= (packageversion const &); bool operator ! () const; /* true if the package is invalid. (i.e. uninitialised */ operator bool () const; /* returns ! !() */ bool operator == (packageversion const &) const; /* equality */ bool operator != (packageversion const &) const; bool operator < (packageversion const &) const; bool operator <= (packageversion const &) const; bool operator > (packageversion const &) const; bool operator >= (packageversion const &) const; String const Name () const; String const Vendor_version () const; String const Package_version () const; String const Canonical_version () const; void setCanonicalVersion (String const &); package_status_t Status () const; package_type_t Type () const; String const getfirstfile (); String const getnextfile (); String const SDesc () const; void set_sdesc (String const &); String const LDesc () const; void set_ldesc (String const &); packageversion sourcePackage () const; PackageSpecification & sourcePackageSpecification (); void setSourcePackageSpecification (PackageSpecification const &); /* invariant: these never return NULL */ std::vector *> *depends(), *predepends(), *recommends(), *suggests(), *replaces(), *conflicts(), *provides(), *binaries(); bool picked() const; /* true if this version is to be installed */ void pick(bool); /* trigger an install/reinsall */ /* a change - install/uninstall/reinstall/source install has been requested */ bool changeRequested () const; void uninstall (); /* invariant: never null */ packagesource *source(); /* where can we source the file from */ /* invariant: never null */ std::vector *sources(); /* expose the list of files. source() returns the 'default' file sources() allows managing multiple files in a single package */ bool accessible () const; /* scan for local copies */ void scan(); /* ensure that the depends clause is satisfied */ int set_requirements (trusts deftrust = TRUST_CURR, size_t depth = 0); void addScript(Script const &); std::vector