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 #include <apt-pkg/strutl.h>
00024 #include <string>
00025 
00026 class pkgVersioningSystem
00027 {
00028    public:
00029    // Global list of VS's
00030    static pkgVersioningSystem **GlobalList;
00031    static unsigned long GlobalListLen;
00032    static pkgVersioningSystem *GetVS(const char *Label);
00033    
00034    const char *Label;
00035    
00036    // Compare versions..
00037    virtual int DoCmpVersion(const char *A,const char *Aend,
00038                           const char *B,const char *Bend) = 0;   
00039 
00040    virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
00041    virtual int DoCmpReleaseVer(const char *A,const char *Aend,
00042                                const char *B,const char *Bend) = 0;
00043    virtual std::string UpstreamVersion(const char *A) = 0;
00044    
00045    // See if the given VS is compatible with this one.. 
00046    virtual bool TestCompatibility(pkgVersioningSystem const &Against) 
00047                 {return this == &Against;};
00048 
00049    // Shortcuts
00050    APT_MKSTRCMP(CmpVersion,DoCmpVersion);
00051    APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
00052    
00053    pkgVersioningSystem();
00054    virtual ~pkgVersioningSystem() {};
00055 };
00056 
00057 #endif