1 // -*- mode: cpp; mode: fold -*-
3 // $Id: debversion.h,v 1.3 2001/05/03 05:25:04 jgg Exp $
4 /* ######################################################################
6 Debian Version - Versioning system for Debian
8 This implements the standard Debian versioning system.
10 ##################################################################### */
12 #ifndef PKGLIB_DEBVERSION_H
13 #define PKGLIB_DEBVERSION_H
16 #pragma interface "apt-pkg/debversion.h"
19 #include <apt-pkg/version.h>
21 class debVersioningSystem
: public pkgVersioningSystem
25 static int CmpFragment(const char *A
, const char *AEnd
, const char *B
,
29 virtual int DoCmpVersion(const char *A
,const char *Aend
,
30 const char *B
,const char *Bend
);
31 virtual bool CheckDep(const char *PkgVer
,int Op
,const char *DepVer
);
32 virtual int DoCmpReleaseVer(const char *A
,const char *Aend
,
33 const char *B
,const char *Bend
)
35 return DoCmpVersion(A
,Aend
,B
,Bend
);
37 virtual string
UpstreamVersion(const char *A
);
39 debVersioningSystem();
42 extern debVersioningSystem debVS
;
44 #ifdef APT_COMPATIBILITY
45 #if APT_COMPATIBILITY != 986
46 #warning "Using APT_COMPATIBILITY"
49 inline int pkgVersionCompare(const char *A
, const char *B
)
51 return debVS
.CmpVersion(A
,B
);
53 inline int pkgVersionCompare(const char *A
, const char *AEnd
,
54 const char *B
, const char *BEnd
)
56 return debVS
.DoCmpVersion(A
,AEnd
,B
,BEnd
);
58 inline int pkgVersionCompare(string A
,string B
)
60 return debVS
.CmpVersion(A
,B
);
62 inline bool pkgCheckDep(const char *DepVer
,const char *PkgVer
,int Op
)
64 return debVS
.CheckDep(PkgVer
,Op
,DepVer
);
66 inline string
pkgBaseVersion(const char *Ver
)
68 return debVS
.UpstreamVersion(Ver
);