X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/094a497dd2dba1f47157e07d57f97c338a5ddaa0..e75f306ea9596c82e3b0c188e9b5203fc9d619da:/apt-pkg/version.h diff --git a/apt-pkg/version.h b/apt-pkg/version.h index b263d7c90..071dba3e2 100644 --- a/apt-pkg/version.h +++ b/apt-pkg/version.h @@ -1,17 +1,22 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: version.h,v 1.3 1998/07/12 23:58:43 jgg Exp $ +// $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $ /* ###################################################################### - Version - Version string - - This class implements storage and operators for version strings. + Version - Versioning system.. - The client is responsible for stripping epochs should it be desired. + The versioning system represents how versions are compared, represented + and how dependencies are evaluated. As a general rule versioning + systems are not compatible unless specifically allowed by the + TestCompatibility query. + + The versions are stored in a global list of versions, but that is just + so that they can be queried when someone does 'apt-get -v'. + pkgSystem provides the proper means to access the VS for the active + system. ##################################################################### */ /*}}}*/ -// Header section: pkglib #ifndef PKGLIB_VERSION_H #define PKGLIB_VERSION_H @@ -19,31 +24,44 @@ #pragma interface "apt-pkg/version.h" #endif +#include #include -class pkgVersion +using std::string; + +class pkgVersioningSystem { - string Value; - public: + // Global list of VS's + static pkgVersioningSystem **GlobalList; + static unsigned long GlobalListLen; + static pkgVersioningSystem *GetVS(const char *Label); + + const char *Label; + + // Compare versions.. + virtual int DoCmpVersion(const char *A,const char *Aend, + const char *B,const char *Bend) = 0; - inline operator string () const {return Value;}; - - // Assignmnet - void operator =(string rhs) {Value = rhs;}; + virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0; + virtual int DoCmpReleaseVer(const char *A,const char *Aend, + const char *B,const char *Bend) = 0; + virtual string UpstreamVersion(const char *A) = 0; - // Comparitors. STL will provide the rest - bool operator ==(const pkgVersion &rhs) const; - bool operator <(const pkgVersion &rhs) const; + // See if the given VS is compatible with this one.. + virtual bool TestCompatibility(pkgVersioningSystem const &Against) + {return this == &Against;}; + + // Shortcuts + APT_MKSTRCMP(CmpVersion,DoCmpVersion); + APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer); - pkgVersion(); - pkgVersion(string Version) : Value(Version) {}; + pkgVersioningSystem(); + virtual ~pkgVersioningSystem() {}; }; -int pkgVersionCompare(const char *A, const char *B); -int pkgVersionCompare(const char *A, const char *AEnd, const char *B, - const char *BEnd); -int pkgVersionCompare(string A,string B); -bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op); +#ifdef APT_COMPATIBILITY +#include +#endif #endif