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