| 1 | // -*- mode: cpp; mode: fold -*- |
| 2 | // Description /*{{{*/ |
| 3 | // $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $ |
| 4 | /* ###################################################################### |
| 5 | |
| 6 | Version - Versioning system.. |
| 7 | |
| 8 | The versioning system represents how versions are compared, represented |
| 9 | and how dependencies are evaluated. As a general rule versioning |
| 10 | systems are not compatible unless specifically allowed by the |
| 11 | TestCompatibility query. |
| 12 | |
| 13 | The versions are stored in a global list of versions, but that is just |
| 14 | so that they can be queried when someone does 'apt-get -v'. |
| 15 | pkgSystem provides the proper means to access the VS for the active |
| 16 | system. |
| 17 | |
| 18 | ##################################################################### */ |
| 19 | /*}}}*/ |
| 20 | #ifndef PKGLIB_VERSION_H |
| 21 | #define PKGLIB_VERSION_H |
| 22 | |
| 23 | |
| 24 | #include <apt-pkg/strutl.h> |
| 25 | #include <string> |
| 26 | |
| 27 | using std::string; |
| 28 | |
| 29 | class pkgVersioningSystem |
| 30 | { |
| 31 | public: |
| 32 | // Global list of VS's |
| 33 | static pkgVersioningSystem **GlobalList; |
| 34 | static unsigned long GlobalListLen; |
| 35 | static pkgVersioningSystem *GetVS(const char *Label); |
| 36 | |
| 37 | const char *Label; |
| 38 | |
| 39 | // Compare versions.. |
| 40 | virtual int DoCmpVersion(const char *A,const char *Aend, |
| 41 | const char *B,const char *Bend) = 0; |
| 42 | |
| 43 | virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0; |
| 44 | virtual int DoCmpReleaseVer(const char *A,const char *Aend, |
| 45 | const char *B,const char *Bend) = 0; |
| 46 | virtual string UpstreamVersion(const char *A) = 0; |
| 47 | |
| 48 | // See if the given VS is compatible with this one.. |
| 49 | virtual bool TestCompatibility(pkgVersioningSystem const &Against) |
| 50 | {return this == &Against;}; |
| 51 | |
| 52 | // Shortcuts |
| 53 | APT_MKSTRCMP(CmpVersion,DoCmpVersion); |
| 54 | APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer); |
| 55 | |
| 56 | pkgVersioningSystem(); |
| 57 | virtual ~pkgVersioningSystem() {}; |
| 58 | }; |
| 59 | |
| 60 | #ifdef APT_COMPATIBILITY |
| 61 | #include <apt-pkg/debversion.h> |
| 62 | #endif |
| 63 | |
| 64 | #endif |