summaryrefslogtreecommitdiff
path: root/apt-pkg/version.h
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/version.h')
-rw-r--r--apt-pkg/version.h69
1 files changed, 58 insertions, 11 deletions
diff --git a/apt-pkg/version.h b/apt-pkg/version.h
index 127519583..27e8e1f1b 100644
--- a/apt-pkg/version.h
+++ b/apt-pkg/version.h
@@ -1,16 +1,22 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: version.h,v 1.5 1999/04/19 06:03:09 jgg Exp $
+// $Id: version.h,v 1.6 2001/02/20 07:03:17 jgg Exp $
/* ######################################################################
- Version - Version comparison routines
+ Version - Versioning system..
+
+ The versioning system represents how versions are compared, represented
+ and how dependencies are evaluated. As a general rule versioning
+ systems are not compatible unless specifically allowed by the
+ TestCompatibility query.
- These routines provide some means to compare versions and check
- dependencies.
+ The versions are stored in a global list of versions, but that is just
+ so that they can be queried when someone does 'apt-get -v'.
+ pkgSystem provides the proper means to access the VS for the active
+ system.
##################################################################### */
/*}}}*/
-// Header section: pkglib
#ifndef PKGLIB_VERSION_H
#define PKGLIB_VERSION_H
@@ -20,11 +26,52 @@
#include <string>
-int pkgVersionCompare(const char *A, const char *B);
-int pkgVersionCompare(const char *A, const char *AEnd, const char *B,
- const char *BEnd);
-int pkgVersionCompare(string A,string B);
-bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op);
-string pkgBaseVersion(const char *Ver);
+class pkgVersioningSystem
+{
+ public:
+ // Global list of VS's
+ static pkgVersioningSystem **GlobalList;
+ static unsigned long GlobalListLen;
+ static pkgVersioningSystem *GetVS(const char *Label);
+
+ const char *Label;
+
+ // Compare versions..
+ virtual int DoCmpVersion(const char *A,const char *Aend,
+ const char *B,const char *Bend) = 0;
+ virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
+ virtual int DoCmpReleaseVer(const char *A,const char *Aend,
+ const char *B,const char *Bend) = 0;
+ virtual string UpstreamVersion(const char *A) = 0;
+
+ // See if the given VS is compatible with this one..
+ virtual bool TestCompatibility(pkgVersioningSystem const &Against)
+ {return this == &Against;};
+
+ // Shortcuts
+ inline int CmpVersion(const char *A, const char *B)
+ {
+ return DoCmpVersion(A,A+strlen(A),B,B+strlen(B));
+ };
+ inline int CmpVersion(string A,string B)
+ {
+ return DoCmpVersion(A.begin(),A.end(),B.begin(),B.end());
+ };
+ inline int CmpReleaseVer(const char *A, const char *B)
+ {
+ return DoCmpReleaseVer(A,A+strlen(A),B,B+strlen(B));
+ };
+ inline int CmpReleaseVer(string A,string B)
+ {
+ return DoCmpReleaseVer(A.begin(),A.end(),B.begin(),B.end());
+ };
+
+ pkgVersioningSystem();
+ virtual ~pkgVersioningSystem() {};
+};
+
+#ifdef APT_COMPATIBILITY
+#include <apt-pkg/debversion.h>
+#endif
#endif