summaryrefslogtreecommitdiff
path: root/apt-pkg/version.h
blob: 3ced5d3e431a5807cb2d63c8aaa8fd60a1961e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// -*- mode: cpp; mode: fold -*-
// Description								/*{{{*/
// $Id: version.h,v 1.2 1998/07/07 04:17:09 jgg Exp $
/* ######################################################################

   Version - Version string 
   
   This class implements storage and operators for version strings.

   The client is responsible for stripping epochs should it be desired.
   
   ##################################################################### */
									/*}}}*/
// Header section: pkglib
#ifndef PKGLIB_VERSION_H
#define PKGLIB_VERSION_H

#ifdef __GNUG__
#pragma interface "pkglib/version.h"
#endif 

#include <string>

class pkgVersion
{
   string Value;
   
   public:

   inline operator string () const {return Value;};

   // Assignmnet
   void operator =(string rhs) {Value = rhs;};
   
   // Comparitors. STL will provide the rest
   bool operator ==(const pkgVersion &rhs) const;
   bool operator <(const pkgVersion &rhs) const;
   
   pkgVersion();
   pkgVersion(string Version) : Value(Version) {};
};

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);

#endif