]> git.saurik.com Git - apt.git/blame - apt-pkg/version.h
Optimize VersionHash() to not need temporary copy of input
[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
472ff00e 23#include <apt-pkg/strutl.h>
578bfd0a
AL
24#include <string>
25
a4f6bdc8
DK
26#ifndef APT_8_CLEANER_HEADERS
27using std::string;
28#endif
29
b2e465d6
AL
30class pkgVersioningSystem
31{
32 public:
33 // Global list of VS's
34 static pkgVersioningSystem **GlobalList;
35 static unsigned long GlobalListLen;
a02db58f 36 static pkgVersioningSystem *GetVS(const char *Label) APT_PURE;
b2e465d6
AL
37
38 const char *Label;
39
40 // Compare versions..
41 virtual int DoCmpVersion(const char *A,const char *Aend,
42 const char *B,const char *Bend) = 0;
851a45a8 43
b2e465d6
AL
44 virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
45 virtual int DoCmpReleaseVer(const char *A,const char *Aend,
46 const char *B,const char *Bend) = 0;
8f3ba4e8 47 virtual std::string UpstreamVersion(const char *A) = 0;
b2e465d6
AL
48
49 // See if the given VS is compatible with this one..
50 virtual bool TestCompatibility(pkgVersioningSystem const &Against)
51 {return this == &Against;};
52
53 // Shortcuts
c24972cb
AL
54 APT_MKSTRCMP(CmpVersion,DoCmpVersion);
55 APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
b2e465d6
AL
56
57 pkgVersioningSystem();
c8a4ce6c 58 virtual ~pkgVersioningSystem();
b2e465d6
AL
59};
60
578bfd0a 61#endif