apt @VERSION@

version.h

00001 // -*- mode: cpp; mode: fold -*-
00002 // Description                                                          /*{{{*/
00003 // $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $
00004 /* ######################################################################
00005 
00006    Version - Versioning system..
00007 
00008    The versioning system represents how versions are compared, represented
00009    and how dependencies are evaluated. As a general rule versioning
00010    systems are not compatible unless specifically allowed by the 
00011    TestCompatibility query.
00012    
00013    The versions are stored in a global list of versions, but that is just
00014    so that they can be queried when someone does 'apt-get -v'. 
00015    pkgSystem provides the proper means to access the VS for the active
00016    system.
00017    
00018    ##################################################################### */
00019                                                                         /*}}}*/
00020 #ifndef PKGLIB_VERSION_H
00021 #define PKGLIB_VERSION_H
00022 
00023 
00024 #include <apt-pkg/strutl.h>    
00025 #include <string>
00026 
00027 using std::string;
00028 
00029 class pkgVersioningSystem
00030 {
00031    public:
00032    // Global list of VS's
00033    static pkgVersioningSystem **GlobalList;
00034    static unsigned long GlobalListLen;
00035    static pkgVersioningSystem *GetVS(const char *Label);
00036    
00037    const char *Label;
00038    
00039    // Compare versions..
00040    virtual int DoCmpVersion(const char *A,const char *Aend,
00041                           const char *B,const char *Bend) = 0;   
00042 
00043    virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
00044    virtual int DoCmpReleaseVer(const char *A,const char *Aend,
00045                                const char *B,const char *Bend) = 0;
00046    virtual string UpstreamVersion(const char *A) = 0;
00047    
00048    // See if the given VS is compatible with this one.. 
00049    virtual bool TestCompatibility(pkgVersioningSystem const &Against) 
00050                 {return this == &Against;};
00051 
00052    // Shortcuts
00053    APT_MKSTRCMP(CmpVersion,DoCmpVersion);
00054    APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
00055    
00056    pkgVersioningSystem();
00057    virtual ~pkgVersioningSystem() {};
00058 };
00059 
00060 #ifdef APT_COMPATIBILITY
00061 #include <apt-pkg/debversion.h>
00062 #endif
00063 
00064 #endif