]> git.saurik.com Git - apt.git/blame - apt-pkg/version.h
* merged from apt--tasks
[apt.git] / apt-pkg / version.h
CommitLineData
578bfd0a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
c24972cb 3// $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $
578bfd0a
AL
4/* ######################################################################
5
b2e465d6
AL
6 Version - Versioning system..
7
8 The versioning system represents how versions are compared, represented
9 and how dependencies are evaluated. As a general rule versioning
10 systems are not compatible unless specifically allowed by the
11 TestCompatibility query.
578bfd0a 12
b2e465d6
AL
13 The versions are stored in a global list of versions, but that is just
14 so that they can be queried when someone does 'apt-get -v'.
15 pkgSystem provides the proper means to access the VS for the active
16 system.
578bfd0a
AL
17
18 ##################################################################### */
19 /*}}}*/
578bfd0a
AL
20#ifndef PKGLIB_VERSION_H
21#define PKGLIB_VERSION_H
22
6c139d6e 23#ifdef __GNUG__
094a497d 24#pragma interface "apt-pkg/version.h"
6c139d6e
AL
25#endif
26
c24972cb 27#include <apt-pkg/strutl.h>
578bfd0a
AL
28#include <string>
29
851a45a8
AL
30using std::string;
31
b2e465d6
AL
32class pkgVersioningSystem
33{
34 public:
35 // Global list of VS's
36 static pkgVersioningSystem **GlobalList;
37 static unsigned long GlobalListLen;
38 static pkgVersioningSystem *GetVS(const char *Label);
39
40 const char *Label;
41
42 // Compare versions..
43 virtual int DoCmpVersion(const char *A,const char *Aend,
44 const char *B,const char *Bend) = 0;
851a45a8 45
b2e465d6
AL
46 virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
47 virtual int DoCmpReleaseVer(const char *A,const char *Aend,
48 const char *B,const char *Bend) = 0;
49 virtual string UpstreamVersion(const char *A) = 0;
50
51 // See if the given VS is compatible with this one..
52 virtual bool TestCompatibility(pkgVersioningSystem const &Against)
53 {return this == &Against;};
54
55 // Shortcuts
c24972cb
AL
56 APT_MKSTRCMP(CmpVersion,DoCmpVersion);
57 APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
b2e465d6
AL
58
59 pkgVersioningSystem();
60 virtual ~pkgVersioningSystem() {};
61};
62
63#ifdef APT_COMPATIBILITY
64#include <apt-pkg/debversion.h>
65#endif
578bfd0a
AL
66
67#endif