cleanup
[fapman] / apt-src / version.h
1 /*
2 Apt is copyright 1997, 1998, 1999 Jason Gunthorpe and others.
3 Apt is currently developed by APT Development Team <deity@lists.debian.org>.
4
5 License: GPLv2+
6
7         This program is free software; you can redistribute it and/or modify
8         it under the terms of the GNU General Public License as published by
9         the Free Software Foundation; either version 2 of the License, or
10         (at your option) any later version.
11
12         This program is distributed in the hope that it will be useful,
13         but WITHOUT ANY WARRANTY; without even the implied warranty of
14         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15         GNU General Public License for more details.
16
17         You should have received a copy of the GNU General Public License
18         along with this program; if not, write to the Free Software
19         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 See /usr/share/common-licenses/GPL-2, or
22 <http://www.gnu.org/copyleft/gpl.txt> for the terms of the latest version
23 of the GNU General Public License.
24 */
25
26
27
28 // -*- mode: cpp; mode: fold -*-
29 // Description                                                          /*{{{*/
30 // $Id: version.h,v 1.8 2001/05/27 05:55:27 jgg Exp $
31 /* ######################################################################
32
33    Version - Versioning system..
34
35    The versioning system represents how versions are compared, represented
36    and how dependencies are evaluated. As a general rule versioning
37    systems are not compatible unless specifically allowed by the 
38    TestCompatibility query.
39    
40    The versions are stored in a global list of versions, but that is just
41    so that they can be queried when someone does 'apt-get -v'. 
42    pkgSystem provides the proper means to access the VS for the active
43    system.
44    
45    ##################################################################### */
46                                                                         /*}}}*/
47 #ifndef PKGLIB_VERSION_H
48 #define PKGLIB_VERSION_H
49
50
51 #include "strutl.h"
52 #include <string>
53
54 using std::string;
55
56 class pkgVersioningSystem
57 {
58    public:
59    // Global list of VS's
60    static pkgVersioningSystem **GlobalList;
61    static unsigned long GlobalListLen;
62    static pkgVersioningSystem *GetVS(const char *Label);
63    
64    const char *Label;
65    
66    // Compare versions..
67    virtual int DoCmpVersion(const char *A,const char *Aend,
68                           const char *B,const char *Bend) = 0;   
69
70    virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
71    virtual int DoCmpReleaseVer(const char *A,const char *Aend,
72                                const char *B,const char *Bend) = 0;
73    virtual string UpstreamVersion(const char *A) = 0;
74    
75    // See if the given VS is compatible with this one.. 
76    virtual bool TestCompatibility(pkgVersioningSystem const &Against) 
77                 {return this == &Against;};
78
79    // Shortcuts
80    APT_MKSTRCMP(CmpVersion,DoCmpVersion);
81    APT_MKSTRCMP(CmpReleaseVer,DoCmpReleaseVer);
82    
83    pkgVersioningSystem();
84    virtual ~pkgVersioningSystem() {};
85 };
86
87 #ifdef APT_COMPATIBILITY
88 #include "debversion.h"
89 #endif
90
91 #endif